zombie-mermaid 5.7.1 → 5.8.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 +2 -1
- package/dist/ascii-layout.cjs +1 -0
- package/dist/ascii-layout.d.cts +36 -0
- package/dist/ascii-layout.d.ts +36 -0
- package/dist/ascii-layout.js +31 -0
- package/dist/cli.js +202 -160
- package/dist/src-BRkxY4xp.js +439 -0
- package/dist/src-CsMv6Ia1.js +430 -0
- package/dist/src-CvLXAGlZ.js +431 -0
- package/dist/src-D4LsWkIk.cjs +1 -0
- package/dist/src-MFjqatSR.js +438 -0
- package/dist/src-pkQWSY51.cjs +2 -0
- package/package.json +35 -11
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Ultra-fast, fully themeable, zero DOM dependencies. A maintained fork of [`beaut
|
|
|
30
30
|
|
|
31
31
|
`beautiful-mermaid` is a genuinely good library — fast, beautiful, and works everywhere from rich UIs to plain terminals. Checkable facts, as of 2026-10-13: the last push to upstream's `main` was 2026-05-06 and its latest release is v1.1.2 (2026-02-26); it has [43 open pull requests](https://github.com/lukilabs/beautiful-mermaid/pulls) (19 opened before 2026-04-13) and [50 open issues](https://github.com/lukilabs/beautiful-mermaid/issues) (live counts at those links; the figures above are a dated snapshot). I maintain `zombie-mermaid` as the fork that won't stay buried: pulling in upstream fixes, giving PRs stuck in the upstream queue a home, and actually shipping releases. Craft and Craft Agents aren't part of this project's process going forward; this is an independently maintained continuation.
|
|
32
32
|
|
|
33
|
-
This isn't just a claim — see **[what this fork fixes](https://dfadler.github.io/zombie-mermaid/fork-fixes.html)** for an evidence-based before/after showcase (
|
|
33
|
+
This isn't just a claim — see **[what this fork fixes](https://dfadler.github.io/zombie-mermaid/fork-fixes.html)** for an evidence-based before/after showcase (51 fixes): every bug listed there is rendered by the actual pre-fix and post-fix code, not described from memory.
|
|
34
34
|
|
|
35
35
|
It's still MIT-licensed, still built on the same foundation, and still credits the original authors — including the ASCII rendering engine's origins — in [Attribution](#attribution) below.
|
|
36
36
|
|
|
@@ -224,6 +224,7 @@ zombie-mermaid --help # Show all options
|
|
|
224
224
|
hyperlinks — off by default, since terminal and pager support varies (see
|
|
225
225
|
[ASCII terminal hyperlinks](docs/diagrams.md#ascii-terminal-hyperlinks)).
|
|
226
226
|
`--profile markdown` (with `--ascii`) emits plain ASCII characters with no color, for pasting into issues, commits and fenced blocks (the `profile` option in the library and the MCP `render_mermaid_ascii` tool).
|
|
227
|
+
`--layout mermaid` (with `--ascii`, opt-in) draws a flowchart from mermaid's own ELK layout instead of the grid renderer; the library equivalent is `renderMermaidASCIIWithLayout` from `zombie-mermaid/ascii-layout`. It needs the optional peer `elkjs-0.9.3` (`pnpm add elkjs-0.9.3@npm:elkjs@0.9.3`), which is loaded only when the flag is used. Diagrams with subgraphs or unmodelled shapes, non-flowchart diagrams, layout failures, and drawings that cannot fit 120 columns (`--layout mermaid-wide` / `maxCols: Infinity` keeps the wide text) fall back to the default renderer, and stderr (or the result's `fallbackReason`) says which one ran. Merged parallel edges hide edge multiplicity; results depend on mermaid 12.1.0 and elkjs 0.9.3. Not available in the MCP tool. See [known differences](docs/known-differences.md#ascii-opt-in-layout-faithful-mode---layout-mermaid).
|
|
227
228
|
|
|
228
229
|
**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`.**
|
|
229
230
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@zombie-mermaid/ascii-renderer"),t=require("@zombie-mermaid/core");async function n(n,r={}){let{layout:i,maxCols:a,...o}=r,s=t=>({text:(0,e.renderMermaidASCII)(n,o),path:`standard`,...t===void 0?{}:{fallbackReason:t}});if(i!==`mermaid`)return s();let c=(0,t.detectDiagramType)(n);if(c!==`flowchart`)return s(`not applicable to ${c} diagrams (flowcharts only)`);let l,u;try{[l,u]=await Promise.all([Promise.resolve().then(()=>require("./src-D4LsWkIk.cjs")),Promise.resolve().then(()=>require("./src-pkQWSY51.cjs"))])}catch{return s(`elkjs 0.9.3 is not installed (pnpm add elkjs-0.9.3@npm:elkjs@0.9.3)`)}try{let e=await u.renderFlowchartAscii(n,a===void 0?void 0:{maxCols:a});return e.capped?{text:e.text,path:`layout-faithful`,note:e.note}:s(`layout-faithful output is ${e.stats.naturalCols} columns, over the ${a??u.DEFAULT_MAX_COLS}-column cap`)}catch(e){return e instanceof l.UnsupportedFlowchartError?s(`unsupported (${e.reasons.join(`; `)})`):s(`layout failed (${e instanceof Error?e.message:String(e)})`)}}exports.renderMermaidASCIIWithLayout=n;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AsciiRenderOptions } from '@zombie-mermaid/ascii-renderer';
|
|
2
|
+
|
|
3
|
+
/** Value of the `layout` option / `--layout` flag. `'standard'` is the default grid renderer. */
|
|
4
|
+
export declare type AsciiLayoutMode = 'mermaid' | 'standard';
|
|
5
|
+
|
|
6
|
+
export declare interface AsciiLayoutResult {
|
|
7
|
+
text: string;
|
|
8
|
+
/** Which renderer produced `text`. */
|
|
9
|
+
path: 'layout-faithful' | 'standard';
|
|
10
|
+
/** Why the standard renderer ran although `layout: 'mermaid'` was requested. */
|
|
11
|
+
fallbackReason?: string;
|
|
12
|
+
/** Caveat to show with layout-faithful output (merged parallel edges). */
|
|
13
|
+
note?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Render ASCII, optionally from mermaid's ELK layout (`layout: 'mermaid'`).
|
|
18
|
+
*
|
|
19
|
+
* Layout-faithful covers flat flowcharts only; anything else (subgraphs, unmodelled shapes,
|
|
20
|
+
* other diagram types, a layout failure, elkjs 0.9.3 not installed) falls back to the standard
|
|
21
|
+
* renderer and says so in `fallbackReason`. Layout-faithful output is plain text drawn on its
|
|
22
|
+
* own grid, so spacing/color/profile options apply only to the fallback. A drawing that cannot
|
|
23
|
+
* fit the width cap (`maxCols`, default 120) also falls back; pass `maxCols: Infinity` to get the
|
|
24
|
+
* wide layout-faithful text instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare function renderMermaidASCIIWithLayout(text: string, options?: AsciiRenderOptions & {
|
|
27
|
+
layout?: AsciiLayoutMode;
|
|
28
|
+
/**
|
|
29
|
+
* Width cap for the layout-faithful drawing (default 120). The rasterizer shrinks blank gaps
|
|
30
|
+
* to fit; when the boxes alone are wider, the standard renderer runs instead (with
|
|
31
|
+
* `fallbackReason`). `Infinity` disables the cap: the wide layout-faithful text is returned.
|
|
32
|
+
*/
|
|
33
|
+
maxCols?: number;
|
|
34
|
+
}): Promise<AsciiLayoutResult>;
|
|
35
|
+
|
|
36
|
+
export { }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AsciiRenderOptions } from '@zombie-mermaid/ascii-renderer';
|
|
2
|
+
|
|
3
|
+
/** Value of the `layout` option / `--layout` flag. `'standard'` is the default grid renderer. */
|
|
4
|
+
export declare type AsciiLayoutMode = 'mermaid' | 'standard';
|
|
5
|
+
|
|
6
|
+
export declare interface AsciiLayoutResult {
|
|
7
|
+
text: string;
|
|
8
|
+
/** Which renderer produced `text`. */
|
|
9
|
+
path: 'layout-faithful' | 'standard';
|
|
10
|
+
/** Why the standard renderer ran although `layout: 'mermaid'` was requested. */
|
|
11
|
+
fallbackReason?: string;
|
|
12
|
+
/** Caveat to show with layout-faithful output (merged parallel edges). */
|
|
13
|
+
note?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Render ASCII, optionally from mermaid's ELK layout (`layout: 'mermaid'`).
|
|
18
|
+
*
|
|
19
|
+
* Layout-faithful covers flat flowcharts only; anything else (subgraphs, unmodelled shapes,
|
|
20
|
+
* other diagram types, a layout failure, elkjs 0.9.3 not installed) falls back to the standard
|
|
21
|
+
* renderer and says so in `fallbackReason`. Layout-faithful output is plain text drawn on its
|
|
22
|
+
* own grid, so spacing/color/profile options apply only to the fallback. A drawing that cannot
|
|
23
|
+
* fit the width cap (`maxCols`, default 120) also falls back; pass `maxCols: Infinity` to get the
|
|
24
|
+
* wide layout-faithful text instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare function renderMermaidASCIIWithLayout(text: string, options?: AsciiRenderOptions & {
|
|
27
|
+
layout?: AsciiLayoutMode;
|
|
28
|
+
/**
|
|
29
|
+
* Width cap for the layout-faithful drawing (default 120). The rasterizer shrinks blank gaps
|
|
30
|
+
* to fit; when the boxes alone are wider, the standard renderer runs instead (with
|
|
31
|
+
* `fallbackReason`). `Infinity` disables the cap: the wide layout-faithful text is returned.
|
|
32
|
+
*/
|
|
33
|
+
maxCols?: number;
|
|
34
|
+
}): Promise<AsciiLayoutResult>;
|
|
35
|
+
|
|
36
|
+
export { }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { renderMermaidASCII as e } from "@zombie-mermaid/ascii-renderer";
|
|
2
|
+
import { detectDiagramType as t } from "@zombie-mermaid/core";
|
|
3
|
+
//#region src/ascii-layout.ts
|
|
4
|
+
async function n(n, r = {}) {
|
|
5
|
+
let { layout: i, maxCols: a, ...o } = r, s = (t) => ({
|
|
6
|
+
text: e(n, o),
|
|
7
|
+
path: "standard",
|
|
8
|
+
...t === void 0 ? {} : { fallbackReason: t }
|
|
9
|
+
});
|
|
10
|
+
if (i !== "mermaid") return s();
|
|
11
|
+
let c = t(n);
|
|
12
|
+
if (c !== "flowchart") return s(`not applicable to ${c} diagrams (flowcharts only)`);
|
|
13
|
+
let l, u;
|
|
14
|
+
try {
|
|
15
|
+
[l, u] = await Promise.all([import("./src-CsMv6Ia1.js"), import("./src-MFjqatSR.js")]);
|
|
16
|
+
} catch {
|
|
17
|
+
return s("elkjs 0.9.3 is not installed (pnpm add elkjs-0.9.3@npm:elkjs@0.9.3)");
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
let e = await u.renderFlowchartAscii(n, a === void 0 ? void 0 : { maxCols: a });
|
|
21
|
+
return e.capped ? {
|
|
22
|
+
text: e.text,
|
|
23
|
+
path: "layout-faithful",
|
|
24
|
+
note: e.note
|
|
25
|
+
} : s(`layout-faithful output is ${e.stats.naturalCols} columns, over the ${a ?? u.DEFAULT_MAX_COLS}-column cap`);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return e instanceof l.UnsupportedFlowchartError ? s(`unsupported (${e.reasons.join("; ")})`) : s(`layout failed (${e instanceof Error ? e.message : String(e)})`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { n as renderMermaidASCIIWithLayout };
|