February 17, 2023, 3:44pm
Apparently highlightjs, due to lack of core maintainers, is asking for new language support to be added via separate repositories. (See
One such separate repo is
GitHub - highlightjs/highlightjs-rpm-specfile, for highlighting the RPM specfile syntax. Could you please add that to Discourse? It would be hugely helpful for Fedora!
February 17, 2023, 3:46pm
We’ve been adding non default languages as
, even added a dedicated API hook for this. theme-component
February 17, 2023, 3:50pm
Okay, cool — is there an example I can crib from?
February 17, 2023, 4:20pm
I packaged one quickly for you, can you try it out?
February 17, 2023, 4:26pm
Thank you!!! And, yep — right after lunch.
February 17, 2023, 5:59pm
Yes, seems to work!
From what I can see, it seems to auto-detect and work. If I want
to work, I seem to need to put
rpm-specfile in the “highlighted languages” site setting. Is that correct?
Also, if I put
rpm there, that
also works. Is this expected, or is it one of those things where I want to happen is happening for the wrong reason?
February 17, 2023, 6:10pm
Hmm, but it doesn’t seem to be complete… I’m getting bold for sections like
%prep, purple for macros like
# comments get grey italics. So far so good.
But looking at
discourse-highlightjs-rpm/rpm-highlightjs.js at main · discourse/discourse-highlightjs-rpm · GitHub, I would expect
Release: etc, to be highlighted in some way too, as well as
%endif — but those aren’t.
February 17, 2023, 7:00pm
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
, so the capabilities of it are still the original ones. theme-component
February 17, 2023, 7:33pm
I’m seeing those things in the code in your 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.
March 6, 2023, 10:55pm
(For the record have bookmarked this to check what
should work when I get a chance.)
March 22, 2023, 3:31pm
@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-keyword, etc. But if I look over on the styles side, I see a
.hljs but not
.hljs-type — only
.hljs-comment (the ones that work) seem to be there.
March 22, 2023, 3:36pm
.hljs-string also works. But I see some of the others in
css … any idea what’s going on?