mattdm
(Matthew Miller)
2월 17, 2023, 3:44오후
1
Apparently highlightjs, due to lack of core maintainers, is asking for new language support to be added via separate repositories. (See Policy: Discuss extras repository for additional languages · Issue #2149 · highlightjs/highlight.js · GitHub ).
One such separate repo is GitHub - highlightjs/highlightjs-rpm-specfile · GitHub , for highlighting the RPM specfile syntax. Could you please add that to Discourse? It would be hugely helpful for Fedora!
1개의 좋아요
Falco
(Falco)
2월 17, 2023, 3:46오후
2
비기본 언어를 #customization:theme-component로 추가해 왔으며, 이를 위해 전용 API 훅까지 추가했습니다.
3개의 좋아요
mattdm
(Matthew Miller)
2월 17, 2023, 3:50오후
3
Okay, cool — is there an example I can crib from?
2개의 좋아요
Falco
(Falco)
2월 17, 2023, 4:20오후
4
5개의 좋아요
mattdm
(Matthew Miller)
2월 17, 2023, 4:26오후
5
Thank you!!! And, yep — right after lunch.
3개의 좋아요
mattdm
(Matthew Miller)
2월 17, 2023, 5:59오후
6
Yes, seems to work!
From what I can see, it seems to auto-detect and work. If I want
```rpm-specfile
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?
1개의 좋아요
mattdm
(Matthew Miller)
2월 17, 2023, 6:10오후
7
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.
But looking at discourse-highlightjs-rpm/javascripts/discourse/lib/rpm-highlightjs.js at main · discourse/discourse-highlightjs-rpm · GitHub , I would expect Name:, Release: etc, to be highlighted in some way too, as well as %if and %endif — but those aren’t.
1개의 좋아요
Falco
(Falco)
2월 17, 2023, 7:00오후
8
그 댓글들은 Discourse 통합에 대한 것인지, 하이라이터 자체의 품질에 대한 것인지요?
OP에서 제공해주신 링크에서 정의를 복사해서 Discourse와 호환되는 #customization:theme-component에 붙여넣었을 뿐이므로, 그 기능은 여전히 원래 것과 동일합니다.
1개의 좋아요
mattdm
(Matthew Miller)
2월 17, 2023, 7:33오후
9
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.
mattdm
(Matthew Miller)
3월 6, 2023, 10:55오후
10
(For the record have bookmarked this to check what should work when I get a chance.)
1개의 좋아요
mattdm
(Matthew Miller)
3월 22, 2023, 3:31오후
11
@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.
mattdm
(Matthew Miller)
3월 22, 2023, 3:36오후
12
Oh, and .hljs-string also works. But I see some of the others in css … any idea what’s going on?
mattdm
(Matthew Miller)
12월 11, 2023, 4:41오후
13
FWIW, this still does not work. (Sad face emoji )
1개의 좋아요
david
(David Taylor)
12월 11, 2023, 6:03오후
14
Looks like core was missing styling for the .hljs-type class. I’ve cleaned things up in this PR .
Exact colours will depend on your theme, but here’s an example RPM file:
3개의 좋아요
mattdm
(Matthew Miller)
12월 12, 2023, 5:56오후
15
Yep, works now. Thank you!
1개의 좋아요
This topic was automatically closed after 3 days. New replies are no longer allowed.