Open
Description
Describe the issue
Which language seems to have the issue?
Java. It works perfectly fine for any other language we've tested with. Just Java seems to break for some reason, with multiple different code examples tested.
Are you using highlight
or highlightAuto
?
Highlighting it through hljs.highlightElement(codeElement);
where codeElement is an HTML element of type code
, and then rendering that HTML element to the DOM.
Sample Code to Reproduce
const codeElement = DomBuilder.getInstance().build({
type: 'code',
classNames: [
...(props.language !== undefined ? [ `language-${props.language}` ] : [ 'language-plaintext' ])
],
innerHTML: "Some code string here"
});
hljs.highlightElement(codeElement);

Expected behavior
The code is tokenized into spans and highlighted accordingly.
Additional context
This issue is occurring in the open source MynahUI repository for AWS, specifically in the SyntaxHighlighter component.