hakimel / reveal.js

The HTML Presentation Framework
https://revealjs.com
MIT License
67.91k stars 16.65k forks source link

[Perf] Don't load all languages in the highlight.js plugin #3629

Open jsulpis opened 5 months ago

jsulpis commented 5 months ago

Hi, I noticed that the highlight.js plugin loads all languages by default: https://github.com/hakimel/reveal.js/blob/472535065c7525abf0cc9df51c66f19fd2d2204f/plugin/highlight/plugin.js#L1 The full script is huge, 287.4kB minzipped.

The highlight.js doc suggests to include only the languages needed instead. Maybe with the require syntax the plugin could take an optional parameter to include only specific languages ?

image

This would be a huge performance gain for all users of the plugin.