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
//! Reading mermaid's flowchart language — stage 1b of konoma's own renderer.
//!
//! The whole of this module answers one question: *what did the author write?* It produces a
//! [`Flowchart`] — nodes, edges, subgraphs — and stops there. No text is measured, no box is
//! sized, no SVG is emitted; those are later stages and they read this model.
//!
//! ```text
//! let chart = parse("flowchart LR\n A[Start] --> B{Ok?}\n B -->|yes| C((Done))").unwrap();
//! chart.direction == Direction::LeftToRight
//! chart.nodes.len() == 3
//! chart.edges[1].label == Some("yes")
//! ```
//! (konoma has no library target, so this is an illustration rather than a doctest; the same
//! case is asserted for real in [`tests`].)
//!
//! # Layout of the module
//!
//! | file | what it owns |
//! |---|---|
//! | [`preprocess`] | the five rewrites mermaid applies before its parser ever runs |
//! | [`parser`] | the grammar: statements, vertices, links, subgraphs |
//! | [`shapes`] | the 53 shape names of `@{ shape: … }`, and the small YAML reader for it |
//! | [`text`] | quotes, `<br>` in four spellings, `#nn;` entities |
//! | [`model`] | the intermediate representation everything above produces |
//!
//! # What it does not do
//!
//! Per `docs/FEATURE-MERMAID-RENDERER.md` §2-5: no curve names, no pixel spacing options, no
//! ELK, no animation, no `icon`/`img` shapes, no tooltips, no collapsible subgraphs, no
//! hand-drawn look, no legacy `graph >` direction symbols, and neither of the two undocumented
//! vertex forms (`(-text-)`, `[|k:v|text]`). Everything in §2-3 that must be *recognised* so it
//! cannot turn into a phantom node — `classDef`, `class`, `style`, `linkStyle`, `:::`, `click`,
//! `%%` comments, `%%{init}%%`, front matter, `accTitle`, `accDescr` in both forms, and edge
//! metadata — is recognised.
// konoma is a binary crate, so `pub` marks nothing as used: the parts of this model that only the
// tests and the stages still to come read look unreachable to rustc, even though [`parse`] and
// [`is_flowchart`] are both on the drawing path as of stage 1e. Same reasoning, and same pair of
// lints, as the vendored `layout` subtree.
pub use ;
pub use ;