The discussion revolves around adding RPM specfile syntax highlighting to Discourse via Highlight.js. mattdm notes that Highlight.js now encourages external repositories for new languages and requests integration of highlightjs-rpm-specfile. Falco responds that Discourse supports this via theme components and quickly packages a solution: discourse-highlightjs-rpm. mattdm confirms it works, but notes some syntax elements like Name:, Release:, %if, and %endif aren’t highlighted as expected. After investigation, mattdm discovers the issue isn’t with the highlighter or theme component, but with missing CSS classes in Discourse core — specifically .hljs-type. david fixes this in a PR (#24827), adding the missing styles. mattdm confirms the fix works and thanks the team. The feature is now functional, with syntax highlighting dependent on the active theme’s styling.
Hmm, but it doesn’t seem to be complete… I’m getting bold for sections like %description and %prep, purple for macros like %{?dist}, and # comments get grey italics. So far so good.
Are those comments directed to the Discourse integration or to the quality of the highlighter itself?
I only copy and pasted the definition from the link you provided in the OP into a Discourse-compatible Customization > Theme component, so the capabilities of it are still the original ones.
I’m seeing those things in the code in your[1] repo, so I expect that they’d work, but they do not appear to be highlighted in DIscourse. I don’t know if that’s a problem with the highlighter module, the Discourse implementation of that, or the theme component.
this is not meant to be a blame statement, like “it’s your repo”… just to be clear ↩︎
@falco — I had some time to look at this. Using Firefox’s built-in inspector, I can see that it properly add spans with classes hljs-type, hljs-keyword, etc. But if I look over on the styles side, I see a .hljs but not .hljs-type — only .hljs-keyword and .hljs-comment (the ones that work) seem to be there.