Crate pandoc_filter_diagram
source · [−]Expand description
Render diagram markup in a Pandoc AST into SVG
Provide a Pandoc filter filter to convert inline diagram markup into images.
Process a Pandoc abstract syntax tree and convert fenced code blocks with diagram markup into embedded SVG images. Supported diagram markup languages:
Example:
This is a sample Markdown file.
```dot
digraph "broken" {
foo -> bar;
}
```
The Pandoc AST has represents input as Block
and other types of
nodes. This crate turns Block::CodeBlock
nodes that carry a
class attribute that specifies one of the supported diagram markup
languages (dot
, plantuml
, pikchr
, roadmap
, svg
) into
blocks with embedded SVG graphics.
Note that this library does not do any parsing of an input
document. Use the pandoc_ast
or pandoc
crates for that.
Example
let mut df = DiagramFilter::new();
let json = pandoc_ast::filter(json.to_string(), |doc| df.filter(doc));
if !df.errors().is_empty() {
for e in df.errors().iter() {
eprintln!("ERROR: {}", e);
}
std::process::exit(1);
}
Structs
Convert inline diagram markup as images for Pandoc.
Enums
Possible errors for diagram filtering.