Skip to main content

render

Function render 

Source
pub fn render(graph: &Graph, options: &RenderOptions) -> String
Expand description

Render a Toolpath Graph as a Markdown string. Single-path graphs use the path-focused layout, multi-path graphs use the cross-path layout.

ยงExamples

use toolpath::v1::{Graph, Path, PathIdentity, Step};
use toolpath_md::{render, RenderOptions};

let step = Step::new("s1", "human:alex", "2026-01-29T10:00:00Z")
    .with_raw_change("src/main.rs", "@@ -1 +1 @@\n-old\n+new")
    .with_intent("Fix greeting");
let path = Path {
    path: PathIdentity {
        id: "p1".into(),
        base: None,
        head: "s1".into(),
        graph_ref: None,
    },
    steps: vec![step],
    meta: None,
};
let graph = Graph::from_path(path);
let md = render(&graph, &RenderOptions::default());
assert!(md.contains("human:alex"));