A preprocessor and cli tool for mdbook to show chart use C3.js.
bash
cargo install mdbook-chart
```bash
[book] authors = [] language = "en" multilingual = false src = "src"
[build] create-missing = false
[preprocessor.chart]
[output.html] additional-js = ["d3.min.js", "c3.min.js"] additional-css = ["c3.min.css"]
[output.html.fold] enable = true level = 0
```
````text
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
bash
mdbook serve
Or
bash
mdbook build
this will do something to make sure your chart show as you wish.