-
Notifications
You must be signed in to change notification settings - Fork 943
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
Dracula syntax highlighting is off #1423
Comments
Is this only on Dracula or on any themes? The rust syntax shipped is pretty old. |
Looks like a bug with the Dracula theme then :/ |
If this happens to be the outdated syntax tool, perhaps we should add Whitesource or Dependabot to help keep things up-to-date. In the meantime, I'll take a crack at trying to find the root cause, if it happens to be more than just an outdated dep. |
There seem to be more issues here too. The variables and identifiers in this code block styled with the Orange is the accent color of this particular Zola site, and previously, the currently active Highlight theme would override the default orange color of this code block text, but not anymore. Not sure if this is a related bug or something deserving of filing a new ticket? I can confirm that |
It's likely. |
There are some Zola highlight themes and syntax definitions that don't work very well, and as such, they sometimes fall back to the base text color provided by the Zola theme. If the base text color is not neutral, e.g. white or black, the code highlighting can look quite terrible, as shown in getzola/zola#1423. It would be nice if the `code` tag defaulted to `var(--color)` instead of `var(--accent)` to avoid breaking several built-in Zola highlight themes. With that said, if there's enough opposition to this change, it's okay; I'm willing to just override the CSS in my own project to fix the highlight themes.
Indeed, it looks like a limitation of the parser. I've tried to adapt a theme, but it's easy to see by using I think that if it could at least recognize the keywords (like forward_ref_binop! { impl const Shl, shl for $t, $f }
In the function definition below, both 'self' and 'f' are fn fmt(&self, f: &mut Formatter<'_>) |
The Sublime syntax file is very old, its last modification was done in 2019. I've tried with another file I found in the https://github.com/rust-lang/rust-enhanced/blob/master/RustEnhanced.sublime-syntax (Note: you must rename Despite that, I find it hard to get any satisfactory result. I don't know if that's a limitation of the parsing system used by Sublime or if it's due to the syntax file itself. For example, the word
So either I leave many groups in the same neutral colour, or it ends up in a mess of inconcistent colours. Has anyone tried other recent syntax files? |
This issue doesn't seem to be active anymore. For anyone looking for a fix, I'll just include my modified version of
This file replaces sublime\syntaxes\Packages\Rust\Rust.sublime-syntax, which is in a Git submodule. I won't commit it in its original repository since it likely breaks some tests and is incompatible with older versions. The fact it's a submodule of Zola also makes it more complicated to update here - I'm using a custom version that I compiled to generate websites. The packed file must be rebuilt after each modification of the syntax file, before compiling Zola: cd components\config
cargo run --example generate_sublime synpack ../../sublime/syntaxes ../../sublime/syntaxes/newlines.packdump To get optimal results, it's best to adapt the theme file but it should already give better results with existing themes. |
The syntax highlighting Dracula theme currently underlines a lot of code that should not be underlined. This is an example
rust
code block:The text was updated successfully, but these errors were encountered: