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

Some odd syntax highlighting in some code blocks #525

Open
jafingerhut opened this issue Dec 18, 2024 · 6 comments
Open

Some odd syntax highlighting in some code blocks #525

jafingerhut opened this issue Dec 18, 2024 · 6 comments

Comments

@jafingerhut
Copy link
Contributor

Original comments:

I believe that most of these issues are because the code blocks are not legal syntax for the language we are telling AsciiDoc to use for color highlighting the code block. For example, in something like: id: <number> in a code block marked with the language protobuf, the angle brackets are intended to denote to the reader that <number> can be replaced with any decimal integer in ASCII. The angle brackets are probably illegal, and sometimes are colorized strangely.

@Dscano
Copy link
Contributor

Dscano commented Dec 24, 2024

Proposed Solution

Here are the details of the proposed changes:

  • Replace # with //
  • Replace #... with ...
  • Replace id: <number> with id: "id_value"
  • You can use https://rouge.jneen.net/ to view the results in the code highlighter.

@chrispsommers
Copy link
Collaborator

Hi Davide, I went to the site above but am not sure how to use it. Is it supposed to render the AsciiDoc? I don't see a choice for that.

@Dscano
Copy link
Contributor

Dscano commented Dec 24, 2024

Hi Davide, I went to the site above but am not sure how to use it. Is it supposed to render the AsciiDoc? I don't see a choice for that.

Hi Chris,

You can use https://rouge.jneen.net/ to render the code contained in the .adoc file. In other words, you can copy and paste the protobuf code defined within the .adoc file to see how it will be rendered. In the case of protobuf, the # and<>symbols will be highlighted in red, as you pointed out in #510. So this means that these symbols are not rendered properly by the Rouge highlighter for protobuf.

@chrispsommers
Copy link
Collaborator

I see what you mean:
image
Is there a way to file an issue against Rouge?

@jafingerhut
Copy link
Contributor Author

We could, of course, file an issue against Rouge. Just realize that they might not be very sympathetic to changes that require accepting incorrect syntax for the language that is being claimed to be highlighted in a code block (if that is what you are hoping to ask them -- I am not sure).

@jafingerhut
Copy link
Contributor Author

If we do not like the syntax highlighting for a particular language that Rouge provides for Protobuf, we could consider also changing the language we claim the code block is written in, including to one that causes no color highlighting to occur at all.

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