-
-
Notifications
You must be signed in to change notification settings - Fork 793
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
How to suppress error highlighting? #3605
Comments
Asciidoctor has no control over this behavior. Asciidoctor delegates syntax highlighting to the source highlighter. How it handles that task is up to it. Rouge apparently requires that the JSON document be complete or else it flags it as an error. So it's best to highlight a valid JSON snippet or disable syntax highlighting (by removing the
In truth, the name doesn't matter at all. If there is an attribute in the third position, line numbering is enabled. It could be named
But the preferred syntax is the option:
This sounds like an Asciidoctor PDF issue. Are you putting text between the snippets, or just breaking up a single block so that it fits on different pages? If the latter, you shouldn't need to as that's what Asciidoctor PDF already does. |
Thanks again for your help, Dan! I use asciidoctor-pdf to make slides, and there are some json examples where I want part of the json on one slide and the rest on the next slide for conceptual reasons. There is text in between (for example, the slide title). I'm pretty sure there's no way to force a page break in the middle of a code block since a code block is meant to stay together as much as possible. It would be fine if the lexer ignored syntax errors. I brought up this issue on the Rouge page (linked earlier in the github conversation) and they are starting to agree that the lexer shouldn't necessarily highlight errors. They mentioned using a CSS rule to ignore error highlighting, but as these are PDFs, I don't think there is a way for me to control this from the asciidoctor-pdf side of things. I could go in and make modifications to the lexer to ignore syntax errors, but that's going to be hard to maintain with my current build setup for such a small detail. For now, I will just live with it. Let me know if I'm wrong and there is something to be done. |
I've been reading and re-reading the user manual section on source highlighters, but haven't found the options to suppress error highlighting. For context, I am using the json highlighter in Rouge and I'd like to split the json into parts on multiple (pdf) pages. The lexer highlights errors, so on the second page, the closing braces are highlighted because their matching braces are on the first page. Is there an option to pass, like
[source,json,numbered,errors=ignore]
?Generally, I think the documentation could use some improvement in listing all the options available to syntax highlighters. The user manual mentions
linenums
, for example, but I've found in Rouge the syntax isnumbered
, notlinenums
. I'm not even sure where I learned that. It might have been a guess.The text was updated successfully, but these errors were encountered: