-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmmds_replay.rs
More file actions
55 lines (52 loc) · 1.37 KB
/
Copy pathmmds_replay.rs
File metadata and controls
55 lines (52 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use mmdflux::mmds::{Document, evaluate_profiles_for_document, generate_mermaid};
use mmdflux::{OutputFormat, RenderConfig};
const MMDS_INPUT: &str = r#"{
"version": 1,
"profiles": ["mmds-core-v1", "mmdflux-text-v1"],
"defaults": {
"node": { "shape": "rectangle" },
"edge": {
"stroke": "solid",
"arrow_start": "none",
"arrow_end": "normal",
"minlen": 1
}
},
"geometry_level": "layout",
"metadata": {
"diagram_type": "flowchart",
"direction": "TD",
"bounds": { "width": 120.0, "height": 110.0 }
},
"nodes": [
{
"id": "A",
"label": "Input",
"position": { "x": 60.0, "y": 25.0 },
"size": { "width": 50.0, "height": 20.0 }
},
{
"id": "B",
"label": "Output",
"position": { "x": 60.0, "y": 85.0 },
"size": { "width": 52.0, "height": 20.0 }
}
],
"edges": [
{
"id": "e0",
"source": "A",
"target": "B"
}
]
}"#;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let payload: Document = MMDS_INPUT.parse()?;
let negotiation = evaluate_profiles_for_document(&payload);
let text = mmdflux::render_document(&payload, OutputFormat::Text, &RenderConfig::default())?;
let mermaid = generate_mermaid(&payload)?;
println!("supported profiles: {:?}", negotiation.supported);
println!("{text}");
println!("{mermaid}");
Ok(())
}