Skip to content

termaid 0.11.0

Choose a tag to compare

@fasouto fasouto released this 05 Nov 23:05
· 22 commits to main since this release

New

  • Colored output: classDef and style now color a node's label with color:, as in Mermaid (stroke: colors the border). Labels without color: keep the theme's label style. In --format styled-json such a label carries the new key class:<name>:text or nodestyle:<id>:text instead of label
  • Flowchart: <br>, <br/> and <br /> break a node label into lines, as in Mermaid

Behavior changes

  • Flowchart LR/RL: nodes stacked in the same column keep the height of their own label instead of all growing to the tallest one, as in Mermaid. Diagrams with a mix of short and long labels get much shorter

Fixes

  • Class and ER diagrams: a relationship label or cardinality right of the rightmost box is drawn in full. Since 0.9.0, a label hanging beside a vertical line could be cut at the right edge (ordered i for ordered in)
  • Flowchart and state diagrams: an edge label first looks for a spot that covers no other edge's line, and may share a row with another label at least three columns away. Before, it fell back to writing over whatever was there, which cut lines (fail┼), hid arrowheads and put labels inside node boxes (│data │)
  • Flowchart: a ; inside a %% comment line no longer splits the comment, so the text after it isn't parsed as nodes and edges
  • Flowchart: unlabeled edges leaving one node branch off one shared line instead of staggered lanes that crossed each other, so fan-outs are shorter (a node with five children is as tall as one with a single child). A three-way split draws as ┴┬, since ┼ reads as two lines crossing. An edge into a node that other edges also enter keeps its own route, so a fan-out never joins a fan-in into one line. Labeled edges keep a lane each so every label stays on its own segment
  • Flowchart: with gap below 4, an edge that turned just before its target drew its sideways run on the same line as the arrowheads (▼────▼). The gap in front of such a target is now at least three cells deep
  • Sequence: a message label keeps its spaces where it crosses another participant's lifeline, so the lifeline no longer shows through a gap between two words (no opening┆hours)
  • gitGraph: a merge commit without id: has no label, as in Mermaid. Before, it showed a number such as 0 that matched no commit
  • gitGraph: a written id such as id: "1" no longer collides with the numbers given to commits without an id, which made one of the two commits disappear. A commit without an id, or a cherry-picked commit, can no longer be referenced by the label it shows (cherry-pick id: "0", cherry-pick id: "B-cherry", reset 0), as in Mermaid, where such ids are random. In the Python model (parse_git_graph), such commits now have a quoted id such as "0", and Commit.label holds the text drawn
  • gitGraph TB and BT: a label, tag or branch name wider than the space left of the first branch is no longer cut off (elease for release)
  • Block diagrams: groups nested many levels deep render in milliseconds. Each level sized its children twice, so every level doubled the work and 20 levels took 1.5 seconds
  • Block diagrams: a grid is capped at 64 columns, already wider than any terminal, and so is a block's :N span and space:N. A grid with no columns line whose spans add up past 64 wraps into rows. A diagram that would still need more than a million characters, such as dozens of nested 64-column groups, is refused with an error. columns 1000000 took 9 seconds and over 3 GB of memory to draw a single block (#15)
  • Control characters in diagram text, such as ESC or a raw carriage return, no longer reach a drawn diagram (tabs are kept). The source is filtered before parsing (#19, thanks @TheeCoderAhmed). A flowchart entity code such as #13; that decodes to a control character becomes a space if it is whitespace and is dropped otherwise. A control character written as a JSON escape in a gitGraph %%{init}%% branch name is dropped too (#16)
  • A %%{init: ...}%% directive or a %% comment line before the diagram keyword no longer turns a sequence, class or other diagram into one flowchart box. Type detection skips them, including a directive that spans several lines, and gitGraph still reads mainBranchName from its directive. A byte order mark at the start of a file is ignored too
  • --show-ids works when a directive, a %% comment or frontmatter comes before graph. Before, it drew the first line as a node or dropped the ids
  • gitGraph: a %%{init}%% whose gitGraph value is not an object, or whose JSON nests thousands of levels deep, is ignored instead of crashing the render
  • Claude Code hook: on Linux and macOS, the state kept between streaming batches lives in a folder only you can open (termaid-claude-hook-<uid> in the temp folder, mode 700, files 600). If that folder exists but another user could open it, or it is a symlink, the hook leaves the reply as Claude wrote it instead of using the folder (#17)
  • Claude Code hook: a Mermaid block that never closes no longer hides the rest of the reply. Once the held text passes 8,192 characters (line breaks count), a few hundred typical lines, it is shown as written and the state saved between batches stops growing. A diagram larger than that now shows as its source in Claude Code instead of being drawn; termaid itself still draws it (#18)
  • Pie: pie title Pets adopted by volunteers, the form in Mermaid's docs, keeps its title. Before, only a title on its own line was read
  • Pie: the row under the stacked bar names every slice or none of them. When a name does not fit, the row shows only percentages, and the bars below name each slice. Before, one slice could get its name and the others only 33%
  • Pie: CJK and emoji slice names are no longer cut short in front of their bars, and a title wider than the chart is no longer cut off
  • Pie: every slice gets at least one cell in the stacked bar, which grows past 40 cells when there are more slices than that. Before, a small last slice could get none (97/1/2), and many small slices ran the bar past its width or off the chart. A value too large for a float is skipped instead of crashing
  • Treemap: a small box is at least as wide as its label, so the README example draws Auth instead of Au…. Since 0.2.0 a box could shrink to 4 cells whatever its label
  • Claude Code plugin: asking Claude for a diagram shows it once. The /termaid:mermaid skill told Claude to run termaid on diagrams it wrote itself, which the hook already draws, so a second and often wider copy followed. The skill is now for diagrams that already exist (files, READMEs, PR descriptions) and passes --width, since the Bash tool can't see the terminal's width