Commit 3aeb9a2
fix(presentation): collapse multi-line colset descrs in mermaid output (#91)
## Summary
- `Presentation.to_mermaid/1` rendered colset descrs into mermaid `%%
colset name() :: <type>` comments. For composite types (maps, nested
tuples), `Macro.to_string` produces multi-line output.
- mermaid's `%%` only comments a single line — trailing lines escape the
comment block and the parser bails:
```
Parse error on line 2:
...flowchart TB name: binary(), realm: r
----------------------^
Expecting 'SEMI', 'NEWLINE', 'EOF', ..., got 'NODE_STRING'
```
- Fix: collapse whitespace runs (`~r/\s+/u`) to a single space so the
colset descr always fits on one line.
## Test plan
- [x] Added `test "collapses multi-line composite types into single-line
%% comments"` in `presentation_test.exs` exercising a `{:map, %{...}}`
descr; asserts the colset line contains no `\n`.
- [x] `MIX_ENV=test mix test` — 63 doctests, 437 tests, 0 failures.
- [x] `mix format --check-formatted` / `mix credo --strict` / `mix
dialyzer` (Total errors: 6, Skipped: 6, baseline) all clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent a7db92c commit 3aeb9a2
2 files changed
Lines changed: 85 additions & 1 deletion
File tree
- lib/coloured_flow/definition/presentation
- test/coloured_flow/definition
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
83 | 157 | | |
84 | 158 | | |
85 | 159 | | |
| |||
0 commit comments