From 2b9d10dd8eb94e5c55d12698fb4b1acf7a7c6352 Mon Sep 17 00:00:00 2001 From: Dave Tang Date: Tue, 23 Jun 2026 16:06:56 +0900 Subject: Fix code highlighting --- scripts/setup.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'scripts') diff --git a/scripts/setup.sh b/scripts/setup.sh index a404eae..d77d23e 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -6,7 +6,7 @@ # bash setup-docsify.sh # # Downloads Docsify core, the search plugin, the Vue theme, the copy-to-clipboard -# plugin, and Prism syntax highlighting (bash, yaml, javascript, python, r) — all +# plugin, and extra Prism languages (bash, yaml, python, r) — all # served locally, no external CDN dependencies at runtime. # # Re-running in an existing site is safe: it refreshes the assets and regenerates @@ -82,15 +82,14 @@ fetch "${CDN}/docsify@${DOCSIFY_VERSION}/themes/vue.css" assets/css/ # Copy-to-clipboard plugin (injects its own CSS — no separate stylesheet needed) fetch "${CDN}/docsify-copy-code@3/dist/docsify-copy-code.min.js" assets/js/docsify-copy-code.min.js -# Prism syntax highlighting: core engine, then clike (required by javascript), -# then the individual languages. -fetch "${CDN}/prismjs@1/components/prism-core.min.js" assets/js/prism-core.min.js -fetch "${CDN}/prismjs@1/components/prism-clike.min.js" assets/js/prism-clike.min.js -fetch "${CDN}/prismjs@1/components/prism-javascript.min.js" assets/js/prism-javascript.min.js -fetch "${CDN}/prismjs@1/components/prism-bash.min.js" assets/js/prism-bash.min.js -fetch "${CDN}/prismjs@1/components/prism-yaml.min.js" assets/js/prism-yaml.min.js -fetch "${CDN}/prismjs@1/components/prism-python.min.js" assets/js/prism-python.min.js -fetch "${CDN}/prismjs@1/components/prism-r.min.js" assets/js/prism-r.min.js +# Extra Prism languages. Docsify already bundles Prism core plus html/css/clike/ +# javascript, so we only add the languages it does NOT ship. Never download +# prism-core here — a standalone core replaces Docsify's Prism and silently breaks +# highlighting for every language loaded after it. +fetch "${CDN}/prismjs@1/components/prism-bash.min.js" assets/js/prism-bash.min.js +fetch "${CDN}/prismjs@1/components/prism-yaml.min.js" assets/js/prism-yaml.min.js +fetch "${CDN}/prismjs@1/components/prism-python.min.js" assets/js/prism-python.min.js +fetch "${CDN}/prismjs@1/components/prism-r.min.js" assets/js/prism-r.min.js # ── Step 3: index.html ────────────────────────────────────────────────────────── step "Step 3 — Creating index.html" @@ -121,10 +120,7 @@ cat > index.html << 'HTML' - - - - + @@ -200,7 +196,7 @@ echo "" echo -e "${GREEN}${BOLD}Setup complete.${NC}" echo -e "Open your site in a browser to verify." echo "" -echo -e "Syntax highlighting (Prism) is enabled for: bash, yaml, javascript, python, r." -echo -e "To add more languages, download additional prism-*.min.js files into" -echo -e "assets/js/ and add their