mdbook-uplot
An mdbook preprocessor for embedding interactive uPlot charts in your book.
Installation
Using cargo-binstall
If you have cargo-binstall already:
cargo binstall mdbook-uplot
Manually
Binary releases are available on the Releases page. Download the appropriate binary for your platform, make it executable, and add it to your PATH.
Setup
The install command updates book.toml (preprocessor config, additional-js/css) and writes asset files and CDN links to theme/head.hbs.
Usage
In your markdown, use a fenced code block with the uplot language tag.
Inline data
```uplot
{
"labels": ["a", "b", "c"],
"datasets": [
],
"axes": { "x": "Category", "y": "Value" }
}
```
External data file
```uplot
{ "data": "path/to/data.json" }
```
Paths are resolved relative to the chapter's source directory.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
Licensed under either of
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.