You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doc: all <pre> tags are highlighted as JavaScript #33363
Concise explanation of what you found to be problematic
While looking into #32938, I discovered that currently, every single <pre> tag gets highlighted as JavaScript regardless of the info string specified (and even if left unspecified). The following line executes the code that does this.
This behavior can be observed in the C++ code blocks in the published API reference documents. The following line is the reason for this — the language has been hard-coded.
@Trott, it is my impression that this would be an excellent opportunity to switch to highlight.js for a few reasons:
SHJS hasn't been updated in 6 years
SHJS is GPL v3 licensed
SHJS doesn't understand modern language syntax
highlight.js is currently well-maintained (and popular)
highlight.js is BSD licensed
highlight.js is able to highlight the modern syntax of several languages
we'd have syntax highlighting on par w/ the Markdown docs rendered on GitHub.com
I think there was a reason why @zeke mentioned it in passing — it's the route to go nowadays. If GitHub's syntax highlighting library (Prettylights) were OSS, we'd ideally use that, but that doesn't seem to be one of our options. I can give it a day or two before proceeding in case others want to shop around and propose a superior frontend syntax highlighting library, but this seems like the best bet as far as I can tell.
Hi folks! As this discussion mentions ideally using PrettyLights by GH, I wanted to drop a suggestion for a project which I made that does exactly that: https://github.com/wooorm/starry-night. HLJS is much lighter, but if y’all are noticing problems, starry-night might be a good choice!
Activity
Trott commentedon May 12, 2020
Yes, please fix this! 😀
DerekNonGeneric commentedon May 14, 2020
@Trott, it is my impression that this would be an excellent opportunity to switch to highlight.js for a few reasons:
I think there was a reason why @zeke mentioned it in passing — it's the route to go nowadays. If GitHub's syntax highlighting library (Prettylights) were OSS, we'd ideally use that, but that doesn't seem to be one of our options. I can give it a day or two before proceeding in case others want to shop around and propose a superior frontend syntax highlighting library, but this seems like the best bet as far as I can tell.
/cc @nodejs/documentation
zeke commentedon May 14, 2020
☝️ Yep that is why I mentioned it.
doc,tools: properly syntax highlight API ref docs
doc,tools: properly syntax highlight API ref docs
doc,tools: properly syntax highlight API ref docs
doc,tools: properly syntax highlight API ref docs
doc,tools: properly syntax highlight API ref docs
wooorm commentedon May 14, 2022
Hi folks! As this discussion mentions ideally using PrettyLights by GH, I wanted to drop a suggestion for a project which I made that does exactly that: https://github.com/wooorm/starry-night. HLJS is much lighter, but if y’all are noticing problems,
starry-nightmight be a good choice!