From 0ab850798711a273dff04645fa749bba0a7232ec Mon Sep 17 00:00:00 2001 From: Gerard Braad Date: Tue, 3 Dec 2024 12:31:08 +0000 Subject: [PATCH] Update mdbook and add kroki --- .devcontainer/Containerfile | 2 +- .github/workflows/gh-pages.yaml | 2 +- README.md | 2 +- book.toml | 4 +++- containers/Containerfile | 8 ++++++-- containers/README.md | 17 +++++++++++------ 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.devcontainer/Containerfile b/.devcontainer/Containerfile index 7fca5e3..fb429ee 100644 --- a/.devcontainer/Containerfile +++ b/.devcontainer/Containerfile @@ -1,4 +1,4 @@ -FROM quay.io/crc-org/mdbook:0.4.42 +FROM quay.io/crc-org/mdbook:0.4.43 RUN dnf install -y git-core \ && dnf clean all \ diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index d2e6a60..685b353 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -16,7 +16,7 @@ jobs: - name: Check out repository code uses: actions/checkout@v4 - name: Build docs - run: docker run --rm -v $PWD:/workspace quay.io/crc-org/mdbook:0.4.42 mdbook build + run: docker run --rm -v $PWD:/workspace quay.io/crc-org/mdbook:0.4.43 build - name: Deploy uses: peaceiris/actions-gh-pages@v4 if: github.ref == 'refs/heads/main' diff --git a/README.md b/README.md index f0ae2fe..47c9cb6 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ For example, it is easy to use `.` to start the GitHub Web Editor to read and ed To create the HTML output, you can use: ``` -$ podman run --rm -v $PWD:/workspace quay.io/crc-org/mdbook:0.4.42 mdbook build +$ podman run --rm -v $PWD:/workspace quay.io/crc-org/mdbook:0.4.43 build ``` This will create a `book` folder that contains the output for a static webpage like GitHub Pages. diff --git a/book.toml b/book.toml index 273de6a..524362c 100644 --- a/book.toml +++ b/book.toml @@ -9,4 +9,6 @@ title = "CRC Engineering docs" default-theme = "light" preferred-dark-theme = "light" -[preprocessor.callouts] \ No newline at end of file +[preprocessor.callouts] + +[preprocessor.kroki] diff --git a/containers/Containerfile b/containers/Containerfile index 51306cb..d6cf5f9 100644 --- a/containers/Containerfile +++ b/containers/Containerfile @@ -1,10 +1,11 @@ FROM registry.fedoraproject.org/fedora:40 AS builder -RUN dnf install -y cargo \ +RUN dnf install -y cargo openssl-devel \ && cargo install mdbook \ && cargo install mdbook-callouts \ - && cargo install mdbook-mermaid + && cargo install mdbook-mermaid \ + && cargo install mdbook-kroki-preprocessor FROM registry.fedoraproject.org/fedora:40 @@ -12,7 +13,10 @@ FROM registry.fedoraproject.org/fedora:40 COPY --from=builder /root/.cargo/bin/mdbook /usr/bin COPY --from=builder /root/.cargo/bin/mdbook-callouts /usr/bin COPY --from=builder /root/.cargo/bin/mdbook-mermaid /usr/bin +COPY --from=builder /root/.cargo/bin/mdbook-kroki-preprocessor /usr/bin/mdbook-kroki RUN mkdir -p /workspace VOLUME /workspace WORKDIR /workspace + +ENTRYPOINT ["/usr/bin/mdbook"] diff --git a/containers/README.md b/containers/README.md index b075eda..df67971 100644 --- a/containers/README.md +++ b/containers/README.md @@ -6,8 +6,13 @@ This Fedora container image contains: - mdBook: https://github.com/rust-lang/mdBook create book from markdown files, like Gitbook - - mdBook preprocessor: https://crates.io/crates/mdbook-callouts - to add Obsidian Flavored Markdown's Callouts + - mdBook preprocessors: + - https://crates.io/crates/mdbook-callouts + to add Obsidian Flavored Markdown's Callouts + - https://github.com/badboy/mdbook-mermaid + to add mermaid support + - https://github.com/JoelCourtney/mdbook-kroki-preprocessor + to render Kroki diagrams from files or code blocks ## Usage instructions @@ -15,8 +20,8 @@ Start the container in the folder that contains your documentation source ```bash $ podman run --rm -v $PWD:/workspace \ - quay.io/crc-org/mdbook:0.4.42 \ - mdbook build + quay.io/crc-org/mdbook:0.4.43 \ + build ``` This will generate a `book` output. @@ -25,8 +30,8 @@ Or using ```bash $ podman run --rm -v $PWD:/workspace -p 3000:3000 \ - quay.io/crc-org/mdbook:0.4.42 \ - mdbook serve + quay.io/crc-org/mdbook:0.4.43 \ + serve ``` the generated content will be published using the embedded server on [`http://localhost:3000`](http://localhost:3000)