Catppuccin for mdBook
View on GitHubInstallation
It is important to know that there are 2 ways to install this theme:
-
Install
mdbook-catppuccin
using Cargo (It comes installed with Rust by default!)- Binaries are also available if that's more your style! You can always find the latest releases here!
-
Transfer files to your mdBook from this GitHub manually
Rust (Preferred)
-
Install
mdbook-catppuccin
by runningcargo install mdbook-catppuccin
-
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!
Manual
-
Navigate to
src/bin/assets
within this repository -
Download all assets:
index.hbs
,catppuccin.css
andcatppuccin-highlight.css
-
Transfer downloaded assets to your mdBook theme directory (the default directory would be
theme/
from the mdBook root if not already specified within thebook.toml
) -
Update
additional-css
key within thebook.toml
as shown below[output.html] -additional-css = [] +additional-css = ["./theme/catppuccin.css", "./theme/catppuccin-highlight.css"]
-
Build your mdBook using
mdbook build
and enjoy your new catppuccin flavours!
FAQ
How Can I Remove The Default mdBook Themes?
Navigate to index.hbs (L125 - L132)
and remove each theme that you do not want appearing on the mdBook
For example, to remove all the default themes:
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
- <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>
</ul>
Running mdbook build
again should get rid of the themes appearing in the theme picker, enjoy!
What's The Point Of This mdBook Preprocessor If I Can Just Install Everything Manually?
Arguably, it's actually better to transfer over the assets individually as you won't have to install this mdBook preprocessor. However, the assets will NOT be managed for you. You are in charge of upgrading/modifying the assets as you see fit. The preferred method of installation is through Rust as the pre-processor will be able to detect differences in versions of assets.
Acknowledgement
Inspiration for the install
command came from mdbook-admonish which is another great mdBook pre-processor!
💝 Thanks to