zombie-mermaid 2.0.0 → 2.1.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.
- package/README.md +4 -1
- package/dist/ascii.cjs +4 -4
- package/dist/ascii.cjs.map +1 -1
- package/dist/ascii.js +89 -96
- package/dist/ascii.js.map +1 -1
- package/dist/cli.js +4286 -4214
- package/dist/index.cjs +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +646 -653
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +0 -7
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.js +0 -7
- package/dist/mcp.js.map +1 -1
- package/package.json +4 -1
- package/src/__tests__/cli-png.test.ts +35 -0
- package/src/__tests__/cli-render.test.ts +120 -0
- package/src/__tests__/cli-test-helpers.ts +23 -5
- package/src/__tests__/cli.test.ts +119 -1
- package/src/ascii/class-diagram.ts +0 -12
- package/src/cli/parse-args.ts +108 -45
- package/src/cli/png.ts +38 -0
- package/src/cli/render.ts +29 -6
- package/src/cli.ts +17 -7
package/README.md
CHANGED
|
@@ -136,6 +136,7 @@ zombie-mermaid render diagram.mmd -o out.svg # Same — the format is
|
|
|
136
136
|
zombie-mermaid render diagram.mmd --svg -o - | pbcopy # Write the SVG to stdout
|
|
137
137
|
zombie-mermaid render diagram.mmd --ascii -o out.txt # Write the ASCII rendering to a file
|
|
138
138
|
zombie-mermaid render diagram.mmd --html # Self-contained pan/zoom HTML viewer
|
|
139
|
+
zombie-mermaid render diagram.mmd --png # Rasterize to diagram.png
|
|
139
140
|
cat diagram.mmd | zombie-mermaid render --ascii # Read from stdin
|
|
140
141
|
zombie-mermaid themes # List built-in theme names
|
|
141
142
|
zombie-mermaid --help # Show all options
|
|
@@ -147,10 +148,12 @@ zombie-mermaid --help # Show all options
|
|
|
147
148
|
hyperlinks — off by default, since terminal and pager support varies (see
|
|
148
149
|
[ASCII terminal hyperlinks](docs/diagrams.md#ascii-terminal-hyperlinks)).
|
|
149
150
|
|
|
150
|
-
**Output rules.** `-o` is the destination for the run's _file_ output — SVG or
|
|
151
|
+
**Output rules.** `-o` is the destination for the run's _file_ output — SVG, HTML, or PNG when `--svg`/`--html`/`--png` is given, otherwise the ASCII rendering — and `-o -` sends it to stdout instead. A recognised extension (`.svg`, `.html`/`.htm`, `.txt`, `.png`) picks the format on its own, so the flag can be dropped; an extension that contradicts an explicit flag (`--svg -o out.txt`) is an error, while unrecognised ones are simply used as given. `--svg`/`--html`/`--png` with no `-o` writes `<input stem>.svg`/`.html`/`.png` beside the input (stdin input has no name to derive from, so it must pass `-o`). Only one of `--svg`/`--html`/`--png` can be set at a time — run the command twice for more than one. ASCII always prints to the terminal when one of them is also requested (`--ascii --svg -o out.svg`), and never carries ANSI colour codes when written to a file. **An existing output file is never overwritten unless you pass `--force`/`-f`.**
|
|
151
152
|
|
|
152
153
|
**`--html`** wraps the rendered SVG in a self-contained pan/zoom viewer — one file, no server, no network — with drag/scroll pan, ctrl/cmd+scroll and pinch to zoom, fit/1:1 buttons, a light/dark toggle that follows `prefers-color-scheme`, and keyboard controls. It opens straight from disk and survives being emailed as a single attachment. This is the one place in the project that ships client-side JavaScript, and deliberately so — see [`docs/decisions/no-script-interactivity.md`](docs/decisions/no-script-interactivity.md): the library's own SVG output stays permanently script-free, and this viewer is a separate CLI artifact wrapping that output, never part of it.
|
|
153
154
|
|
|
155
|
+
**`--png`** rasterizes the diagram for anywhere SVG isn't accepted — issue trackers, Slack, docs tools, email — at the SVG's own pixel dimensions (1:1, no scaling). It always resolves CSS colors first, automatically, the same substitution `--resolve-colors` does for `--svg` — a rasterizer can't evaluate `var()`/`color-mix()`, so skipping this would render the whole theme black. Rasterization is via [`@resvg/resvg-js`](https://github.com/thx/resvg-js), listed as an `optionalDependency`: a normal install pulls its native binary like any other dependency, but a platform it has no prebuilt binary for, or an install run with `--no-optional`, simply skips it — `--png` then fails with a clear error telling you how to install it explicitly, rather than breaking the rest of the CLI.
|
|
156
|
+
|
|
154
157
|
---
|
|
155
158
|
|
|
156
159
|
## MCP Server
|