23 releases
0.8.6 | Jan 3, 2024 |
---|---|
0.8.5 | Aug 28, 2023 |
0.8.4 | Feb 21, 2023 |
0.8.2 | Jun 1, 2022 |
0.1.0 | Aug 14, 2015 |
#2105 in Parser implementations
71 downloads per month
Used in 5 crates
18KB
386 lines
This crate allows you to implement filters for pandoc.
The easiest way is to them in conjunction with the pandoc
crate.
You can also create a binary that reads from stdin and writes to stdout and
pass that to a normal pandoc call with --filter
Instructions
fn main() {
let mut pandoc = pandoc::new();
...
pandoc.add_filter(|json| pandoc_ast::filter(json, |mut pandoc| {
for block in &mut pandoc.1 {
use pandoc_ast::Block::*;
*block = match *block {
CodeBlock((_, ref kinds, _), _) if kinds.iter().next() == Some("graphviz") => {
// do something to change a graphviz block into an image
}
}
}
pandoc
}));
pandoc.execute().unwrap();
}
Dependencies
~0.7–1.6MB
~35K SLoC