Hello!
how to make a diagram / graph in documentation?
For example:
///My description
///```markdown
/// graph TD;
///A-->B;
///A-->C;
///B-->D;
///C-->D;
///```
pub fn my_function(){}
Hello!
how to make a diagram / graph in documentation?
For example:
///My description
///```markdown
/// graph TD;
///A-->B;
///A-->C;
///B-->D;
///C-->D;
///```
pub fn my_function(){}
You can make a graph in graphviz, then convert it to svg using dot -Tsvg
and put the svg directly in your documentation or use something like:
// Macro copied from core/num/mod.rs
macro_rules! doc_comment {
($x:expr, $($tt:tt)*) => {
#[doc = $x]
$($tt)*
};
}
doc_comment! {
concat!("Part before the graph", include_str!("./graph.svg"), "Part after the graph"),
fn a() {}
}
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.