Skip to content

Commit

Permalink
Merge pull request #11 from crc-org/update-mdbook
Browse files Browse the repository at this point in the history
Update mdbook and add kroki
  • Loading branch information
gbraad authored Dec 4, 2024
2 parents f73a0aa + 0ab8507 commit 36217dd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Containerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 3 additions & 1 deletion book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ title = "CRC Engineering docs"
default-theme = "light"
preferred-dark-theme = "light"

[preprocessor.callouts]
[preprocessor.callouts]

[preprocessor.kroki]
8 changes: 6 additions & 2 deletions containers/Containerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
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

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"]
17 changes: 11 additions & 6 deletions containers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ 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
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.
Expand All @@ -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)

0 comments on commit 36217dd

Please sign in to comment.