From 3b36213ea3cc221d00b06f9340c8fac9e45ecf5c Mon Sep 17 00:00:00 2001 From: Dave Tang Date: Tue, 23 Jun 2026 17:18:06 +0900 Subject: Add additional features --- README.md | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 153 insertions(+), 16 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index b459256..3d1b0e4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ The final layout this guide produces, relative to your document root: ├── _sidebar.md ← Sidebar navigation ├── getting-started.md ← Example page └── assets/ + ├── SHA256SUMS ← SHA-256 of every downloaded asset ├── js/ │ ├── docsify.min.js │ ├── search.min.js @@ -30,10 +31,19 @@ The final layout this guide produces, relative to your document root: │ ├── prism-bash.min.js │ ├── prism-yaml.min.js │ ├── prism-python.min.js - │ └── prism-r.min.js + │ ├── prism-r.min.js + │ ├── docsify-plugin-flexible-alerts.min.js + │ ├── docsify-tabs.min.js + │ ├── docsify-pagination.min.js + │ ├── medium-zoom.min.js + │ ├── docsify-sidebar-collapse.min.js + │ ├── mermaid.min.js + │ └── docsify-mermaid.js └── css/ ├── vue.css ├── katex.min.css + ├── medium-zoom.css + ├── sidebar.min.css └── fonts/ └── KaTeX_*.woff2 (20 KaTeX font files) ``` @@ -53,19 +63,19 @@ mkdir -p assets/css ## Step 2: Download Docsify Assets -All files are downloaded from jsDelivr once and served locally thereafter. See all [docsify CDN files](https://cdn.jsdelivr.net/npm/docsify@4/lib/) on jsDelivr. +All files are downloaded from jsDelivr once and served locally thereafter. See all [docsify CDN files](https://cdn.jsdelivr.net/npm/docsify@4.13.1/lib/) on jsDelivr. ```bash # Docsify core -curl -L "https://cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js" \ +curl -L "https://cdn.jsdelivr.net/npm/docsify@4.13.1/lib/docsify.min.js" \ -o assets/js/docsify.min.js # Search plugin -curl -L "https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js" \ +curl -L "https://cdn.jsdelivr.net/npm/docsify@4.13.1/lib/plugins/search.min.js" \ -o assets/js/search.min.js # Theme (Vue — clean, light) -curl -L "https://cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" \ +curl -L "https://cdn.jsdelivr.net/npm/docsify@4.13.1/themes/vue.css" \ -o assets/css/vue.css ``` @@ -93,21 +103,21 @@ Docsify's bundled Prism. This guide adds bash, yaml, python, and r: ```bash -curl -L "https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js" \ +curl -L "https://cdn.jsdelivr.net/npm/prismjs@1.30.0/components/prism-bash.min.js" \ -o assets/js/prism-bash.min.js -curl -L "https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-yaml.min.js" \ +curl -L "https://cdn.jsdelivr.net/npm/prismjs@1.30.0/components/prism-yaml.min.js" \ -o assets/js/prism-yaml.min.js -curl -L "https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-python.min.js" \ +curl -L "https://cdn.jsdelivr.net/npm/prismjs@1.30.0/components/prism-python.min.js" \ -o assets/js/prism-python.min.js -curl -L "https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-r.min.js" \ +curl -L "https://cdn.jsdelivr.net/npm/prismjs@1.30.0/components/prism-r.min.js" \ -o assets/js/prism-r.min.js ``` To highlight more languages, download additional `prism-.min.js` files (browse the -[Prism components](https://cdn.jsdelivr.net/npm/prismjs@1/components/)) and add a matching +[Prism components](https://cdn.jsdelivr.net/npm/prismjs@1.30.0/components/)) and add a matching ` @@ -204,6 +294,18 @@ Create `index.html`: + + + + + + + + + + + + ``` @@ -303,13 +405,23 @@ Expected output: ./README.md ./_sidebar.md ./assets +./assets/SHA256SUMS ./assets/css ./assets/css/katex.min.css +./assets/css/medium-zoom.css +./assets/css/sidebar.min.css ./assets/css/vue.css ./assets/js ./assets/js/docsify-copy-code.min.js ./assets/js/docsify-katex.js +./assets/js/docsify-mermaid.js +./assets/js/docsify-pagination.min.js +./assets/js/docsify-plugin-flexible-alerts.min.js +./assets/js/docsify-sidebar-collapse.min.js +./assets/js/docsify-tabs.min.js ./assets/js/docsify.min.js +./assets/js/medium-zoom.min.js +./assets/js/mermaid.min.js ./assets/js/prism-bash.min.js ./assets/js/prism-python.min.js ./assets/js/prism-r.min.js @@ -350,6 +462,29 @@ For subdirectories, nest entries with indentation: --- +## Reproducibility & Resilience + +Self-hosting protects your **live** site if jsDelivr ever disappears. To also protect your +ability to **rebuild** it, do two things: + +1. **Pin and vendor.** Every asset version is pinned, and the downloaded files are plain + static assets. Commit the entire `assets/` directory to your repository. You can then + redeploy — or rebuild on a fresh machine with no network access — without depending on + jsDelivr at all. + +2. **Verify integrity.** `scripts/setup.sh` writes `assets/SHA256SUMS`, a SHA-256 checksum + of every downloaded file. Commit it alongside `assets/`, then check the assets at any + time (after a server move, or to detect corruption or tampering): + + ```bash + (cd assets && sha256sum -c SHA256SUMS) + ``` + + Every file should report `OK`. After re-running `setup.sh` to upgrade, `git diff` on + `SHA256SUMS` shows exactly which assets changed. + +--- + ## Upgrading Docsify Since files are self-hosted, upgrades are manual. Re-run the `curl` commands from @@ -367,10 +502,12 @@ curl -L "https://cdn.jsdelivr.net/npm/docsify@4.13.1/themes/vue.css" \ -o assets/css/vue.css ``` -The Prism components (`prismjs@1`), the copy-code plugin (`docsify-copy-code@3`), and the -math plugin (`docsify-katex@1.4.4` with `katex@0.11.1`) are versioned independently of -Docsify; re-run their Step 2 commands the same way when you want to update them. If you -bump KaTeX, re-download the stylesheet **and** its fonts together so they stay in sync. +Every asset version is pinned — in the Step 2 commands above and in the variables at the +top of `scripts/setup.sh`. The Prism components, copy-code, Mermaid, the UX plugins, and +the math plugin (`docsify-katex@1.4.4` with a matching `katex` stylesheet **and** fonts) +are versioned independently of Docsify, so upgrade each by changing its version number and +re-downloading. Afterwards regenerate `assets/SHA256SUMS` — re-running `scripts/setup.sh` +does this — and re-verify. Check the [Docsify releases page](https://github.com/docsifyjs/docsify/releases) for the latest version number before upgrading. -- cgit v1.3.1