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:


This is a sample Markdown file.

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.


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);


Convert inline diagram markup as images for Pandoc.


Possible errors for diagram filtering.