Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build script to render katex and add favicon #121

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions doc/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
set -e

curl -fSL -o mdbook.tar.gz https://github.com/rust-lang/mdBook/releases/download/v0.4.33/mdbook-v0.4.33-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook.tar.gz

curl -fSL -o mdbook-katex.tar.gz https://github.com/lzanini/mdbook-katex/releases/download/v0.8.0/mdbook-katex-v0.8.0-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook-katex.tar.gz

curl -fSL -o mdbook-mermaid.tar.gz https://github.com/badboy/mdbook-mermaid/releases/download/v0.14.0/mdbook-mermaid-v0.14.0-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook-mermaid.tar.gz
Comment on lines +4 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing downloaded archive files after extraction

After extracting the tar.gz files, the archives remain in the directory. Removing them can keep the workspace clean and prevent unnecessary clutter.

Update the script to remove the archives after extraction:

 tar -xzf mdbook.tar.gz
+rm mdbook.tar.gz

 tar -xzf mdbook-katex.tar.gz
+rm mdbook-katex.tar.gz

 tar -xzf mdbook-mermaid.tar.gz
+rm mdbook-mermaid.tar.gz
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
curl -fSL -o mdbook.tar.gz https://github.com/rust-lang/mdBook/releases/download/v0.4.33/mdbook-v0.4.33-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook.tar.gz
curl -fSL -o mdbook-katex.tar.gz https://github.com/lzanini/mdbook-katex/releases/download/v0.8.0/mdbook-katex-v0.8.0-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook-katex.tar.gz
curl -fSL -o mdbook-mermaid.tar.gz https://github.com/badboy/mdbook-mermaid/releases/download/v0.14.0/mdbook-mermaid-v0.14.0-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook-mermaid.tar.gz
curl -fSL -o mdbook.tar.gz https://github.com/rust-lang/mdBook/releases/download/v0.4.33/mdbook-v0.4.33-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook.tar.gz
rm mdbook.tar.gz
curl -fSL -o mdbook-katex.tar.gz https://github.com/lzanini/mdbook-katex/releases/download/v0.8.0/mdbook-katex-v0.8.0-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook-katex.tar.gz
rm mdbook-katex.tar.gz
curl -fSL -o mdbook-mermaid.tar.gz https://github.com/badboy/mdbook-mermaid/releases/download/v0.14.0/mdbook-mermaid-v0.14.0-x86_64-unknown-linux-musl.tar.gz
tar -xzf mdbook-mermaid.tar.gz
rm mdbook-mermaid.tar.gz


chmod +x mdbook mdbook-katex mdbook-mermaid

export PATH=$(pwd):$PATH
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote variable expansions to prevent word splitting and globbing

In the export command on line 15, the variable expansions $(pwd) and $PATH are not quoted. This can lead to word splitting or globbing issues if any directories contain spaces or special characters.

Apply the following diff to fix this:

-export PATH=$(pwd):$PATH
+PATH="$(pwd):$PATH"
+export PATH
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export PATH=$(pwd):$PATH
PATH="$(pwd):$PATH"
export PATH
Tools
Shellcheck

[warning] 15-15: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 15-15: Quote this to prevent word splitting.

(SC2046)


[info] 15-15: Double quote to prevent globbing and word splitting.

(SC2086)


export MDBOOK_PLUGIN_DIR=$(pwd)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote variable expansion to prevent word splitting and globbing

In the export command on line 17, the variable expansion $(pwd) is not quoted. This can lead to word splitting or globbing issues if the directory path contains spaces or special characters.

Apply the following diff to fix this:

-export MDBOOK_PLUGIN_DIR=$(pwd)
+MDBOOK_PLUGIN_DIR="$(pwd)"
+export MDBOOK_PLUGIN_DIR
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export MDBOOK_PLUGIN_DIR=$(pwd)
MDBOOK_PLUGIN_DIR="$(pwd)"
export MDBOOK_PLUGIN_DIR
Tools
Shellcheck

[warning] 17-17: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 17-17: Quote this to prevent word splitting.

(SC2046)


./mdbook build
Binary file added doc/theme/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.