Mdbook Embed Preprocessor

This is a mdbook preprocessor plugin that allows you embed apps to your book. If you find any problems while using it or have any other suggestions, welcmoe to open an issue.

1. Installation

First, you need to install mdbook-embedify to your computer.You can install it from crates.io using cargo.

cargo install mdbook-embedify

After installation, add the following code to your book.toml file:

[preprocessor.embedify]

2. Usage

Then you can use embed macro to embed an app. The syntax is like this:

{% embed app options[] %}

options are key-value based array seperated by space and its value must be wrapped by quotes. For example:

{% embed codepen user="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %}

Below is the list of supported apps and their options(* means required):

App options
gist id*
youtube id*
bilibili id*
codesandbox id*, theme(dark)
stackblitz id*, theme(dark)
codepen user*, slug*, theme(dark), height(600)

3. Examples

Gist

{% embed gist id="76cf171d1bdd7da41d4ca96b908eb57a" %}

Youtube

{% embed youtube id="EngW7tLk6R8" %}

Bilibili

{% embed bilibili id="BV1uT4y1P7CX" danmaku="0" %}

Codesandbox

{% embed codesandbox id="ke8wx" theme="dark" %}

Stackblitz

{% embed stackblitz id="vitejs-vite-y8mdxg" theme="light" %}

Codepen

{% embed codepen user="MR-Addict" slug="NWBOqKw" height="600" theme="dark" %}