Repository navigation
Vendor highlight.js in built-in themes (no more CDN) - #75
Merged
Merged
Conversation
Bundle the highlight.js 11.8.0 static assets locally in the mkdocs and readthedocs themes instead of loading them from the cdnjs CDN, so syntax highlighting works in offline, intranet and privacy-sensitive builds. The vendored files mirror the CDN distribution layout (core library, languages/ and styles/), so the hljs_style, hljs_style_dark and hljs_languages theme options keep working unchanged, including base16 styles. A LICENSE and upgrade README are included with the vendored files.
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bundle highlight.js 11.8.0 static assets locally in the built-in
mkdocsandreadthedocsthemes instead of loading them fromcdnjs.cloudflare.com.This makes the built-in themes fully usable in offline / intranet / privacy-sensitive environments (upstream issues mkdocs#2171, mkdocs#3630). Google Analytics removal is a follow-up PR.
What changed
highlight/(mirrors the official CDN layout):highlight.min.js(core, 23 common languages)languages/*.min.js— all 192 language packsstyles/*.min.css+styles/base16/*.min.css— all 250 stylesLICENSE(BSD-3-Clause) and an upgrade-provenanceREADME.mdbase.htmltemplates to reference the local files via theurlfilter. Thehljs_style,hljs_style_dark,hljs_languagestheme options keep working unchanged (including base16 styles likebase16/apathy), and the#hljs-light/#hljs-darkids used bydarkmode.jsare preserved.highlight/dirs from the jshint pre-commit hook (minified third-party files).choosing-your-theme.md.Verification
uvx prek run -apasseshljs_style/hljs_style_dark/hljs_languages(incl. base16) — all assets resolve locallylanguages/rust.min.jsregisters, highlighting produces expected outputuv buildwheel contains all 890 vendored filesNotes
Vendored files are copied to the output site (~2.5 MB, matching the repo's existing convention of shipping full static asset sets in themes).