-
-
Notifications
You must be signed in to change notification settings - Fork 419
WriteCSS not outputting rule for NameBuiltinPseudo #346
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
Comments
This is somewhat deliberate, though perhaps a bit confusing. Basically if a particular style's token type evaluates to the same as the background, it will not be emitted. For example, the
Effectively this should cause no issues; are you seeing some problems due to this? |
Think I get it, basically leaving out unneeded classes. Yea, I did notice this because of a problem. I had used the WriteCSS function to generate a list of css as a starting point to customize the styling. I had noticed once before that a class wasn't output, but at the time didn't trace it back to the function call in Chroma (since it was used through hugo). I noticed it again recently adding a 'dark' theme (with toggle on static site) and noticed some words were black on a now black background. Went looking and found that the Perhaps my understanding of the writeCSS function (called through I'd be happy to submit some changes to the hugo docs on the best way to change anything would be. Thanks for the response. |
I just noticed in your Chroma docs: If WithClasses() is used, the corresponding CSS can be obtained from the formatter with:
So I guess I'd have the same question. If someone wanted to use WithClasses, and generated a stylesheet with WriteCSS, then I think there's the same potential for missing classes causing a problem if customized. Once those styles are outside Chroma, it can no longer intelligently decide which classes are redundant. The irony is that I probably chose to use WithClasses partly to avoid the redundant inline styling in the HTML, yet the attempt to remove redundant classes is what cause the problem I ran into. |
That use case makes sense. I've added an option to the HTML formatter to output even the redundant styles. If you'd like to file a bug with Hugo, bep can update |
bep is requesting if you could tag a release version to pull? |
Yep, tagged v0.7.2! |
Description
When using WriteCSS to autogenerate CSS rules (through Hugo v63.8, but traced that call back to chroma/html.go), the NameBuiltinPseudo CSS (".bp") class is never output.
It's possible this is by design, but I couldn't find a reason why in the code (Not much experience with Go, sorry). Either way, that CSS class is generated during processing for at least Swift, not sure about other languages.
To Reproduce
echo "print(\"Hello World\")" | ./chroma --html --html-only --lexer=swift
generates:
./chroma --html-styles | grep bp
gives no output
The text was updated successfully, but these errors were encountered: