Crates.io | mdbook-nix-eval |
lib.rs | mdbook-nix-eval |
version | 1.0.1 |
source | src |
created_at | 2021-03-05 08:54:28.026295 |
updated_at | 2021-03-06 06:45:41.144082 |
description | A simple mdbook preprocessor for evaluating nix expressions |
homepage | https://jasonrm.github.io/mdbook-nix-eval/ |
repository | https://github.com/jasonrm/mdbook-nix-eval |
max_upload_size | |
id | 364256 |
size | 80,306 |
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
```
If you want to use only this preprocessor, install the tool:
cargo install mdbook-nix-eval
Add it as a preprocessor to your book.toml
:
[preprocessor.nix-eval]
command = "mdbook-nix-eval"
renderer = ["html"]
#eval_args = "--timeout 5"
Finally, build your book as normal:
mdbook path/to/book
error: cannot convert a thunk to JSON
are much more common.mdbook serve
as each block does call out to nix.MPL. See LICENSE. Copyright (c) 2021 Jason R. McNeil jason@mcneil.dev