10 releases (stable)

3.0.0 Sep 22, 2024
2.2.0 Aug 16, 2024
2.1.0 Nov 11, 2023
1.2.0 Oct 3, 2023
0.1.1 Aug 27, 2022

#108 in Text processing

Download history 33/week @ 2024-08-02 27/week @ 2024-08-09 243/week @ 2024-08-16 37/week @ 2024-08-23 20/week @ 2024-08-30 20/week @ 2024-09-06 41/week @ 2024-09-13 241/week @ 2024-09-20 70/week @ 2024-09-27 43/week @ 2024-10-04 37/week @ 2024-10-11 20/week @ 2024-10-18 10/week @ 2024-10-25 21/week @ 2024-11-01 16/week @ 2024-11-08 10/week @ 2024-11-15

59 downloads per month

MIT license

515KB

Logo
Catppuccin for mdBook

Previews

๐ŸŒป Latte
๐Ÿชด Frappรฉ
๐ŸŒบ Macchiato
๐ŸŒฟ Mocha

Usage

[!IMPORTANT]
The mdbook-catppuccin rust package has been deprecated. For further information on why this decision was made, please refer to catppuccin/mdBook#107

Please follow the instructions below to install the Catppuccin theme for mdBook.

  1. Initialise your mdBook with the theme files:

    mdbook init --theme <name>
    
  2. Enter the book directory and remove all theme files except index.hbs:

    cd <name>
    # Remove all files except index.hbs
    find ./theme -type f ! -name 'index.hbs' -delete
    # Remove the left over empty directories
    rm -d fonts css
    
  3. Download the following CSS assets from this repository to the theme directory:

  4. Update additional-css key within the book.toml as shown below

    [output.html]
    -additional-css = []
    +additional-css = ["./theme/catppuccin.css", "./theme/catppuccin-admonish.css"]
    
  5. Edit the index.hbs file to include the Catppuccin flavours:

    - <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
    - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
    - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
    - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
    - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
    + <li role="none"><button role="menuitem" class="theme" id="latte">Latte</button></li>
    + <li role="none"><button role="menuitem" class="theme" id="frappe">Frappรฉ</button></li>
    + <li role="none"><button role="menuitem" class="theme" id="macchiato">Macchiato</button></li>
    + <li role="none"><button role="menuitem" class="theme" id="mocha">Mocha</button></li>
    

    Additionally, you can use default-theme and preferred-dark-theme keys for setting default light/dark mode themes in your book.toml.

    E.g. To set the default theme to latte and default dark mode to mocha:

    [output.html]
    + default-theme = "latte"
    + preferred-dark-theme = "mocha"
    
  6. Build using mdbook build and enjoy your new catppuccin flavours!

Development

  1. Clone the repository and navigate to the repository root.

    git clone https://github.com/catppuccin/mdbook
    cd mdbook
    
  2. Generate the CSS files:

    cd palette
    npm install
    npm run build
    

๐Ÿ™‹ FAQ

  • 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"]
    

Acknowledgement

mdbook-admonish for inspiration on the install command for the now deprecated mdbook-catppuccin binary.

๐Ÿ’ Thanks to

 

Copyright ยฉ 2021-present Catppuccin Org

Dependencies

~4โ€“5.5MB
~88K SLoC