Skip to content

Commit e764363

Browse files
nikomatsakistshepang
authored andcommitted
add mdbook-mermaid
1 parent ade9352 commit e764363

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

.github/workflows/ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
env:
1717
MDBOOK_VERSION: 0.4.12
1818
MDBOOK_LINKCHECK_VERSION: 0.7.2
19+
MDBOOK_MERMAID_VERSION: 0.10.0
1920
MDBOOK_TOC_VERSION: 0.6.1
2021
DEPLOY_DIR: book/html
2122
BASE_SHA: ${{ github.event.pull_request.base.sha }}
@@ -31,7 +32,7 @@ jobs:
3132
with:
3233
path: |
3334
~/.cargo/bin
34-
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}
35+
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
3536

3637
- name: Cache linkcheck
3738
uses: actions/cache@v2
@@ -59,6 +60,7 @@ jobs:
5960
cargo install mdbook --version ${{ env.MDBOOK_VERSION }}
6061
cargo install mdbook-linkcheck --version ${{ env.MDBOOK_LINKCHECK_VERSION }}
6162
cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
63+
cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
6264
6365
- name: Check build
6466
run: mdbook build

book.toml

+4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ create-missing = false
1010
command = "mdbook-toc"
1111
renderer = ["html"]
1212

13+
[preprocessor.mermaid]
14+
command = "mdbook-mermaid"
15+
1316
[output.html]
1417
git-repository-url = "https://github.com/rust-lang/rustc-dev-guide"
1518
edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/tree/master/{path}?mode=edit"
19+
additional-js = ["mermaid.min.js", "mermaid-init.js"]
1620

1721
[output.html.fold]
1822
enable = true

mermaid-init.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mermaid.initialize({startOnLoad:true});

mermaid.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)