facebook / facebook/docusaurus

Use shiki for code highlight

Offen
#9,122 48 Kommentare 18 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
proposal
Vorherrschende Sprache
TypeScript
Sterne
66.2k
Forks
10k
Ø Merge
1 T. 3 Std.
Gemergte PRs (30 T.)
52

Beschreibung

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Motivation

Have you guys ever considered switching to Shiki for code highlight, instead of Prism?

I find Shiki a lot nicer, with much better grammars that are able to highlight much more code than Prism does.

Also, [Shiki](https://github.com/shikijs/shiki) is being actively maintained, while [Prism](https://github.com/PrismJS/prism) seems a little bit abandoned. However, even if Shiki wasn't being maintained, its themes would never stop improving since they are taken from VS Code anyway.

Here is a quick comparison I did:

Prism (dracula - the default theme from Docusaurus):

![chrome_tz08jPgBEk](https://github.com/facebook/docusaurus/assets/29582865/d0428924-571f-4e33-be0b-7efbdd453a4b)

Shiki (dracula):

![chrome_7sR87uZFQO](https://github.com/facebook/docusaurus/assets/29582865/46914b60-89f5-44da-9b37-68e8f42c7d8d)

PS: I'm aware of [docusaurus-preset-shiki-twoslash](https://www.npmjs.com/package/docusaurus-preset-shiki-twoslash), and that's what I used for the example above (https://github.com/felipecrs/shiki-docusaurus-test). This is to suggest a better default for the project as a whole.

Maybe it's a good breaking change candidate for Docusaurus v3?

### Self-service

- [ ] I'd be willing to do some initial work on this proposal myself.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.