-
Notifications
You must be signed in to change notification settings - Fork 743
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
json lexer: How do I disable the highlighting introduced by mismatching braces, brackets, parentheses? #1467
Comments
@chuck-confluent I'm afraid that I don't know Asciidoctor-PDF so I don't know if this suggestion makes sense but if this were a webpage you could specify a CSS rule that did nothing for errors (since you presumably don't want to highlight those). Perhaps you can do something similar here? Other options:
Hope something there helps! |
@pyrmont Oddly, I think @chuck-confluent has the right idea about the desired behaviour of lexers: our goal is not to highlight all errors, but to make the user's input look nice. I know it can be complex, but I think it's a reasonable goal to be able to highlight partial JSON files. |
Thanks all for responding! Unfortunately asciidoctor treats codeblocks as indivisible units that are meant to fit on one page. If the block is big enough, it will nicely break to a second page, but in a way I can't control. Since there's a CSS rule that suppresses error highlighting, I suspect it's also possible in asciidoctor pdf. I'll ask over there. |
@chuck-confluent It's definitely the case that checking syntactical correctness is a non-goal of Rouge so @jneen is right to say that the JSON lexer could be made to support your use case in a way that wouldn't be inconsistent with Rouge's philosophical approach. I'd need to test it against your example but it might be the case that simply adding a rule for closing braces here to the rouge/lib/rouge/lexers/json.rb Lines 19 to 26 in 81b3671
I think the CSS rule (or equivalent) is the fastest route for your circumstance but if that doesn't work out, let us know. |
Thanks, I've got an issue asking for help over on the asciidoctor github asciidoctor/asciidoctor#3605 |
I'm using asciidoctor-pdf for slides, and I'd like to split json across two pages. Two code blocks. One the second code block, Rouge highlights the braces '}' that don't have a matching '{'. How do I suppress this? The documentation is terribly hard for me to parse
The text was updated successfully, but these errors were encountered: