valeriangalliat / markdown-it-highlightjs

Preset to use highlight.js with markdown-it.
The Unlicense
54 stars 30 forks source link

Bump Highlightjs version and change how it's loaded #12

Closed JTinkers closed 3 years ago

JTinkers commented 4 years ago

Right now it uses an outdated version and imports all languages by default. This makes whole plugin pack a whopping 1.04 MB.

https://i.imgur.com/9AGcONT.png

valeriangalliat commented 3 years ago

Hey! I just merged a PR that updates highlight.js, I published markdown-it-highlightjs@3.3.0 with that

How would you go to prevent importing all languages by default? Does highlight.js support anything like this?

JTinkers commented 3 years ago

Yes, it allows you to either autoload all or selected ones.

https://highlightjs.readthedocs.io/en/latest/api.html#configure-options - the languages field in configure(options)

valeriangalliat commented 3 years ago

Oh makes sense

Since those are global highlight.js options, you should be able to do require('highlight.js').configure({ languages: [...] }) before calling markdown-it-highlightjs! Let me know if that works :)

JTinkers commented 3 years ago

Yeah, I've just forked and modified your package few months ago.