Crates.io | mdbook-chart |
lib.rs | mdbook-chart |
version | 0.1.2 |
source | src |
created_at | 2021-01-30 10:42:11.420838 |
updated_at | 2021-12-09 08:25:55.544014 |
description | A preprocessor and cli tool for mdbook to show chart use C3.js. |
homepage | https://crates.io/crates/mdbook-chart |
repository | https://github.com/knightflower1989/mdbook-chart |
max_upload_size | |
id | 348417 |
size | 70,751 |
A preprocessor and cli tool for mdbook to show chart use C3.js.
cargo install mdbook-chart
#cat /path/to/your/mdbook/book.toml
[book]
authors = []
language = "en"
multilingual = false
src = "src"
[build]
create-missing = false
#use as mdbook preprocessor
[preprocessor.chart]
[output.html]
additional-js = ["assets/d3/d3.min.js", "assets/c3/c3.min.js"]
additional-css = ["assets/c3/c3.min.css"]
[output.html.fold]
enable = true
level = 0
```chart
{
"data": {
"type": "bar",
"columns": [
["data1", 30, 200, 100, 400, 150, 250],
["data2", 50, 20, 10, 40, 15, 25]
],
"axes": {
"data2": "y2"
}
},
"axis": {
"y2": {
"show": true
}
}
}
```
or
{% chart %}
{
"data": {
"type": "foo",
"columns": [
["data1", 30, 200, 100, 400, 150, 250],
["data2", 50, 20, 10, 40, 15, 25]
],
"axes": {
"data2": "y2"
}
},
"axis": {
"y2": {
"show": true
}
}
}
{% endchart %}
When you run
mdbook serve
Or
mdbook build
this will do something to make sure your chart show as you wish.