-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
When I am trying to render an empty script tag '<script></script>' the result will contain an unexpected null tag:
<span class="null">null</span>
As far as I could see the reason is the highlighter tries to figure out the language within the script tag, but cannot figure it out, thus both the language name and the code will be null.
See: com.codewaves.codehighlight.core.HighlightParser.processSubLanguage()
A test case to reproduce the issue:
@Test
public void testScriptError() {
String sourceCode = "<script></script>";
Highlighter highlighter = new Highlighter(something -> new HtmlRenderer("hljs-"));
Highlighter.HighlightResult result = highlighter.highlight("html", sourceCode);
Truth.assertThat(result.getResult().toString()).doesNotContain("null");
}
Metadata
Metadata
Assignees
Labels
No labels