termaid 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- termaid-0.4.0/CHANGELOG.md +102 -0
- {termaid-0.3.0 → termaid-0.4.0}/PKG-INFO +20 -5
- {termaid-0.3.0 → termaid-0.4.0}/README.md +19 -4
- {termaid-0.3.0 → termaid-0.4.0}/pyproject.toml +1 -1
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/__init__.py +63 -8
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/cli.py +108 -1
- termaid-0.4.0/src/termaid/ingest.py +186 -0
- termaid-0.4.0/src/termaid/model/kanban.py +23 -0
- termaid-0.4.0/src/termaid/model/quadrant.py +24 -0
- termaid-0.4.0/src/termaid/model/timeline.py +23 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/output/rich.py +73 -5
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/flowchart.py +12 -1
- termaid-0.4.0/src/termaid/parser/kanban.py +71 -0
- termaid-0.4.0/src/termaid/parser/quadrant.py +67 -0
- termaid-0.4.0/src/termaid/parser/timeline.py +68 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/blockdiagram.py +21 -17
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/classdiagram.py +28 -24
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/erdiagram.py +23 -20
- termaid-0.4.0/src/termaid/renderer/kanban.py +137 -0
- termaid-0.4.0/src/termaid/renderer/quadrant.py +146 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/sequence.py +6 -4
- termaid-0.4.0/src/termaid/renderer/themes.py +179 -0
- termaid-0.4.0/src/termaid/renderer/timeline.py +65 -0
- termaid-0.3.0/CHANGELOG.md +0 -50
- termaid-0.3.0/src/termaid/renderer/themes.py +0 -87
- {termaid-0.3.0 → termaid-0.4.0}/.github/workflows/ci.yml +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/.github/workflows/publish.yml +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/.gitignore +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/CONTRIBUTING.md +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/LICENSE +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/demo/termaid-demo.gif +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/docs/gallery.md +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/scripts/generate_gallery.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/__main__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/graph/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/graph/model.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/graph/shapes.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/layout/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/layout/coordinates.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/layout/grid.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/layout/layers.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/layout/placement.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/layout/subgraphs.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/blockdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/classdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/erdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/gitgraph.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/mindmap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/piechart.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/sequence.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/model/treemap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/output/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/output/text.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/output/widget.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/blockdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/classdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/erdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/gitgraph.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/mindmap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/piechart.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/sequence.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/statediagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/tokens.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/parser/treemap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/py.typed +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/canvas.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/charset.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/draw.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/gitgraph.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/mindmap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/piechart.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/shapes/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/renderer/treemap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/routing/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/routing/pathfinder.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/src/termaid/routing/router.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/__init__.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/conftest.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/blockdiagram/basic.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/blockdiagram/col_span.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/blockdiagram/grid.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/blockdiagram/links.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/classdiagram/annotation.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/classdiagram/basic.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/classdiagram/inheritance.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/classdiagram/relationships.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/erdiagram/attributes.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/erdiagram/basic.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/erdiagram/dashed.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/erdiagram/multiple_entities.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/all_shapes.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/ampersand_both.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/backlink_complex.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/bidir_dotted.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/bidir_labeled.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/bidir_td.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/bidir_thick.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/bidirectional.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/branching.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/chain.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/comments.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/cycle.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/diamond.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/dotted_arrow.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/duplicate_labels.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/empty_graph.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/fan_in.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/fan_out.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/flowchart_keyword.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/graph_bt.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/graph_rl.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/labeled_edges.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/large_graph.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/long_labels.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/mermaid_comprehensive.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/mixed_arrow_styles.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/multiple_links.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/no_arrow_dotted.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/no_arrow_solid.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/no_arrow_thick.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/node_with_label.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/parallelogram.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/self_ref_with_edge.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/self_reference.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/semicolons.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/simple_lr.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/simple_tb.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/simple_td.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/single_node.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/subgraph_basic.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/subgraph_nested.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/subgraph_three_levels.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/subgraph_two_separate.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/subgraph_with_labels.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/thick_arrow.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/three_nodes_inline.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/trapezoid.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/two_roots.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/flowcharts/unicode_labels.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/gitgraph/cherry_pick.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/gitgraph/feature_branch.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/gitgraph/linear.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/gitgraph/tags.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/gitgraph/tb_direction.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/arrows.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/autonumber.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/basic.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/multiline_notes.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/nested_blocks.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/notes.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/participant_kinds.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/sequence/self_message.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/statediagram/basic.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/statediagram/choice.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/statediagram/composite.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/fixtures/statediagram/start_end.mmd +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_blockdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_classdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_cli.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_corner_cases.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_edge_styles.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_erdiagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_gitgraph.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_integration.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_layout.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_mindmap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_parser_comprehensive.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_piechart.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_renderer.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_rendering_quality.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_routing.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_sequence.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_shapes.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_snapshots.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_state_diagram.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_themes.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_treemap.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/tests/test_warnings.py +0 -0
- {termaid-0.3.0 → termaid-0.4.0}/uv.lock +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.0 (2026-03-26)
|
|
4
|
+
|
|
5
|
+
### New diagram types
|
|
6
|
+
- **Timeline** (`timeline` syntax): vertical event list with sections and details
|
|
7
|
+
- **Kanban** (`kanban` syntax): column-based task boards with cards
|
|
8
|
+
- **Quadrant chart** (`quadrantChart` syntax): 2x2 grid with plotted data points
|
|
9
|
+
- 13 diagram types now supported
|
|
10
|
+
|
|
11
|
+
### New themes
|
|
12
|
+
- **Solid-background themes**: `gruvbox`, `monokai`, `dracula`, `nord`, `solarized` with filled region backgrounds
|
|
13
|
+
- Per-section coloring: kanban columns, quadrant regions, and timeline sections get distinct colors
|
|
14
|
+
- Depth shading: kanban cards use a lighter shade of the column color
|
|
15
|
+
- `--themes` flag to list all available themes
|
|
16
|
+
|
|
17
|
+
### New features
|
|
18
|
+
- **JSON ingest** (`--json TYPE`): pipe structured data and render as treemap, pie, mindmap, or flowchart
|
|
19
|
+
- **`--demo [TYPE]`**: render sample diagrams for any diagram type
|
|
20
|
+
- **`padding_x` and `gap`** now supported by sequence, class, ER, block, and kanban renderers
|
|
21
|
+
- Parser fix: edge labels with quoted text (`-->|"Yes"|`) no longer rendered as spaces
|
|
22
|
+
|
|
23
|
+
## 0.3.0 (2026-03-25)
|
|
24
|
+
|
|
25
|
+
### Rendering engine overhaul
|
|
26
|
+
|
|
27
|
+
- **Directional canvas**: junction characters derived from direction bitfields instead of a lookup table, producing correct junctions in all cases
|
|
28
|
+
- **Gap expansion**: crossing edges between layers automatically get extra routing space so they no longer overlap
|
|
29
|
+
- **Endpoint spreading**: overlapping arrows on the same node border are spread apart so all edges are visible
|
|
30
|
+
- **Subgraph separation**: nodes stay inside their declared subgraph even with cross-boundary edges
|
|
31
|
+
- **Routing bias**: edges prefer the natural flow direction, avoiding tight corners next to node borders
|
|
32
|
+
- **Label separation**: edge labels from different edges no longer merge onto the same output line
|
|
33
|
+
- **Parser fix**: arrow syntax inside quoted labels (`A["has --> arrow"]`) no longer confuses the parser
|
|
34
|
+
|
|
35
|
+
### New diagram type
|
|
36
|
+
|
|
37
|
+
- **Mindmaps** (`mindmap` syntax): indentation-based tree layout with automatic overflow to the left for crowded roots, rounded/sharp/ASCII branch characters
|
|
38
|
+
|
|
39
|
+
### CLI improvements
|
|
40
|
+
|
|
41
|
+
- `--width N`: set max output width, re-renders with smaller gap/padding if exceeded
|
|
42
|
+
- `-o FILE` / `--output FILE`: write output to file instead of stdout
|
|
43
|
+
- `--show-ids`: show node IDs alongside labels for debugging
|
|
44
|
+
- `--no-auto-fit`: disable automatic terminal width compaction
|
|
45
|
+
- `NO_COLOR` environment variable respected
|
|
46
|
+
- `--version` reads from package metadata instead of hardcoded string
|
|
47
|
+
- Auto-fit: diagrams that exceed terminal width are automatically re-rendered with compact settings
|
|
48
|
+
|
|
49
|
+
### Code quality
|
|
50
|
+
|
|
51
|
+
- Layout engine split from 1 file (1095 lines) into 5 focused modules
|
|
52
|
+
- 1066 tests, 0 failures, 0 xfails (up from 1004 tests, 5 xfails)
|
|
53
|
+
- Gallery script and docs/gallery.md with all 78 fixture diagrams
|
|
54
|
+
|
|
55
|
+
## 0.2.1 (2026-03-25)
|
|
56
|
+
|
|
57
|
+
- Add `--gap` CLI flag and `gap` parameter for compact diagram spacing
|
|
58
|
+
- Document wide LR diagram workarounds in README
|
|
59
|
+
|
|
60
|
+
## 0.2.0 (2026-03-20)
|
|
61
|
+
|
|
62
|
+
- Add pie chart support (`pie` syntax, rendered as horizontal bar charts)
|
|
63
|
+
- Add treemap support (`treemap-beta` syntax with nested sections and proportional sizing)
|
|
64
|
+
- 9 diagram types now supported
|
|
65
|
+
|
|
66
|
+
## 0.1.3 (2026-03-04)
|
|
67
|
+
|
|
68
|
+
- Add `--tui` flag to CLI for interactive TUI viewer
|
|
69
|
+
- Update demo GIF with pipe and TUI examples
|
|
70
|
+
|
|
71
|
+
## 0.1.1 (2026-03-04)
|
|
72
|
+
|
|
73
|
+
- Rename package from `termmaid` to `termaid`
|
|
74
|
+
|
|
75
|
+
## 0.1.0 (2026-03-04)
|
|
76
|
+
|
|
77
|
+
Initial release.
|
|
78
|
+
|
|
79
|
+
### Features
|
|
80
|
+
|
|
81
|
+
- **7 diagram types:** flowcharts, sequence, class, ER, state, block, and git graphs
|
|
82
|
+
- **Flowcharts** (`graph`/`flowchart`) with all 5 directions (`LR`, `RL`, `TD`/`TB`, `BT`)
|
|
83
|
+
- **Sequence diagrams** with participants, actors, solid/dashed messages
|
|
84
|
+
- **Class diagrams** with attributes, methods, visibility, and 6 relationship types
|
|
85
|
+
- **ER diagrams** with cardinality, attributes, keys, and relationship labels
|
|
86
|
+
- **State diagrams** (`stateDiagram-v2`) with transitions, composite states, stereotypes
|
|
87
|
+
- **Block diagrams** (`block-beta`) with column layout and spanning
|
|
88
|
+
- **Git graphs** (`gitGraph`) with branches, merges, cherry-picks, tags, and 3 orientations
|
|
89
|
+
- 14 flowchart node shapes: rectangle, rounded, stadium, subroutine, diamond, hexagon, circle, double circle, asymmetric, cylinder, parallelogram, parallelogram alt, trapezoid, trapezoid alt
|
|
90
|
+
- 3 edge styles: solid, dotted, thick
|
|
91
|
+
- Bidirectional edges (`<-->`, `<-.->`, `<==>`)
|
|
92
|
+
- Edge labels (`-->|label|`)
|
|
93
|
+
- Subgraphs with nesting and cross-boundary edges
|
|
94
|
+
- `classDef`, `style`, and `linkStyle` directives
|
|
95
|
+
- `@{shape}` node syntax
|
|
96
|
+
- Link length control (`--->`, `---->`)
|
|
97
|
+
- Markdown labels (`**bold**`, `*italic*`)
|
|
98
|
+
- ASCII mode (`--ascii`) for terminals without Unicode support
|
|
99
|
+
- Colored output via Rich (`--color`) with 6 built-in themes
|
|
100
|
+
- Textual widget for TUI applications
|
|
101
|
+
- CLI tool with stdin/file input
|
|
102
|
+
- Pure Python, zero runtime dependencies
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: termaid
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Render Mermaid diagrams in your terminal or Python app
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -38,7 +38,7 @@ Description-Content-Type: text/markdown
|
|
|
38
38
|
|
|
39
39
|
## Features
|
|
40
40
|
|
|
41
|
-
- **
|
|
41
|
+
- **13 diagram types:** flowcharts, sequence, class, ER, state, block, git graphs, pie charts, treemaps, mindmaps, timelines, kanban boards, and quadrant charts
|
|
42
42
|
- **Zero dependencies:** pure Python, nothing to install beyond the package itself
|
|
43
43
|
- **Terminal-aware:** auto-fits diagrams to terminal width with progressive compaction
|
|
44
44
|
- **Rich and Textual integration:** colored output and TUI widgets with optional extras
|
|
@@ -431,9 +431,10 @@ Project ──├─ Development ──╭─ Frontend
|
|
|
431
431
|
|
|
432
432
|
| Flag | Description |
|
|
433
433
|
|------|-------------|
|
|
434
|
-
| `--tui` | Interactive TUI viewer (requires `pip install termaid[tui]`) |
|
|
435
434
|
| `--ascii` | ASCII-only output (no Unicode box-drawing) |
|
|
436
|
-
| `--theme NAME` | Color theme
|
|
435
|
+
| `--theme NAME` | Color theme (requires `pip install termaid[rich]`). Use `--themes` to list |
|
|
436
|
+
| `--themes` | List all available color themes |
|
|
437
|
+
| `--demo [TYPE]` | Render sample diagrams (`all`, `flowchart`, `sequence`, `mindmap`, etc.) |
|
|
437
438
|
| `--padding-x N` | Horizontal padding inside boxes (default: 4) |
|
|
438
439
|
| `--padding-y N` | Vertical padding inside boxes (default: 2) |
|
|
439
440
|
| `--gap N` | Space between nodes (default: 4). Use `1` or `2` for compact diagrams |
|
|
@@ -442,6 +443,8 @@ Project ──├─ Development ──╭─ Frontend
|
|
|
442
443
|
| `--sharp-edges` | Sharp corners on edge turns instead of rounded |
|
|
443
444
|
| `-o FILE` | Write output to file instead of stdout |
|
|
444
445
|
| `--show-ids` | Show node IDs alongside labels for debugging (e.g. `myId: My Label`) |
|
|
446
|
+
| `--json TYPE` | Pipe JSON/tabular data and render as `treemap`, `pie`, `mindmap`, or `flowchart` |
|
|
447
|
+
| `--tui` | Interactive TUI viewer (requires `pip install termaid[tui]`) |
|
|
445
448
|
|
|
446
449
|
## Python API
|
|
447
450
|
|
|
@@ -467,7 +470,9 @@ class MyApp(App):
|
|
|
467
470
|
|
|
468
471
|
## Themes
|
|
469
472
|
|
|
470
|
-
|
|
473
|
+
11 built-in themes for `--theme` / `render_rich()`. Run `termaid --themes` to list them.
|
|
474
|
+
|
|
475
|
+
**Text themes** (foreground colors only):
|
|
471
476
|
|
|
472
477
|
| Theme | Colors | Description |
|
|
473
478
|
|-------|--------|-------------|
|
|
@@ -478,6 +483,16 @@ Six built-in themes for `--theme` / `render_rich()`:
|
|
|
478
483
|
| `amber` |    | Amber/gold CRT-style |
|
|
479
484
|
| `phosphor` |    | Green phosphor terminal-style |
|
|
480
485
|
|
|
486
|
+
**Solid themes** (filled backgrounds with foreground colors):
|
|
487
|
+
|
|
488
|
+
| Theme | Colors | Description |
|
|
489
|
+
|-------|--------|-------------|
|
|
490
|
+
| `gruvbox` |    | Gruvbox dark palette |
|
|
491
|
+
| `monokai` |    | Monokai dark with pink/green accents |
|
|
492
|
+
| `dracula` |    | Dracula purple/pink/green palette |
|
|
493
|
+
| `nord` |    | Nord muted blue/cyan arctic palette |
|
|
494
|
+
| `solarized` |    | Solarized dark blue/yellow/cyan |
|
|
495
|
+
|
|
481
496
|
## Optional extras
|
|
482
497
|
|
|
483
498
|
```bash
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
- **
|
|
13
|
+
- **13 diagram types:** flowcharts, sequence, class, ER, state, block, git graphs, pie charts, treemaps, mindmaps, timelines, kanban boards, and quadrant charts
|
|
14
14
|
- **Zero dependencies:** pure Python, nothing to install beyond the package itself
|
|
15
15
|
- **Terminal-aware:** auto-fits diagrams to terminal width with progressive compaction
|
|
16
16
|
- **Rich and Textual integration:** colored output and TUI widgets with optional extras
|
|
@@ -403,9 +403,10 @@ Project ──├─ Development ──╭─ Frontend
|
|
|
403
403
|
|
|
404
404
|
| Flag | Description |
|
|
405
405
|
|------|-------------|
|
|
406
|
-
| `--tui` | Interactive TUI viewer (requires `pip install termaid[tui]`) |
|
|
407
406
|
| `--ascii` | ASCII-only output (no Unicode box-drawing) |
|
|
408
|
-
| `--theme NAME` | Color theme
|
|
407
|
+
| `--theme NAME` | Color theme (requires `pip install termaid[rich]`). Use `--themes` to list |
|
|
408
|
+
| `--themes` | List all available color themes |
|
|
409
|
+
| `--demo [TYPE]` | Render sample diagrams (`all`, `flowchart`, `sequence`, `mindmap`, etc.) |
|
|
409
410
|
| `--padding-x N` | Horizontal padding inside boxes (default: 4) |
|
|
410
411
|
| `--padding-y N` | Vertical padding inside boxes (default: 2) |
|
|
411
412
|
| `--gap N` | Space between nodes (default: 4). Use `1` or `2` for compact diagrams |
|
|
@@ -414,6 +415,8 @@ Project ──├─ Development ──╭─ Frontend
|
|
|
414
415
|
| `--sharp-edges` | Sharp corners on edge turns instead of rounded |
|
|
415
416
|
| `-o FILE` | Write output to file instead of stdout |
|
|
416
417
|
| `--show-ids` | Show node IDs alongside labels for debugging (e.g. `myId: My Label`) |
|
|
418
|
+
| `--json TYPE` | Pipe JSON/tabular data and render as `treemap`, `pie`, `mindmap`, or `flowchart` |
|
|
419
|
+
| `--tui` | Interactive TUI viewer (requires `pip install termaid[tui]`) |
|
|
417
420
|
|
|
418
421
|
## Python API
|
|
419
422
|
|
|
@@ -439,7 +442,9 @@ class MyApp(App):
|
|
|
439
442
|
|
|
440
443
|
## Themes
|
|
441
444
|
|
|
442
|
-
|
|
445
|
+
11 built-in themes for `--theme` / `render_rich()`. Run `termaid --themes` to list them.
|
|
446
|
+
|
|
447
|
+
**Text themes** (foreground colors only):
|
|
443
448
|
|
|
444
449
|
| Theme | Colors | Description |
|
|
445
450
|
|-------|--------|-------------|
|
|
@@ -450,6 +455,16 @@ Six built-in themes for `--theme` / `render_rich()`:
|
|
|
450
455
|
| `amber` |    | Amber/gold CRT-style |
|
|
451
456
|
| `phosphor` |    | Green phosphor terminal-style |
|
|
452
457
|
|
|
458
|
+
**Solid themes** (filled backgrounds with foreground colors):
|
|
459
|
+
|
|
460
|
+
| Theme | Colors | Description |
|
|
461
|
+
|-------|--------|-------------|
|
|
462
|
+
| `gruvbox` |    | Gruvbox dark palette |
|
|
463
|
+
| `monokai` |    | Monokai dark with pink/green accents |
|
|
464
|
+
| `dracula` |    | Dracula purple/pink/green palette |
|
|
465
|
+
| `nord` |    | Nord muted blue/cyan arctic palette |
|
|
466
|
+
| `solarized` |    | Solarized dark blue/yellow/cyan |
|
|
467
|
+
|
|
453
468
|
## Optional extras
|
|
454
469
|
|
|
455
470
|
```bash
|
|
@@ -60,31 +60,40 @@ def render(
|
|
|
60
60
|
>>> from termaid import render
|
|
61
61
|
>>> print(render("graph LR\\n A --> B --> C"))
|
|
62
62
|
"""
|
|
63
|
+
# Build extra kwargs only when values differ from flowchart defaults,
|
|
64
|
+
# so each renderer keeps its own defaults when the user doesn't
|
|
65
|
+
# explicitly override.
|
|
66
|
+
_extra: dict[str, int] = {}
|
|
67
|
+
if padding_x != 4:
|
|
68
|
+
_extra["padding_x"] = padding_x
|
|
69
|
+
if gap != 4:
|
|
70
|
+
_extra["gap"] = gap
|
|
71
|
+
|
|
63
72
|
try:
|
|
64
73
|
text = _strip_frontmatter(source.strip())
|
|
65
74
|
if text.startswith("sequenceDiagram"):
|
|
66
75
|
from .parser.sequence import parse_sequence_diagram
|
|
67
76
|
from .renderer.sequence import render_sequence
|
|
68
77
|
diagram = parse_sequence_diagram(text)
|
|
69
|
-
return render_sequence(diagram, use_ascii=use_ascii).to_string()
|
|
78
|
+
return render_sequence(diagram, use_ascii=use_ascii, **_extra).to_string()
|
|
70
79
|
|
|
71
80
|
if text.startswith("classDiagram"):
|
|
72
81
|
from .parser.classdiagram import parse_class_diagram
|
|
73
82
|
from .renderer.classdiagram import render_class_diagram
|
|
74
83
|
diagram = parse_class_diagram(text)
|
|
75
|
-
return render_class_diagram(diagram, use_ascii=use_ascii).to_string()
|
|
84
|
+
return render_class_diagram(diagram, use_ascii=use_ascii, **_extra).to_string()
|
|
76
85
|
|
|
77
86
|
if text.startswith("erDiagram"):
|
|
78
87
|
from .parser.erdiagram import parse_er_diagram
|
|
79
88
|
from .renderer.erdiagram import render_er_diagram
|
|
80
89
|
diagram = parse_er_diagram(text)
|
|
81
|
-
return render_er_diagram(diagram, use_ascii=use_ascii).to_string()
|
|
90
|
+
return render_er_diagram(diagram, use_ascii=use_ascii, **_extra).to_string()
|
|
82
91
|
|
|
83
92
|
if text.startswith("block"):
|
|
84
93
|
from .parser.blockdiagram import parse_block_diagram
|
|
85
94
|
from .renderer.blockdiagram import render_block_diagram
|
|
86
95
|
diagram = parse_block_diagram(text)
|
|
87
|
-
return render_block_diagram(diagram, use_ascii=use_ascii).to_string()
|
|
96
|
+
return render_block_diagram(diagram, use_ascii=use_ascii, **_extra).to_string()
|
|
88
97
|
|
|
89
98
|
if text.startswith("gitGraph") or (text.startswith("%%{init") and "gitGraph" in text):
|
|
90
99
|
from .parser.gitgraph import parse_git_graph
|
|
@@ -110,6 +119,24 @@ def render(
|
|
|
110
119
|
diagram = parse_mindmap(text)
|
|
111
120
|
return render_mindmap(diagram, use_ascii=use_ascii, rounded=rounded_edges).to_string()
|
|
112
121
|
|
|
122
|
+
if text.startswith("timeline"):
|
|
123
|
+
from .parser.timeline import parse_timeline
|
|
124
|
+
from .renderer.timeline import render_timeline
|
|
125
|
+
diagram = parse_timeline(text)
|
|
126
|
+
return render_timeline(diagram, use_ascii=use_ascii).to_string()
|
|
127
|
+
|
|
128
|
+
if text.startswith("kanban"):
|
|
129
|
+
from .parser.kanban import parse_kanban
|
|
130
|
+
from .renderer.kanban import render_kanban
|
|
131
|
+
diagram = parse_kanban(text)
|
|
132
|
+
return render_kanban(diagram, use_ascii=use_ascii, **_extra).to_string()
|
|
133
|
+
|
|
134
|
+
if text.startswith("quadrantChart"):
|
|
135
|
+
from .parser.quadrant import parse_quadrant
|
|
136
|
+
from .renderer.quadrant import render_quadrant
|
|
137
|
+
diagram = parse_quadrant(text)
|
|
138
|
+
return render_quadrant(diagram, use_ascii=use_ascii).to_string()
|
|
139
|
+
|
|
113
140
|
graph = parse(text)
|
|
114
141
|
from .output.text import render_text
|
|
115
142
|
return render_text(graph, use_ascii=use_ascii, padding_x=padding_x, padding_y=padding_y, rounded_edges=rounded_edges, gap=gap)
|
|
@@ -140,6 +167,10 @@ def render_rich(
|
|
|
140
167
|
Returns:
|
|
141
168
|
rich.text.Text object
|
|
142
169
|
"""
|
|
170
|
+
_extra_r: dict[str, int] = {}
|
|
171
|
+
if padding_x != 4:
|
|
172
|
+
_extra_r["padding_x"] = padding_x
|
|
173
|
+
|
|
143
174
|
try:
|
|
144
175
|
text = _strip_frontmatter(source.strip())
|
|
145
176
|
if text.startswith("sequenceDiagram"):
|
|
@@ -147,7 +178,7 @@ def render_rich(
|
|
|
147
178
|
from .renderer.sequence import render_sequence
|
|
148
179
|
from .output.rich import render_sequence_rich
|
|
149
180
|
diagram = parse_sequence_diagram(text)
|
|
150
|
-
canvas = render_sequence(diagram, use_ascii=use_ascii)
|
|
181
|
+
canvas = render_sequence(diagram, use_ascii=use_ascii, **_extra_r)
|
|
151
182
|
return render_sequence_rich(canvas, theme=theme)
|
|
152
183
|
|
|
153
184
|
if text.startswith("classDiagram"):
|
|
@@ -155,7 +186,7 @@ def render_rich(
|
|
|
155
186
|
from .renderer.classdiagram import render_class_diagram
|
|
156
187
|
from .output.rich import render_sequence_rich
|
|
157
188
|
diagram = parse_class_diagram(text)
|
|
158
|
-
canvas = render_class_diagram(diagram, use_ascii=use_ascii)
|
|
189
|
+
canvas = render_class_diagram(diagram, use_ascii=use_ascii, **_extra_r)
|
|
159
190
|
return render_sequence_rich(canvas, theme=theme)
|
|
160
191
|
|
|
161
192
|
if text.startswith("erDiagram"):
|
|
@@ -163,7 +194,7 @@ def render_rich(
|
|
|
163
194
|
from .renderer.erdiagram import render_er_diagram
|
|
164
195
|
from .output.rich import render_sequence_rich
|
|
165
196
|
diagram = parse_er_diagram(text)
|
|
166
|
-
canvas = render_er_diagram(diagram, use_ascii=use_ascii)
|
|
197
|
+
canvas = render_er_diagram(diagram, use_ascii=use_ascii, **_extra_r)
|
|
167
198
|
return render_sequence_rich(canvas, theme=theme)
|
|
168
199
|
|
|
169
200
|
if text.startswith("block"):
|
|
@@ -171,7 +202,7 @@ def render_rich(
|
|
|
171
202
|
from .renderer.blockdiagram import render_block_diagram
|
|
172
203
|
from .output.rich import render_sequence_rich
|
|
173
204
|
diagram = parse_block_diagram(text)
|
|
174
|
-
canvas = render_block_diagram(diagram, use_ascii=use_ascii)
|
|
205
|
+
canvas = render_block_diagram(diagram, use_ascii=use_ascii, **_extra_r)
|
|
175
206
|
return render_sequence_rich(canvas, theme=theme)
|
|
176
207
|
|
|
177
208
|
if text.startswith("gitGraph") or (text.startswith("%%{init") and "gitGraph" in text):
|
|
@@ -206,6 +237,30 @@ def render_rich(
|
|
|
206
237
|
canvas = render_mindmap(diagram, use_ascii=use_ascii)
|
|
207
238
|
return render_sequence_rich(canvas, theme=theme)
|
|
208
239
|
|
|
240
|
+
if text.startswith("timeline"):
|
|
241
|
+
from .parser.timeline import parse_timeline
|
|
242
|
+
from .renderer.timeline import render_timeline
|
|
243
|
+
from .output.rich import render_sequence_rich
|
|
244
|
+
diagram = parse_timeline(text)
|
|
245
|
+
canvas = render_timeline(diagram, use_ascii=use_ascii)
|
|
246
|
+
return render_sequence_rich(canvas, theme=theme)
|
|
247
|
+
|
|
248
|
+
if text.startswith("kanban"):
|
|
249
|
+
from .parser.kanban import parse_kanban
|
|
250
|
+
from .renderer.kanban import render_kanban
|
|
251
|
+
from .output.rich import render_sequence_rich
|
|
252
|
+
diagram = parse_kanban(text)
|
|
253
|
+
canvas = render_kanban(diagram, use_ascii=use_ascii, **_extra_r)
|
|
254
|
+
return render_sequence_rich(canvas, theme=theme)
|
|
255
|
+
|
|
256
|
+
if text.startswith("quadrantChart"):
|
|
257
|
+
from .parser.quadrant import parse_quadrant
|
|
258
|
+
from .renderer.quadrant import render_quadrant
|
|
259
|
+
from .output.rich import render_sequence_rich
|
|
260
|
+
diagram = parse_quadrant(text)
|
|
261
|
+
canvas = render_quadrant(diagram, use_ascii=use_ascii)
|
|
262
|
+
return render_sequence_rich(canvas, theme=theme)
|
|
263
|
+
|
|
209
264
|
graph = parse(text)
|
|
210
265
|
from .output.rich import render_rich as _render_rich
|
|
211
266
|
return _render_rich(graph, use_ascii=use_ascii, padding_x=padding_x, padding_y=padding_y, rounded_edges=rounded_edges, theme=theme)
|
|
@@ -156,7 +156,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
156
156
|
parser.add_argument(
|
|
157
157
|
"--theme",
|
|
158
158
|
default=None,
|
|
159
|
-
choices=["default", "terra", "neon", "mono", "amber", "phosphor"
|
|
159
|
+
choices=["default", "terra", "neon", "mono", "amber", "phosphor",
|
|
160
|
+
"gruvbox", "monokai", "dracula", "nord", "solarized"],
|
|
160
161
|
help="Color theme. Requires 'rich' package (pip install termaid[rich]).",
|
|
161
162
|
)
|
|
162
163
|
parser.add_argument(
|
|
@@ -180,6 +181,26 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
180
181
|
action="store_true",
|
|
181
182
|
help="Show node IDs alongside labels (e.g. 'A: Start') for debugging.",
|
|
182
183
|
)
|
|
184
|
+
parser.add_argument(
|
|
185
|
+
"--json",
|
|
186
|
+
default=None,
|
|
187
|
+
metavar="TYPE",
|
|
188
|
+
choices=["treemap", "pie", "mindmap", "flowchart"],
|
|
189
|
+
help="Read JSON/tabular data from stdin and render as TYPE (treemap, pie, mindmap, flowchart).",
|
|
190
|
+
)
|
|
191
|
+
parser.add_argument(
|
|
192
|
+
"--themes",
|
|
193
|
+
action="store_true",
|
|
194
|
+
help="List available color themes and exit.",
|
|
195
|
+
)
|
|
196
|
+
parser.add_argument(
|
|
197
|
+
"--demo",
|
|
198
|
+
nargs="?",
|
|
199
|
+
const="all",
|
|
200
|
+
default=None,
|
|
201
|
+
metavar="TYPE",
|
|
202
|
+
help="Render sample diagrams. Use 'all' or a type name (flowchart, sequence, etc.).",
|
|
203
|
+
)
|
|
183
204
|
parser.add_argument(
|
|
184
205
|
"--version",
|
|
185
206
|
action="version",
|
|
@@ -188,6 +209,12 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
188
209
|
|
|
189
210
|
args = parser.parse_args(argv)
|
|
190
211
|
|
|
212
|
+
if args.themes:
|
|
213
|
+
return _list_themes()
|
|
214
|
+
|
|
215
|
+
if args.demo is not None:
|
|
216
|
+
return _run_demo(args)
|
|
217
|
+
|
|
191
218
|
# Read input
|
|
192
219
|
source = _read_source(args)
|
|
193
220
|
if source is None:
|
|
@@ -198,6 +225,15 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
198
225
|
print("Error: Empty input.", file=sys.stderr)
|
|
199
226
|
return 1
|
|
200
227
|
|
|
228
|
+
# JSON ingest: convert structured data to Mermaid syntax
|
|
229
|
+
if args.json:
|
|
230
|
+
try:
|
|
231
|
+
from .ingest import json_to_mermaid
|
|
232
|
+
source = json_to_mermaid(source, args.json)
|
|
233
|
+
except Exception as e:
|
|
234
|
+
print(f"Error converting JSON to {args.json}: {e}", file=sys.stderr)
|
|
235
|
+
return 1
|
|
236
|
+
|
|
201
237
|
# TUI mode
|
|
202
238
|
if args.tui:
|
|
203
239
|
return _run_tui(source, args)
|
|
@@ -324,5 +360,76 @@ def _apply_show_ids(source: str) -> str:
|
|
|
324
360
|
|
|
325
361
|
|
|
326
362
|
|
|
363
|
+
def _list_themes() -> int:
|
|
364
|
+
"""List available color themes."""
|
|
365
|
+
themes = [
|
|
366
|
+
("default", "text", "Cyan nodes, yellow arrows, white labels"),
|
|
367
|
+
("terra", "text", "Warm earth tones (browns, oranges)"),
|
|
368
|
+
("neon", "text", "Magenta nodes, green arrows, cyan edges"),
|
|
369
|
+
("mono", "text", "White/gray monochrome"),
|
|
370
|
+
("amber", "text", "Amber/gold CRT-style"),
|
|
371
|
+
("phosphor", "text", "Green phosphor terminal"),
|
|
372
|
+
("gruvbox", "solid", "Gruvbox dark palette"),
|
|
373
|
+
("monokai", "solid", "Monokai dark with pink/green accents"),
|
|
374
|
+
("dracula", "solid", "Dracula purple/pink/green palette"),
|
|
375
|
+
("nord", "solid", "Nord muted blue/cyan arctic palette"),
|
|
376
|
+
("solarized", "solid", "Solarized dark blue/yellow/cyan"),
|
|
377
|
+
]
|
|
378
|
+
for name, kind, desc in themes:
|
|
379
|
+
tag = f"[{kind}]"
|
|
380
|
+
print(f" {name:12s} {tag:8s} {desc}")
|
|
381
|
+
return 0
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
_DEMO_SOURCES = {
|
|
385
|
+
"flowchart": ("Flowchart", "graph TD\n A[Start] --> B{Decision}\n B -->|Yes| C[Process]\n B -->|No| D[End]\n C --> D"),
|
|
386
|
+
"sequence": ("Sequence diagram", "sequenceDiagram\n Client->>Server: GET /api\n Server->>DB: SELECT\n DB-->>Server: rows\n Server-->>Client: 200 JSON"),
|
|
387
|
+
"class": ("Class diagram", "classDiagram\n class Animal {\n +String name\n +makeSound()\n }\n class Dog {\n +fetch()\n }\n Animal <|-- Dog"),
|
|
388
|
+
"er": ("ER diagram", "erDiagram\n CUSTOMER ||--o{ ORDER : places\n ORDER ||--|{ ITEM : contains"),
|
|
389
|
+
"state": ("State diagram", "stateDiagram-v2\n [*] --> Idle\n Idle --> Running : start\n Running --> Done : complete\n Done --> [*]"),
|
|
390
|
+
"block": ("Block diagram", "block-beta\n columns 3\n Frontend API Database"),
|
|
391
|
+
"git": ("Git graph", "gitGraph\n commit\n branch develop\n commit\n commit\n checkout main\n merge develop\n commit"),
|
|
392
|
+
"pie": ("Pie chart", 'pie title Languages\n "Python" : 45\n "Go" : 30\n "Rust" : 25'),
|
|
393
|
+
"treemap": ("Treemap", 'treemap-beta\n "Backend"\n "API": 35\n "Auth": 15\n "Frontend"\n "React": 30\n "CSS": 10'),
|
|
394
|
+
"mindmap": ("Mindmap", "mindmap\n Project\n Design\n Wireframes\n Mockups\n Development\n Frontend\n Backend\n Testing"),
|
|
395
|
+
"timeline": ("Timeline", "timeline\n title Roadmap\n section Q1\n Research : Analysis\n Design : Wireframes\n section Q2\n Build : Frontend, Backend\n Launch : Beta"),
|
|
396
|
+
"kanban": ("Kanban", "kanban\n Todo\n Design homepage\n Fix login bug\n In Progress\n API integration\n Done\n Project setup"),
|
|
397
|
+
"quadrant": ("Quadrant chart", 'quadrantChart\n title Priority Matrix\n x-axis Low Effort --> High Effort\n y-axis Low Impact --> High Impact\n quadrant-1 Do First\n quadrant-2 Schedule\n quadrant-3 Delegate\n quadrant-4 Eliminate\n Task A: [0.3, 0.8]\n Task B: [0.8, 0.9]\n Task C: [0.2, 0.2]'),
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def _run_demo(args: argparse.Namespace) -> int:
|
|
402
|
+
"""Render sample diagrams."""
|
|
403
|
+
demo_type = args.demo.lower()
|
|
404
|
+
if demo_type == "all":
|
|
405
|
+
keys = list(_DEMO_SOURCES.keys())
|
|
406
|
+
elif demo_type in _DEMO_SOURCES:
|
|
407
|
+
keys = [demo_type]
|
|
408
|
+
else:
|
|
409
|
+
print(f"Unknown demo type: {demo_type}", file=sys.stderr)
|
|
410
|
+
print(f"Available: all, {', '.join(_DEMO_SOURCES.keys())}", file=sys.stderr)
|
|
411
|
+
return 1
|
|
412
|
+
|
|
413
|
+
use_color = _use_color(args)
|
|
414
|
+
|
|
415
|
+
for key in keys:
|
|
416
|
+
title, source = _DEMO_SOURCES[key]
|
|
417
|
+
print(f"=== {title} ===")
|
|
418
|
+
if use_color:
|
|
419
|
+
try:
|
|
420
|
+
from termaid import render_rich
|
|
421
|
+
from rich import print as rprint
|
|
422
|
+
rprint(render_rich(source, theme=args.theme or "default"))
|
|
423
|
+
except ImportError:
|
|
424
|
+
from termaid import render
|
|
425
|
+
print(render(source))
|
|
426
|
+
else:
|
|
427
|
+
from termaid import render
|
|
428
|
+
print(render(source))
|
|
429
|
+
print()
|
|
430
|
+
|
|
431
|
+
return 0
|
|
432
|
+
|
|
433
|
+
|
|
327
434
|
if __name__ == "__main__":
|
|
328
435
|
sys.exit(main())
|