-
Notifications
You must be signed in to change notification settings - Fork 750
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
Rust unsafe keyword should be highlighted differently #1299
Comments
@gautammohan Can you provide some examples of the other syntax highlighters you're talking about? I'm curious how they're tokenising |
I use emacs normally, and (Link to where I believe they handle |
Hmmm... the problem is that there's not really a token that would be appropriate for What's the use case? Are you wanting to have the same kind of highlighting in a blog post? |
Yep, highlighting in a blog post is precisely the use case. A potential workaround (for my case) would probably be to create a special tag and amend my css files. I wasn't sure if it was an easy fix or not, but it looks like it might not be trivial. I'm not even sure if the Rust community agrees on a canonical syntax highlighting style. If it turns out that many of the tools treat |
I don't know how much control you have over the server but you might be interested in looking into the Escape lexer that was added in v3.4.0 of Rouge. If you have a formatter that has escaping enabled, you should be able to insert HTML into your source code that will be 'ignored' by Rouge and passed straight through to your blogging engine. We need to document its use better and so you might prefer a different way of achieving your goal but if you're curious about this, PR #1152 (where it was added) is a good place to start. I hope that's helpful! |
Is your enhancement request related to a problem? Please describe.
Unsafe blocks are uncommon and should be very loudly highlighted in Rust. Most Rust syntax highlighters make the
unsafe
keyword bright red, however it seems that Rouge groups it with other keywords.Describe the solution you'd like
Is there a way to capture the "unsafe" keyword and highlight it differently?
Additional context
The text was updated successfully, but these errors were encountered: