rushdown-diagram 0.9.3

Diagram visualization extension for rushdown markdown parser
Documentation

rushdown-diagram

rushdown-diagram is a diagram plugin for rushdown, a markdown parser. It allows you to easily embed diagrams in your markdown documents.

Installation

Add dependency to your Cargo.toml:

[dependencies]
rushdown-diagram = "x.y.z"

Syntax

Currently, rushdown-diagram supports only mermaid diagrams and client-side rendering. You can use the following syntax to embed a mermaid diagram:

```mermaid
graph LR
    A --- B
    B-->C[fa:fa-ban forbidden]
    B-->D(fa:fa-spinner);
```

Usage

Example

use core::fmt::Write;
use rushdown::{
    new_markdown_to_html,
    parser::{self, ParserExtension},
    renderer::html::{self, RendererExtension},
    Result,
};
use rushdown_diagram::{diagram_parser_extension, diagram_html_renderer_extension, DiagramHtmlRendererOptions};

let markdown_to_html = new_markdown_to_html(
    parser::Options::default(),
    html::Options::default(),
    diagram_parser_extension(),
    diagram_html_renderer_extension(DiagramHtmlRendererOptions::default()),
);
let mut output = String::new();
let input = r#"
```mermaid
graph LR
    A --- B
    B-->C[fa:fa-ban forbidden]
    B-->D(fa:fa-spinner);
```
"#;
match markdown_to_html(&mut output, input) {
    Ok(_) => {
        println!("HTML output:\n{}", output);
    }
    Err(e) => {
        println!("Error: {:?}", e);
    }
}

Donation

BTC: 1NEDSyUmo4SMTDP83JJQSWi1MvQUGGNMZB

Github sponsors also welcome.

License

MIT

Author

Yusuke Inuzuka