figdown 0.4.0 → 0.5.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/.claude-plugin/plugin.json +1 -1
- package/dist/README.md +85 -0
- package/dist/figdown.js +3756 -361
- package/dist/figdown.mjs +3756 -361
- package/examples/evpn-fabric.svg +1 -1
- package/examples/showcase/arp-resolution.svg +1 -1
- package/examples/showcase/ethernet-frame.svg +1 -1
- package/examples/showcase/l2-forwarding-logic.svg +1 -1
- package/examples/showcase/tcp-handshake.svg +1 -1
- package/examples/showcase/tcp-header.svg +1 -1
- package/examples/showcase/tcp-state-machine.svg +53 -24
- package/guide/expressing.md +25 -0
- package/guide/showcase.md +12 -12
- package/integrations/mcp-server/server.js +50 -4
- package/package.json +4 -2
- package/skill/README.md +130 -0
- package/skill/figdown/SKILL.md +49 -9
- package/skill/figdown/figdown.html +6408 -856
- package/skill/figdown/reference/experimental/flowchart.md +23 -0
- package/skill/figdown/reference/experimental/sequence.md +28 -0
- package/skill/figdown/reference/experimental/statechart.md +29 -0
- package/skill/figdown/reference/experimental/topology.md +42 -0
- package/skill/figdown/reference/scene.md +23 -0
- package/skill/figdown/reference/transcribe.md +4 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
|
|
3
3
|
"name": "figdown",
|
|
4
4
|
"displayName": "FigDown",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.5.0",
|
|
6
6
|
"description": "A missing edge still looks fine. Text doesn't. FigDown keeps figures as text whose source states the meaning: participants, containment, field widths, table structure. The next reader can check it, not just look at it. Deterministic SVG, embedded in your Markdown — block diagrams, topologies, flowcharts, bit-level layouts, tables, timing waveforms.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "FigDown",
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# FigDown embeddable library
|
|
2
|
+
|
|
3
|
+
Generated builds — do not edit; regenerate with `node tools/make-lib.js`
|
|
4
|
+
(single engine source: `editor/figdown.html`).
|
|
5
|
+
|
|
6
|
+
- `figdown.mjs` — ESM
|
|
7
|
+
- `figdown.js` — UMD (CommonJS `require` or script tag → `globalThis.figdown`)
|
|
8
|
+
|
|
9
|
+
No dependencies, no DOM needed; works in Node and browsers.
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
- `parse(text)` → `{ doc, errors }` — `errors` is an array of
|
|
14
|
+
`"Line N: message"` strings (empty on success).
|
|
15
|
+
- `render(text)` → `{ svg, errors }` — `svg` is `null` whenever there are
|
|
16
|
+
errors (determinism over convenience: no partial renders).
|
|
17
|
+
- `renderDoc(doc)` → SVG string, for an already-validated `doc` from `parse`.
|
|
18
|
+
- `artifact(text)` → `{ svg, errors }` — the self-carrying artifact: the
|
|
19
|
+
rendered SVG plus a
|
|
20
|
+
`<metadata id="figdown-source" data-sha256="…" data-engine-version="…">`
|
|
21
|
+
block embedding the source text, the SHA-256 **of that source**, and the
|
|
22
|
+
version string of the engine that rendered it — the same convention as
|
|
23
|
+
`tools/build-svg.js` (spec core §7). Synchronous and dependency-free
|
|
24
|
+
(bundled minimal SHA-256). `svg` is `null` on errors.
|
|
25
|
+
- `version` — the **release version** of the engine in this build, the string
|
|
26
|
+
the artifact records in `data-engine-version` (spec core §13.0); reproducing
|
|
27
|
+
an artifact needs both it and the source (`RENDERING-DETERMINISM`).
|
|
28
|
+
|
|
29
|
+
## The version numbers, and which is which
|
|
30
|
+
|
|
31
|
+
Spec core §13.0 defines **two** version numbers, and neither of them is a
|
|
32
|
+
property of this directory:
|
|
33
|
+
|
|
34
|
+
- **`figdown X.Y`** versions the **language**. It is written in the `figdown`
|
|
35
|
+
header line of a `.fd` document and nowhere else. No API here returns it.
|
|
36
|
+
- **`vX.Y.Z`** versions the **release** — this repository and its engine. It
|
|
37
|
+
is written in the git tag, in `package.json`, and in the
|
|
38
|
+
`data-engine-version` attribute of every artifact. `require('figdown').version`
|
|
39
|
+
returns that string.
|
|
40
|
+
|
|
41
|
+
So the two strings a consumer can see — `require('figdown').version` and
|
|
42
|
+
`package.json`'s `"version"` — are **the same number**, and until `v0.1.0` is
|
|
43
|
+
tagged they are two different *pre-release spellings* of it: the engine
|
|
44
|
+
carries the dated pre-release increment it was built from, and `package.json`
|
|
45
|
+
carries the **npm pin** that names one published tarball, spelled
|
|
46
|
+
`X.Y.Z-rc.N` while the release is a candidate. They converge at `v0.1.0`. The
|
|
47
|
+
pin itself is **not restated here** — read it from `package.json`, which is
|
|
48
|
+
its one home: a version burned on npm can never be republished, so the pin
|
|
49
|
+
advances on every publish whether or not the engine moved, and a copy of it in
|
|
50
|
+
prose is stale by the next one.
|
|
51
|
+
`make-lib.js` reads the engine version out of the engine region, so there is
|
|
52
|
+
no second copy of it to keep in step; the npm pin is edited by hand, and only
|
|
53
|
+
when a release is published.
|
|
54
|
+
|
|
55
|
+
## This directory is GATED
|
|
56
|
+
|
|
57
|
+
`node tools/dist-check.js --strict` (`npm run gate:dist`) requires that
|
|
58
|
+
regenerating these files is a byte-level no-op, that both builds report the
|
|
59
|
+
engine's own version, that both load and produce identical SVG, and that every
|
|
60
|
+
published `.fd` parses through `dist/figdown.js` with the same error set as the
|
|
61
|
+
reference engine. Until 0.1 nothing in the repository read `dist/` at
|
|
62
|
+
all, and a published tarball shipped a build of an older engine that rejected
|
|
63
|
+
`index=` — a frozen key — and refused `examples/srh.fd`. Run the gate before
|
|
64
|
+
publishing.
|
|
65
|
+
|
|
66
|
+
## Integration example
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
// ESM
|
|
70
|
+
import { render, artifact } from './figdown.mjs';
|
|
71
|
+
const { svg, errors } = render(source);
|
|
72
|
+
if (errors.length) console.error(errors.join('\n'));
|
|
73
|
+
else element.innerHTML = svg;
|
|
74
|
+
|
|
75
|
+
// To save a file that carries its own source (round-trippable):
|
|
76
|
+
const art = artifact(source).svg;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<!-- UMD script tag / CDN -->
|
|
81
|
+
<script src="figdown.js"></script>
|
|
82
|
+
<script>
|
|
83
|
+
const { svg, errors } = figdown.render(source);
|
|
84
|
+
</script>
|
|
85
|
+
```
|