Skip to content

phoenixr-codes/mdbook-whichlang

Repository files navigation

whichlang - Powerful Code Blocks for mdBook

Dark Theme Preview Light Theme Preview

  • 🎨 Optimized for every theme.
  • 🔥 Zero-Setup installation: Download the standalone files from the repository's releases section or download them via command-line.
  • 🔧 Highly configurable.

Installation

In the directory of your book, install whichlang with the following command.

wget https://github.com/phoenixr-codes/mdbook-whichlang/releases/latest/download/whichlang.js &&
wget https://github.com/phoenixr-codes/mdbook-whichlang/releases/latest/download/whichlang.css

Don't forget to add these files in your book.toml:

# ...

[output.html]
additional-css = ["path/to/whichlang.css"]
additional-js = ["path/to/whichlang.js"]

Uninstallation

Simply remove the whichlang.js and whichlang.css files and remove the references to them in the book.toml configuration file.

Usage

whichlang works out of the box. It detects the language defined on each code block and customizes them appropiately. You can furthermore configure them individually:

  • override the name of the language
  • override the icon of the language
  • set a file path shown in the code block

You can see examples and more precise explanations in the documentation.

Building

Tip

Building whichlang yourself allows you to change configurations by editing config.ts.

deno run --allow-all bundle.ts

Contributing

See Contributing.