moonrockz/diagrams-mermaid/printer
Values
print
fn print(diagram : @moonrockz/diagrams-mermaid/ast.Diagram) -> StringCanonical Mermaid text of diagram, with these rules:
- The front matter comes first, then each directive on its own line, then
sequenceDiagram. - Each statement is on its own line and ends with
\n. Statements have two spaces of indentation for each level: one under the header, and one more in each frame and box. - Keywords are in lower case, except
sequenceDiagram,accTitleandaccDescr.title: textbecomestitle text. - A message is the sender,
()when it has one before the arrow, the arrow as written,+or-,()when it has one after the arrow, the receiver,:, and a space and the text when the text is not empty. - Notes and link statements have the same
: textform. Two note participants are joined by,without spaces. - A participant configuration is
@{and its text and}. - A
-after an arrow that ends with-, such as/|-, has a space before it, because/|--is another arrow. - A description with a line break (
\nor\r) uses theaccDescr { ... }form, with its lines as written; others useaccDescr: text. - Comments are not printed, because the AST does not keep them.