-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update highlight.js - support syntax highlighting for more languages #2639
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
Labels
A-Highlighting
Area: Code colored syntax highlighting
Comments
szabgab
added a commit
to szabgab/mdBook
that referenced
this issue
Apr 6, 2025
* highlightBlock was deprecated in favor of highlightElement * Generate highlight.js based on the languages that are used in the book. * See rust-lang#2639
szabgab
added a commit
to szabgab/mdBook
that referenced
this issue
Apr 6, 2025
* highlightBlock was deprecated in favor of highlightElement * Generate highlight.js based on the languages that are used in the book. * See rust-lang#2639
szabgab
added a commit
to szabgab/mdBook
that referenced
this issue
Apr 6, 2025
* highlightBlock was deprecated in favor of highlightElement * Generate highlight.js based on the languages that are used in the book. * See rust-lang#2639
szabgab
added a commit
to szabgab/mdBook
that referenced
this issue
Apr 6, 2025
* highlightBlock was deprecated in favor of highlightElement * Generate highlight.js based on the languages that are used in the book. * See rust-lang#2639
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
There are many issues and even PRs asking to add syntax highlighting support to other languages. Assuming we keep using highlight.js the only way to accomplish that is to upgrade highlight.js and include more language. However each addition language will increase the size of the
highlight.js
file while most books only need support for a very limited number of languages and formats. (e.g. unlikely to have a book that has code snippets in rust, ruby, scala, and swift. Except thetest_book
of mdbook)Currently highlight.js is 137,537. If we download one that includes support for all the languages it will be 1,078,246 minified! We don't want every book to load that file.
Suggestion
My suggesting is that we generate a unique
highlight.js
file for every book that supports exactly the languages the book uses.This will allow us to support every language
highlight.js
supports and keep thehighlight.js
file small. Maybe even smaller than what we have now.Implementation
hl
.cp hl/highlight.min.js src/front-end/js/highlight.js
styles
folder (though we might be able to keep the one we already have)highlight.min.js
file and build a new file including only the core and the selected languages and save that ashighlight.js
.The text was updated successfully, but these errors were encountered: