Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User guide highlights Java and Kotlin code wrong #3287

Open
rillig opened this issue May 6, 2023 · 10 comments
Open

User guide highlights Java and Kotlin code wrong #3287

rillig opened this issue May 6, 2023 · 10 comments

Comments

@rillig
Copy link
Contributor

rillig commented May 6, 2023

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.junit is highlighted inconsistently. The word static is highlighed like other class names, the words org and junit are colored differently.

On a related note, the highlighting colors in the HTML and PDF versions differ unnecessarily.

@marcphilipp
Copy link
Member

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?

@sbrannen
Copy link
Member

sbrannen commented May 6, 2023

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

@sbrannen
Copy link
Member

sbrannen commented May 6, 2023

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).

@sbrannen
Copy link
Member

sbrannen commented May 6, 2023

  • In the Java tests, import static org.junit is highlighted inconsistently. The word static is highlighed like other class names, the words org and junit are 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.

@rillig
Copy link
Contributor Author

rillig commented May 6, 2023

Another one: double quotes in Java text blocks. For example, "lemon lime" is highlighted in the wrong color.

@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

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?

@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

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 rouge-ruby/rouge#1921.

@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

@rillig, I have reported your findings to the Rouge team here:

@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

I also raised the following issue which should address support for several missing keywords.

@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

Let's see if anybody from the Twittersphere can help...

https://twitter.com/sam_brannen/status/1655216258604838916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants