Switch from inline syntax highlighting styles to external CSS file#181
Conversation
|
Looks good to me thanks! A small question, could someone override the code background by putting something like the following in custom.css? If so, I would mention it in the wiki along your changes. Custom generation would then mean appending to the hugo gen chromastyles --style monokai >> assets/css/custom.css |
That doesn't work but this does: .chroma, .bg {
background-color: ...;
}However, in this case it would be better to override the
I deliberately created a separate file for syntax highlighting to make overriding the styles easier. Appending to |
Okay that's perfect then, thanks for clarifying :) |
|
Sorry I merged, but then realized that the code background in case of dark mode is not respected, perhaps something is missing? Maybe it's an important here: .bg {
background-color: var(--code-background);
}Please reopen, I'll make sure to test without merging next time |
|
That's weird, I tested that behavior. |
|
What browser did you use? Maybe it's a Safari issue. |
|
I see what's happening here: unfortunately, With this in mind, do you still want this change? |
|
I see, which one do you like better? The left one looks more like the preview here: https://xyproto.github.io/splash/docs/algol.html. Maybe this changed between Hugo versions; which version do you use? |
|
I am not sure, I must have done something not really standard while setting it up the first time. The current one seems to be algol without underlines or italics, maybe something is inherited from the stylesheet? Let's start with algol_nu as it seems to be the closest to the original. |
|
If I look at your website, it seems the inline styles only modify the font weight but not the colors. Since the colors are absent from the inline styles, I don't think it has to do with the stylesheet, but I don't have a clue why the colors are absent in the first place. I'll make the proposed changes and open a new PR! |


As documented in the wiki, stylesheets for syntax highlighting can be easily generated using Hugo.
This introduces a (small) breaking change: users who configured a different style using the
markup.highlightsettings will have to setnoClassestotrue.However, it is no longer necessary to overwrite the code block background, as that is now handled by
syntax-highlighting.css.Closes #164