mdbook-nix-eval

This is a mdbook preprocessor designed to evaluate code blocks containing nix expressions.

Code blocks with the nix language hint are evaluated and the original expression, and results (or stderr output), are returned to be included in the output document.

```nix
builtins.langVersion
```

Conde blocks with filename-like language hint will be evaluated as above, but also written to a per-chapter temp directory where the file can be referenced later.

```test-file.nix
builtins.langVersion
```

Installation

If you want to use only this preprocessor, install the tool:

sh cargo install mdbook-nix-eval

Add it as a preprocessor to your book.toml:

```toml [preprocessor.nix-eval] command = "mdbook-nix-eval" renderer = ["html"]

eval_args = "--timeout 5"

```

Finally, build your book as normal:

sh mdbook path/to/book

Warnings

License

MPL. See LICENSE. Copyright (c) 2021 Jason R. McNeil jason@mcneil.dev