add mdbook-mermaid

This commit is contained in:
Niko Matsakis 2022-02-07 17:06:06 -05:00 committed by Tshepang Mbambo
parent 061577567f
commit f3cac7c8fc
4 changed files with 12 additions and 1 deletions

View File

@ -16,6 +16,7 @@ jobs:
env:
MDBOOK_VERSION: 0.4.12
MDBOOK_LINKCHECK_VERSION: 0.7.2
MDBOOK_MERMAID_VERSION: 0.10.0
MDBOOK_TOC_VERSION: 0.6.1
DEPLOY_DIR: book/html
BASE_SHA: ${{ github.event.pull_request.base.sha }}
@ -31,7 +32,7 @@ jobs:
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
- name: Cache linkcheck
uses: actions/cache@v2
@ -59,6 +60,7 @@ jobs:
cargo install mdbook --version ${{ env.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ env.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
- name: Check build
run: mdbook build

View File

@ -10,9 +10,13 @@ create-missing = false
command = "mdbook-toc"
renderer = ["html"]
[preprocessor.mermaid]
command = "mdbook-mermaid"
[output.html]
git-repository-url = "https://github.com/rust-lang/rustc-dev-guide"
edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/tree/master/{path}?mode=edit"
additional-js = ["mermaid.min.js", "mermaid-init.js"]
[output.html.fold]
enable = true

1
mermaid-init.js Normal file
View File

@ -0,0 +1 @@
mermaid.initialize({startOnLoad:true});

4
mermaid.min.js vendored Normal file

File diff suppressed because one or more lines are too long