# mdbook-typst-math
An mdbook preprocessor to use [typst](https://typst.app/) to render math.
## Installation
```shell
cargo install --git https://github.com/duskmoon314/mdbook-typst-math
# OR
git clone https://github.com/duskmoon314/mdbook-typst-math.git
cargo build --release
```
## Usage
### Setup preprocessor
Add the following to your `book.toml`:
```toml
[preprocessor.typst-math]
command = "/path/to/mdbook-typst-math"
```
The path is usually `~/.cargo/bin/mdbook-typst-math` if you installed it using `cargo`.
Other configurations see the following section: [Configuration](#configuration).
### Control the style
Add css to control the style of the typst block:
```css
/* css/typst.css as an example */
.typst-inline {
display: inline flex;
vertical-align: bottom;
}
.typst-display {
display: block flex;
justify-content: center;
}
.typst-display > .typst-doc {
transform: scale(1.5);
}
```
Add the following to your `book.toml`:
```toml
[output.html]
additional-css = ["css/typst.css"]
```
### What this preprocessor does
This preprocessor will convert all math blocks to a `
` with the class
`typst-inline`/`typst-display` (depends on the type of math blocks) and a
`