@zombie-mermaid/ascii-renderer 2.2.1 → 3.0.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 +46 -0
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1245 -1203
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/src/__tests__/ascii-decision-lr-box-start.test.ts +1 -1
- package/src/__tests__/ascii-er-attribute-column-order-1134.test.ts +69 -0
- package/src/__tests__/ascii-er-corner-glyphs.test.ts +27 -4
- package/src/__tests__/ascii-er-relationship-label-corruption-350.test.ts +13 -3
- package/src/__tests__/ascii-er-relationship-overwrite.test.ts +107 -0
- package/src/__tests__/ascii-er-stray-connectors.test.ts +15 -9
- package/src/__tests__/ascii-sequence-activation.test.ts +171 -0
- package/src/__tests__/ascii-shape-diamond.test.ts +1 -1
- package/src/__tests__/ascii-shape-rounded.test.ts +1 -1
- package/src/__tests__/ascii-shapes-circle.test.ts +1 -1
- package/src/__tests__/ascii-shapes-hexagon.test.ts +1 -1
- package/src/__tests__/ascii-shapes-special.test.ts +35 -0
- package/src/__tests__/ascii-validate.test.ts +1 -42
- package/src/__tests__/ascii.test.ts +1 -1
- package/src/__tests__/testdata/ascii/er_attributes.txt +9 -9
- package/src/__tests__/testdata/ascii/er_identifying.txt +8 -8
- package/src/__tests__/testdata/unicode/er_attributes.txt +9 -9
- package/src/__tests__/testdata/unicode/er_identifying.txt +8 -8
- package/src/{validate.ts → __tests__/validate.ts} +3 -40
- package/src/draw-boxes.ts +14 -0
- package/src/er-diagram.ts +134 -31
- package/src/sequence.ts +87 -1
- package/src/shapes/index.ts +47 -5
- package/src/shapes/circle.ts +0 -31
- package/src/shapes/diamond.ts +0 -31
- package/src/shapes/hexagon.ts +0 -35
- package/src/shapes/rounded.ts +0 -31
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @zombie-mermaid/ascii-renderer
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@zombie-mermaid/ascii-renderer)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Render [Mermaid](https://mermaid.js.org/) diagrams to ASCII or Unicode box-drawing art — the standalone renderer behind [`zombie-mermaid`](https://www.npmjs.com/package/zombie-mermaid)'s `zombie-mermaid/ascii` entry point. Pure TypeScript, no DOM, no `elkjs`/SVG layout dependency — pull this in on its own when all you need is terminal output.
|
|
7
|
+
|
|
8
|
+
Supports flowcharts, state diagrams, sequence diagrams, class diagrams, ER diagrams, and XY charts.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @zombie-mermaid/ascii-renderer
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { renderMermaidASCII } from '@zombie-mermaid/ascii-renderer'
|
|
20
|
+
|
|
21
|
+
const ascii = renderMermaidASCII('graph LR\n A --> B')
|
|
22
|
+
console.log(ascii)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const text = 'graph LR\n A --> B'
|
|
27
|
+
|
|
28
|
+
renderMermaidASCII(text, {
|
|
29
|
+
useAscii: false, // true = plain ASCII (+,-,|,>), false = Unicode box-drawing (┌,─,│,►)
|
|
30
|
+
paddingX: 5,
|
|
31
|
+
paddingY: 5,
|
|
32
|
+
boxBorderPadding: 1,
|
|
33
|
+
colorMode: 'auto', // 'none' | 'auto' | 'ansi16' | 'ansi256' | 'truecolor' | 'html'
|
|
34
|
+
theme: {/* partial AsciiTheme override */},
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
See `AsciiRenderOptions` in [`src/index.ts`](src/index.ts) for the full option set (color mode, theme, hyperlinks, direction override, coordinate overlay).
|
|
39
|
+
|
|
40
|
+
## Relationship to `zombie-mermaid`
|
|
41
|
+
|
|
42
|
+
This package is one of the internal pieces `zombie-mermaid` is built from (alongside `@zombie-mermaid/core` and `@zombie-mermaid/mermaid-parser`, which stay internal-only). Installing `zombie-mermaid` and using `zombie-mermaid/ascii` pulls in the exact same renderer — reach for this package directly only when you specifically don't want the SVG-rendering half of the umbrella package.
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
MIT — see [LICENSE](LICENSE).
|