A user reports that code block syntax highlighting is not working properly after upgrading to Discourse 2.9.0.beta6, with keywords in code blocks (e.g., Python) no longer colored. Another user confirms the issue, noting that while color highlighting fails, code block diffs still work. A solution is proposed by Takanobu_Fuse: uninstall the hljs-theme-picker component, then manually copy the CSS from a theme (e.g., rainbow.css) into the site’s theme CSS/HTML. SkyLin confirms this workaround resolves the issue but notes the problem likely stems from a bug in the hljs-theme-picker component and requests a formal fix from the Discourse team.
The code block works fine in the past. However, there is an user created a new post with code block yesterday, and I found the format failed. Not only this post with block code, but also whole site.
I just rebuild discourse app to the most update version, but the result is still the same.
I think this means discourse hljs theme picker has some hidden bug. No reason the same code works fine with CSS but failed on component installed.
And I’m sorry that I will not set your solusion as Soluion, though it truly solve my problem. I leave it as open and hope discourse team @cocococosti can find out the reason behind and work out a formal solution.
The CSS code I use is what I set in hljs theme picker: