Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better syntax highlighting support - consider switchting from HighlightJS to Prism #2313

Open
joepio opened this issue Feb 7, 2024 · 6 comments
Labels
A-Highlighting Area: Code colored syntax highlighting C-enhancement Category: Enhancement or feature request

Comments

@joepio
Copy link
Contributor

joepio commented Feb 7, 2024

Problem

The current highlighter (powered by highlight.ts) does not support .tsx.

Proposed Solution

Switch to Prism

Notes

Some related discussions:

highlightjs/highlight.js#3625

@joepio joepio added the C-enhancement Category: Enhancement or feature request label Feb 7, 2024
@ehuss ehuss added the A-Highlighting Area: Code colored syntax highlighting label Feb 13, 2024
@toastal
Copy link

toastal commented Jun 25, 2024

Only if the switch is moving from client-side highlight.js to build-side Prism.

Client-side highlight.js & Prism both are incredibly wasteful for documentation. For the most part, your documentation’s code samples aren’t changing so why is mdBook shipping client-side parsing libraries at all & making all downstream users parse & highlight the exact same unchanging content when this tool should be doing the syntax highlighting at build time to save energy, data, & time for users. See also: #1383

@uncenter
Copy link

Prism is currently unmaintained and the documentation isn't great. I'd definitely like mdBook to switch to some sort of build-time syntax highlighting (client-side syntax highlighting for static code in 2024 😔) - but Prism isn't it. Shiki is the most powerful and maintained syntax highlighter right now, might be worth a look though I'm not sure how it would integrate into the build system.

@toastal
Copy link

toastal commented Nov 15, 2024 via email

@uncenter
Copy link

The main branch hasn't been updated in 2 years and the v2 branch hasn't had a commit for 9 months. Seems to have stalled. I don't see any benefits of Prism over Highlight.js but especially compared to Shiki.

@toastal
Copy link

toastal commented Nov 15, 2024 via email

@uncenter
Copy link

9 months. Single-maintainer project dead. Lol.

I don't mean to criticize the maintainer but the project only having a single maintainer is yet another reason not to switch to it. And 9 months is a long time! Do you have any thoughts about Shiki?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Highlighting Area: Code colored syntax highlighting C-enhancement Category: Enhancement or feature request
Projects
None yet
Development

No branches or pull requests

4 participants