Catppuccin for mdBook
-
Install
mdbook-catppuccin
by runningcargo install mdbook-catppuccin
or download the latest release. -
Navigate to your mdBook's root directory (same location where the
book.toml
lives) and runmdbook-catppuccin install
-
Build your mdBook using
mdbook build
and enjoy your new catppuccin flavours!
-
Navigate to
src/bin/assets
within this repository -
Download all assets:
index.hbs
,catppuccin.css
andcatppuccin-admonish.css
[!NOTE] The
catppuccin-admonish.css
file is NOT required if you are not using the mdbook-admonish plugin. -
Transfer downloaded assets to your mdBook's theme directory (the default directory is
./theme
besidebook.toml
) -
Update
additional-css
key within thebook.toml
as shown below[output.html] -additional-css = [] +additional-css = ["./theme/catppuccin.css", "./theme/catppuccin-admonish.css"]
-
Build your mdBook using
mdbook build
and enjoy your new catppuccin flavours!
-
Clone the repository and navigate to the repository root.
git clone https://github.com/catppuccin/mdbook cd mdbook
-
Run the following command to generate the CSS files that will be packaged by the rust binary:
cd palette npm install npm run build
-
Build the rust binary using the following command:
Note that the Minimum Rust Version is 1.63.0
cargo build --release
-
Test the binary by installing the new assets on the
example
directory:cd example ../target/release/mdbook-catppuccin install mdbook serve
-
Q: "What's the point of the
mdbook-catppuccin
binary?"
A: Arguably, it's better to transfer over the files manually to avoid installing another tool. However, the assets will NOT be managed for you. It is also worth mentioning that the binary will be able to detect differences in versions of assets. -
Q: "What's the
catppuccin-admonish.css
file?"
A: It is a CSS file that is used to style the admonishments that are generated by mdbook-admonish. You can remove this file if you are not using this plugin.E.g.
[output.html] -additional-css = ["./theme/catppuccin.css", "./theme/catppuccin-admonish.css"] +additional-css = ["./theme/catppuccin.css"]
-
Q: "How can I remove the default themes?"
A: Navigate toindex.hbs (L125 - L133)
and remove the themes that you don't want. Remember to runmdbook build
again!E.g. To remove all default themes:
- <li role="none"><button role="menuitem" class="theme" id="light">{{ theme_option "Light" }}</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">{{ theme_option "Rust" }}</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">{{ theme_option "Coal" }}</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">{{ theme_option "Navy" }}</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">{{ theme_option "Ayu" }}</button></li> + <li role="none"><button role="menuitem" class="theme" id="latte">{{ theme_option "Latte" }}</button></li> + <li role="none"><button role="menuitem" class="theme" id="frappe">{{ theme_option "Frappรฉ" }}</button></li> + <li role="none"><button role="menuitem" class="theme" id="macchiato">{{ theme_option "Macchiato" }}</button></li> + <li role="none"><button role="menuitem" class="theme" id="mocha">{{ theme_option "Mocha" }}</button></li>
Inspiration for the install
command came from
mdbook-admonish which is
another great mdBook pre-processor!
ย
Copyright ยฉ 2021-present Catppuccin Org