0.0.2 • Published 4 years ago
@code-blocks/rehype-charts v0.0.2
@code-blocks/rehype-charts
A rehype transformer to add svg charts from code-blocks
Usage
try.js
const unified = require('unified')
const stream = require('unified-stream')
const markdown = require('remark-parse')
const remark2rehype = require('remark-rehype')
const html = require('rehype-stringify')
const charts = require('./index')
var processor = unified()
.use(markdown)
.use(remark2rehype)
.use(charts)
.use(html)
process.stdin.pipe(stream(processor)).pipe(process.stdout)
And run with:
node try < example.md > example.html
In your markdown, use codeblocks with one of the following languages:
area-chart
bar-chart
line-chart
multiline-chart
pie-chart
vega-lite
vega
vegalite
vega
and vegalite
are json objects.
The others are csv
with options set as front-matter.
See the examples markdown and how they are rendered.