Skip to content

Commit

Permalink
Add mdbook-graphviz plugin.
Browse files Browse the repository at this point in the history
TODO: Needs update mdslides release that understands these new graphviz diagrams.
  • Loading branch information
jonathanpallant committed Nov 15, 2024
1 parent 0101895 commit 054a30d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install tools
uses: taiki-e/install-action@v2
with:
tool: mdbook@0.4.36,mdbook-mermaid@0.13.0
tool: mdbook@0.4.42,mdbook-graphviz@0.2.1

- name: Add mdslides
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
html
mdbook
mdbook-mermaid
mdbook-graphviz
mdslides
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ This slide deck is an [`mdbook`](https://crates.io/crates/mdbook) that is also c
To build as a book, run `mdbook` in the usual fashion:

```console
$ apt install graphviz
$ cargo install mdbook
$ cargo install mdbook-mermaid
$ cargo install mdbook-graphviz
$ cd ./training-slides
$ mdbook build
2023-05-03 13:24:46 [INFO] (mdbook::book): Book building has started
Expand All @@ -55,6 +56,7 @@ mdbook test
To convert the book to slides, run `mdslides` like this:

```console
$ apt install graphviz
$ cargo install mdslides
$ cd ./training-slides
$ mdslides --template ./template.html --output-dir ./slides --mdbook-path . --index-template ./index-template.html
Expand Down
7 changes: 4 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ set -euo pipefail
# We only support macOS (the x86 binaries work OK on Apple Silicon), or x86-64 Linux
if [ $(uname) == "Darwin" ]; then
./mdbook --version || curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-apple-darwin.tar.gz | tar -xvzf -
./mdbook-mermaid --version || curl -sSL https://github.com/badboy/mdbook-mermaid/releases/download/v0.13.0/mdbook-mermaid-v0.13.0-x86_64-apple-darwin.tar.gz | tar -xvzf -
mdbook-graphviz --version || cargo install mdbook-graphviz
./mdslides --version || ( curl -sSL https://github.com/ferrous-systems/mdslides/releases/download/v0.4.0/mdslides-x86_64-apple-darwin.tar.xz | tar -xvJf - \
&& mv ./mdslides-*/mdslides . \
&& rm -rf ./mdslides-*/ )
else
./mdbook --version || curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xvzf -
./mdbook-mermaid --version || curl -sSL https://github.com/badboy/mdbook-mermaid/releases/download/v0.13.0/mdbook-mermaid-v0.13.0-x86_64-unknown-linux-gnu.tar.gz | tar -xvzf -
./mdbook-graphviz --version || ( curl -sSL https://github.com/dylanowen/mdbook-graphviz/releases/download/v0.2.1/mdbook-graphviz_v0.2.1_x86_64-unknown-linux-musl.zip | tar -xvzf - \
&& chmod a+x ./mdbook-graphviz )
./mdslides --version || ( curl -sSL https://github.com/ferrous-systems/mdslides/releases/download/v0.4.0/mdslides-x86_64-unknown-linux-gnu.tar.xz | tar -xvJf - \
&& mv ./mdslides-*/mdslides . \
&& rm -rf ./mdslides-*/ )
Expand All @@ -37,7 +38,7 @@ cp ./_redirects "${OUTPUT_DIR}/_redirects"
function build_and_store {
mkdir -p "${OUTPUT_DIR}/$1"
# Build the book first, because mdbook will create any empty sections
# The PATH override lets it find our local copy of mdbook-mermaid
# The PATH override lets it find our local copy of mdbook-graphviz
PATH=$PATH:. ./mdbook build -d "${OUTPUT_DIR}/$1/book" ./training-slides
# Then build the slides
RUST_LOG=info ./mdslides --template ./training-slides/template.html \
Expand Down
4 changes: 2 additions & 2 deletions training-slides/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ multilingual = false
src = "src"
title = "Rust Training Slides by Ferrous Systems"

[preprocessor.mermaid]
command = "mdbook-mermaid"
[preprocessor.graphviz]
command = "mdbook-graphviz"

[output.html.playground]
copyable = true # include the copy button for copying code snippets

0 comments on commit 054a30d

Please sign in to comment.