Add Mermaid diagram rendering to kitty-image#1
Merged
Conversation
Render a Mermaid definition to a PNG and display it inline, reusing show.py for the display half. Local-first for privacy: uses `mmdc` if present, else `npx -p @mermaid-js/mermaid-cli mmdc` pointed at an already-installed Chrome (no Puppeteer Chromium download). The diagram text never leaves the machine unless `--remote` is passed, which renders via the public mermaid.ink service (pako-encoded envelope, dark theme). - New skills/kitty-image/mermaid.py: .mmd or stdin input; --theme/--bg/--scale/ --out/--no-show/--pts flags; dedicated exit codes 10-13. URL-encodes remote query params and guards output writes against uncaught errors. - SKILL.md: mermaid triggering, a "Mermaid workflow diagrams" section, and an exit-code table (also documents the pre-existing show.py code 6). - README: mermaid usage section and optional-dependency note. - plugin.json -> 0.2.0 + keywords; CHANGELOG [0.2.0]; CI now compiles mermaid.py. - Design spec under docs/superpowers/specs/. Every renderer assumption was verified empirically (which corrected two stale upstream doc claims), and the new script passed an adversarial multi-lens review with per-finding verification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds first-class Mermaid support to the
kitty-imageskill: turn a Mermaid definition (flowchart, sequence, state, workflow, …) into an inline terminal image.What's new
mermaid.py— renders a Mermaid definition to PNG, then hands off toshow.pyfor display. Reads a.mmdfile or stdin (-).mmdcif onPATH, elsenpx -p @mermaid-js/mermaid-cli mmdcpointed at an already-installed Chrome (no Puppeteer Chromium download). The diagram text never leaves the machine unless--remoteis passed (renders via mermaid.ink, pako envelope).--theme dark,--bg #10121a,--scale 2) match the existing Pillow chart aesthetic. Exit codes 10–13.SKILL.mdtriggering + section + exit-code table,README.mdsection,plugin.json→0.2.0,CHANGELOG[0.2.0], CI now compilesmermaid.py, and a design spec underdocs/.Verification
PUPPETEER_EXECUTABLE_PATHdoes work).