User guide highlights Java and Kotlin code wrong
Steps to reproduce
Look at the rendered user guide (either the HTML or the PDF version):
- In the Kotlin test name
exception absence testing, the middle word has a different color than the outer words, even though the words are part of the same identifier. - In the Java tests,
import static org.junitis highlighted inconsistently. The wordstaticis highlighed like other class names, the wordsorgandjunitare colored differently.
On a related note, the highlighting colors in the HTML and PDF versions differ unnecessarily.
We just merged #3267 to improve the accessibility of the web version of the User Guide. To which version of the User Guide are you referring?
That's in current: https://junit.org/junit5/docs/current/user-guide/#writing-tests-assertions-kotlin
It's due to the syntax highlighter which doesn't know how to parse Kotlin's backtick method names.
The same issue can be seen in snapshot: https://junit.org/junit5/docs/snapshot/user-guide/#writing-tests-assertions-kotlin
As far as I understand it, this is out of our control.
Rather, it's an issue with Asciidoc (or perhaps more specifically with the Rouge syntax highlighting feature).
- In the Java tests,
import static org.junitis highlighted inconsistently. The wordstaticis highlighed like other class names, the wordsorgandjunitare colored differently.
Similar to what I stated above about Kotlin backtick quoted method names, the syntax highlighter does not know how to properly parse static imports in Java source code.
Another one: double quotes in Java text blocks. For example, "lemon lime" is highlighted in the wrong color.
All of the issues you have reported are due to deficiencies in the Java lexer in the Rouge project.
Thus, the JUnit team cannot address them.
However, the JUnit team could consider switching to the CodeRay or Pygments syntax highlighters which are also supported by Asciidoc.
But if we switch the syntax highlighter, that would revert the accessibility changes made in conjunction with #3071.
In light of that, I think the best course of action is to raise issue's with the Rouge project.
@junit-team/junit-5, thoughts?
In the Kotlin test name
exception absence testing, the middle word has a different color than the outer words, even though the words are part of the same identifier.
This has already been reported in https://github.com/rouge-ruby/rouge/issues/1921.
@rillig, I have reported your findings to the Rouge team here:
- https://github.com/rouge-ruby/rouge/issues/1956
- https://github.com/rouge-ruby/rouge/issues/1957
I also raised the following issue which should address support for several missing keywords.
- https://github.com/rouge-ruby/rouge/issues/1958
Let's see if anybody from the Twittersphere can help...
https://twitter.com/sam_brannen/status/1655216258604838916