rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.11k stars 1.63k forks source link

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

Open joepio opened 9 months ago

joepio commented 9 months ago

Problem

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

Proposed Solution

Switch to Prism

Notes

Some related discussions:

https://github.com/highlightjs/highlight.js/issues/3625

toastal commented 4 months ago

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: https://github.com/rust-lang/mdBook/issues/1383