@md2nativedocx/core 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Parser for PlantUML activity diagrams (the current syntax: `start`, `:action;`, `if`/`while`/`repeat`/
3
+ * `fork`...), into the flowchart AST (`../../types.ts`), so layout, drawing and SmartArt (a straight sequence
4
+ * of actions becomes a SmartArt process) are the flowchart's own. Line-oriented and forgiving like the other
5
+ * parsers: an unrecognized line is a warning, never a throw.
6
+ *
7
+ * The control structures are turned into a graph as they are read. The parser keeps the "open ends" of the
8
+ * flow (the nodes the next element connects from, each with an optional edge label):
9
+ * - `:text;` (multi-line until `;`, or an SDL ending `|` `<` `>` `/` `]` `}`) is a node; `start` and `stop`
10
+ * are small black discs, `end` a crossed circle; `kill` / `detach` end the flow; `(A)` is a connector circle;
11
+ * - `if (c) then (yes)` / `elseif` / `else` / `endif`, and `switch` / `case` / `endswitch`, make a diamond
12
+ * whose branches all continue to whatever follows; `is (x)` / `equals (x)` and `(no) elseif` labels kept;
13
+ * - `while (c) is (x)` ... `endwhile (y)` and `repeat` ... `repeat while (c) is (x) not (y)` loop back to the
14
+ * diamond or the repeat start (`backward:` adds an action on the way back); `break` leaves the loop;
15
+ * - `fork` / `fork again` / `end fork` (and `split`, `end merge`) run their branches side by side (the
16
+ * synchronisation bars are not drawn);
17
+ * - `-> label;` labels the next arrow, `-[hidden]->` makes it invisible; `label` / `goto` jump;
18
+ * - `partition` / `group` / `package` / `rectangle` / `card` `X { ... }` and swimlanes `|Lane|` become
19
+ * subgraphs.
20
+ * Ignored with a warning: notes, `title` / `skinparam` / `<style>` / `!pragma`..., colours; `!include` is
21
+ * never followed (it would read a file or a URL). Creole `**bold**` and `//italic//` are kept, other markup
22
+ * is reduced to its text; `[[link label]]` keeps only the label (no link is ever emitted).
23
+ * Capped (hostile input): 400 nodes, 800 edges, 30 nested blocks, 60 lines per action.
24
+ */
25
+ import type { Flowchart, LabelToken } from '../../types.js';
26
+ export interface PlantUmlActivityParseResult {
27
+ ast: Flowchart;
28
+ warnings: string[];
29
+ }
30
+ /** Creole text to label runs: lines, `**bold**`, `//italic//`; other markup reduced to its text. */
31
+ export declare function creoleRuns(raw: string): {
32
+ text: string;
33
+ runs: LabelToken[];
34
+ };
35
+ /** Parse PlantUML activity-diagram text into the flowchart AST. Never throws on malformed input. */
36
+ export declare function parsePlantUmlActivity(source: string): PlantUmlActivityParseResult;