Crates.io | pandoc_ast |
lib.rs | pandoc_ast |
version | 0.8.6 |
source | src |
created_at | 2015-08-14 15:42:06.082855 |
updated_at | 2024-01-03 12:36:51.697449 |
description | deserializes and serializes the markdown ast for writing pandoc filters |
homepage | |
repository | https://github.com/oli-obk/pandoc-ast |
max_upload_size | |
id | 2838 |
size | 44,983 |
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
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();
}