orz-markdown 1.0.0 → 1.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 +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins/attrs.d.ts.map +1 -1
- package/dist/plugins/attrs.js +10 -0
- package/dist/plugins/attrs.js.map +1 -1
- package/orz-markdown-skills/SKILL.md +175 -0
- package/orz-markdown-skills/assets/minimal.css +658 -0
- package/orz-markdown-skills/assets/template.html +182 -0
- package/orz-markdown-skills/references/block-ids.md +51 -0
- package/orz-markdown-skills/references/css-classes.md +218 -0
- package/orz-markdown-skills/references/syntax.md +439 -0
- package/orz-markdown-skills/references/themes.md +302 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -83,7 +83,19 @@ npm test
|
|
|
83
83
|
npm pack
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
The generated tarball is written to the repository root and includes `dist
|
|
86
|
+
The generated tarball is written to the repository root and includes `dist/`, `themes/`, and `orz-markdown-skills/`.
|
|
87
|
+
|
|
88
|
+
## Agent Skill
|
|
89
|
+
|
|
90
|
+
The package ships an Agent Skill that teaches AI coding agents how to render with orz-markdown, write `{{...}}` plugin and `:::` container syntax, set up display pages, and work with the bundled themes. It also documents the block-ID preservation rules agents must follow when editing documents that use stable `{{attrs[#blk-...]}}` heading ids.
|
|
91
|
+
|
|
92
|
+
In the installed package, the skill lives at a stable path:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
node_modules/orz-markdown/orz-markdown-skills/SKILL.md
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
with supporting files under `orz-markdown-skills/references/` and `orz-markdown-skills/assets/`. Point your agent tooling at that directory (e.g. copy or symlink it into your agent's skills folder).
|
|
87
99
|
|
|
88
100
|
## Official Plugins Bundled
|
|
89
101
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,aAAa,CAAC;AAkBrC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,QAAA,MAAM,EAAE,YAMN,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,aAAa,CAAC;AAkBrC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,QAAA,MAAM,EAAE,YAMN,CAAC;AAsIH,eAAe,EAAE,CAAC;AAClB,OAAO,EAAE,EAAE,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -132,10 +132,14 @@ md.use(markdown_it_katex_1.default, { enableMhchem: true });
|
|
|
132
132
|
// Custom dispatchers
|
|
133
133
|
md.block.ruler.after('blockquote', 'plugin_block_dispatcher', block_dispatcher_js_1.blockDispatcher, { alt: ['paragraph', 'reference', 'blockquote', 'list'] });
|
|
134
134
|
md.inline.ruler.after('escape', 'plugin_inline_dispatcher', inline_dispatcher_js_1.inlineDispatcher);
|
|
135
|
-
// Register plugins that need access to the md instance
|
|
135
|
+
// Register plugins that need access to the md instance.
|
|
136
|
+
// Order matters: attrs must register before toc so the `attrs_resolve` core
|
|
137
|
+
// rule runs before `toc_resolve` — TOC links must use the final heading ids,
|
|
138
|
+
// including custom ids set via {{attrs[#...]}} (which override the
|
|
139
|
+
// markdown-it-anchor slug).
|
|
136
140
|
(0, span_js_1.registerSpan)(md);
|
|
137
|
-
(0, toc_js_1.registerToc)(md);
|
|
138
141
|
(0, attrs_js_1.registerAttrs)(md);
|
|
142
|
+
(0, toc_js_1.registerToc)(md);
|
|
139
143
|
(0, markdown_include_js_1.registerMarkdownInclude)(md);
|
|
140
144
|
// Renderer for plugin_block tokens
|
|
141
145
|
md.renderer.rules['plugin_block'] = (tokens, idx, _options, env) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gCAA8B;AAC9B,8DAAqC;AACrC,4EAAwC;AACxC,kFAA8C;AAC9C,gFAA4C;AAC5C,4EAAwC;AACxC,wEAAoC;AACpC,sEAAkC;AAClC,sEAAkC;AAClC,sEAAkC;AAClC,oFAA+C;AAC/C,sFAAwD;AACxD,qEAA8D;AAC9D,uEAAgE;AAChE,+CAA8C;AAC9C,+CAAiD;AACjD,6CAA+C;AAC/C,iDAAmD;AACnD,uEAAwE;AACxE,6BAA2B;AAC3B,8BAA4B;AAC5B,8BAA4B;AAC5B,gCAA8B;AAC9B,gCA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CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CACnC,MAA0B,EAC1B,GAAW,EACX,QAA4B,EAC5B,GAAW,EACH,EAAE;IACV,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,GAAG,GAAG,IAAA,2BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC;IACtC,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,EAAE,GAAG,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,kBAAe,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attrs.d.ts","sourceRoot":"","sources":["../../src/plugins/attrs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAoB1C,wBAAgB,aAAa,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"attrs.d.ts","sourceRoot":"","sources":["../../src/plugins/attrs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAoB1C,wBAAgB,aAAa,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CAiDlD"}
|
package/dist/plugins/attrs.js
CHANGED
|
@@ -51,7 +51,17 @@ function registerAttrs(md) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
// Remove the marker token from inline children
|
|
54
|
+
const markerWasLast = j === children.length - 1;
|
|
54
55
|
children.splice(j, 1);
|
|
56
|
+
// `## Title {{attrs[#x]}}` would otherwise leave a trailing space in
|
|
57
|
+
// the heading text (and in TOC entries). Trim it when the marker was
|
|
58
|
+
// the last child, so removal leaves no whitespace artifact.
|
|
59
|
+
if (markerWasLast) {
|
|
60
|
+
const prevChild = children[j - 1];
|
|
61
|
+
if (prevChild && prevChild.type === 'text') {
|
|
62
|
+
prevChild.content = prevChild.content.replace(/\s+$/, '');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
55
65
|
j--;
|
|
56
66
|
}
|
|
57
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attrs.js","sourceRoot":"","sources":["../../src/plugins/attrs.ts"],"names":[],"mappings":";;AAoBA,
|
|
1
|
+
{"version":3,"file":"attrs.js","sourceRoot":"","sources":["../../src/plugins/attrs.ts"],"names":[],"mappings":";;AAoBA,sCAiDC;AApED,gDAA0C;AAE1C,SAAS,UAAU,CAAC,UAAkB;IACpC,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,uDAAuD;IACvD,MAAM,EAAE,GAAG,6DAA6D,CAAC;IACzE,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;aAAM,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;aAAM,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,aAAa,CAAC,EAAc;IAC1C,0EAA0E;IAC1E,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E,GAAG,CAAC,CAAC;wBAC9B,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,+CAA+C;gBAC/C,MAAM,aAAa,GAAG,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;gBAChD,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEtB,qEAAqE;gBACrE,qEAAqE;gBACrE,4DAA4D;gBAC5D,IAAI,aAAa,EAAE,CAAC;oBAClB,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBAClC,IAAI,SAAS,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;wBAC3C,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC5D,CAAC;gBACH,CAAC;gBACD,CAAC,EAAE,CAAC;YACN,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orz-markdown
|
|
3
|
+
description: "orz-markdown usage skill. Use this skill whenever you need to render markdown with this parser, write markdown that uses {{...}} custom plugin syntax (mermaid, qrcode, youtube, smiles, toc, span, emoji, attrs, space, yaml, nyml, or their aliases mm/qr/yt/sm/sp/em), use :::container syntax (success/info/warning/danger/spoil/tabs/tab/cols/col/left/right/center), set up a complete HTML page to display parser output, choose or import one of the 10 bundled CSS themes, or create a custom theme stylesheet. Also invoke when asked about .markdown-body class, prepareSources, browser runtime scripts for QR codes or tabs, or any KaTeX math syntax in this project. ALWAYS invoke before editing documents whose headings carry stable block IDs ({{attrs[#blk-...]}})."
|
|
4
|
+
compatibility:
|
|
5
|
+
runtime: "Node.js 20+, ESM"
|
|
6
|
+
package: "orz-markdown"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# orz-markdown
|
|
10
|
+
|
|
11
|
+
A deeply customized `markdown-it` instance with 10+ plugins, 9 official plugin bundles, and 10 ready-to-use CSS themes. All rendered HTML lives inside `<article class="markdown-body">`.
|
|
12
|
+
|
|
13
|
+
## Rendering (Node.js / ESM)
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import md from 'orz-markdown';
|
|
17
|
+
|
|
18
|
+
const html = md.render(markdownSource);
|
|
19
|
+
const page = `<article class="markdown-body">${html}</article>`;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Parser is configured with `html: true` — raw HTML in source is emitted verbatim. Sanitize untrusted content before rendering to avoid XSS.
|
|
23
|
+
|
|
24
|
+
### Remote URL includes
|
|
25
|
+
|
|
26
|
+
If the source contains `{{markdown https://...}}`:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import md, { prepareSources } from 'orz-markdown';
|
|
30
|
+
|
|
31
|
+
const resolved = await prepareSources(markdownSource);
|
|
32
|
+
const html = md.render(resolved, { markdownBasePath: '/local/base/path' });
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## HTML Page Requirements
|
|
38
|
+
|
|
39
|
+
Every page that displays parser output needs **all five** of these:
|
|
40
|
+
|
|
41
|
+
1. **Theme stylesheet** — one of the 10 bundled themes, or `assets/minimal.css`
|
|
42
|
+
2. **KaTeX CSS** — `https://cdn.jsdelivr.net/npm/katex@0.16.35/dist/katex.min.css`
|
|
43
|
+
3. **Highlight.js CSS** — match light/dark to the chosen theme
|
|
44
|
+
4. **Three CDN scripts** — Highlight.js, Mermaid.js, SmilesDrawer (loaded in body)
|
|
45
|
+
5. **Two inline scripts** — tabs initializer and QR code runtime (also in body)
|
|
46
|
+
|
|
47
|
+
**Use `assets/template.html`** — all CDN links, scripts, and the `.markdown-body` wrapper are pre-wired. Copy it and replace the `<!-- INSERT RENDERED HTML HERE -->` comment.
|
|
48
|
+
|
|
49
|
+
CDN URLs (pinned versions):
|
|
50
|
+
| Library | URL |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Highlight.js JS | `https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js` |
|
|
53
|
+
| Highlight.js light CSS | `.../styles/github.min.css` (same base URL) |
|
|
54
|
+
| Highlight.js dark CSS | `.../styles/atom-one-dark.min.css` |
|
|
55
|
+
| Mermaid.js | `https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js` |
|
|
56
|
+
| SmilesDrawer | `https://unpkg.com/smiles-drawer@1.0.10/dist/smiles-drawer.min.js` |
|
|
57
|
+
|
|
58
|
+
### Browser runtime API
|
|
59
|
+
|
|
60
|
+
For programmatic control after mounting HTML dynamically:
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
import { getBrowserRuntimeScript } from 'orz-markdown/runtime';
|
|
64
|
+
const script = document.createElement('script');
|
|
65
|
+
script.textContent = getBrowserRuntimeScript();
|
|
66
|
+
document.body.appendChild(script);
|
|
67
|
+
// or call directly: window.OrzMarkdownRuntime.init(rootElement)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Themes
|
|
73
|
+
|
|
74
|
+
Ten bundled themes — each auto-imports `common.css` (structural rules for tables, images, QR overlays, print).
|
|
75
|
+
|
|
76
|
+
| File | Style | Scheme |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `dark-elegant-1.css` | Cinzel headings · scholarly serif | Dark |
|
|
79
|
+
| `dark-elegant-2.css` | Dark elegant variant | Dark |
|
|
80
|
+
| `light-neat-1.css` | Figtree · clean modern sans | Light |
|
|
81
|
+
| `light-neat-2.css` | Light neat variant | Light |
|
|
82
|
+
| `beige-decent-1.css` | Warm beige · print-like prose | Light |
|
|
83
|
+
| `beige-decent-2.css` | Beige decent variant | Light |
|
|
84
|
+
| `light-academic-1.css` | Alegreya · justified scholarly prose | Light |
|
|
85
|
+
| `light-academic-2.css` | Light academic variant | Light |
|
|
86
|
+
| `light-playful-1.css` | Casual · personal blog | Light |
|
|
87
|
+
| `light-playful-2.css` | Light playful variant | Light |
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
// With bundler:
|
|
91
|
+
import 'orz-markdown/themes/light-neat-1.css';
|
|
92
|
+
|
|
93
|
+
// Plain HTML:
|
|
94
|
+
// <link rel="stylesheet" href="node_modules/orz-markdown/themes/light-neat-1.css">
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For custom themes start from `assets/minimal.css` (structural only, no decoration) and add your visual layer. See `references/themes.md` for the design token pattern, element checklist, and design guidelines. See `references/css-classes.md` for the full list of every CSS class the parser emits.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Plugin Syntax — Quick Reference
|
|
102
|
+
|
|
103
|
+
For complete examples and all options, read `references/syntax.md`.
|
|
104
|
+
|
|
105
|
+
### Custom plugins — `{{name[args] body}}`
|
|
106
|
+
|
|
107
|
+
Single-line: `{{name[args] body}}` — Multi-line: `{{name[args]\nbody\n}}` — both close with `}}`.
|
|
108
|
+
Escape with backslash: `\{{name}}` renders as literal `{{name}}`.
|
|
109
|
+
|
|
110
|
+
| Plugin | Alias | Quick example |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| **span** | `sp` | `{{sp[red] colored}}` · `{{sp[success] ✓ Done}}` |
|
|
113
|
+
| **emoji** | `em` | `{{emoji wave}}` · `{{em tada}}` |
|
|
114
|
+
| **space** | — | `{{space 4}}` → 4 × ` ` |
|
|
115
|
+
| **qrcode** | `qr` | `{{qr https://example.com}}` (click-to-expand SVG) |
|
|
116
|
+
| **youtube** | `yt` | `{{youtube dQw4w9WgXcQ}}` (responsive iframe) |
|
|
117
|
+
| **mermaid** | `mm` | `{{mm\ngraph LR\nA-->B\n}}` |
|
|
118
|
+
| **smiles** | `sm` | `{{smiles C1=CC=CC=C1}}` (chemical structure) |
|
|
119
|
+
| **toc** | — | `{{toc}}` or `{{toc 2,3}}` (heading levels) |
|
|
120
|
+
| **attrs** | — | `# Title{{attrs[id="hero"]}}` |
|
|
121
|
+
| **markdown** | `md`, `md-include` | `{{md ./path/to/file.md}}` |
|
|
122
|
+
| **yaml** | `yml` | `{{yaml\nkey: val\n}}` (invisible metadata) |
|
|
123
|
+
| **nyml** | — | `{{nyml\nkey: val\n}}` (parsed to JSON) |
|
|
124
|
+
|
|
125
|
+
### Containers — `::: name ... :::`
|
|
126
|
+
|
|
127
|
+
Space between `:::` and name is required. Nesting uses more colons on the outer level.
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
::: success ::: info ::: warning ::: danger
|
|
131
|
+
::: left ::: right ::: center
|
|
132
|
+
::: left 30% (optional CSS width arg — only on `left`)
|
|
133
|
+
::: spoil My Title ::: my-class-name (arbitrary class)
|
|
134
|
+
|
|
135
|
+
:::: tabs (outer: 4 colons)
|
|
136
|
+
::: tab Label One (inner: 3 colons)
|
|
137
|
+
:::
|
|
138
|
+
::: tab Label Two
|
|
139
|
+
:::
|
|
140
|
+
::::
|
|
141
|
+
|
|
142
|
+
:::: cols (equal-width columns)
|
|
143
|
+
:::: cols 1 2 1 (ratio: numbers → fr units, or any CSS length)
|
|
144
|
+
::: col
|
|
145
|
+
:::
|
|
146
|
+
::::
|
|
147
|
+
|
|
148
|
+
:::: outer (nesting: outer uses more colons than inner)
|
|
149
|
+
::: inner
|
|
150
|
+
:::
|
|
151
|
+
::::
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Stable Block IDs — editing rules
|
|
157
|
+
|
|
158
|
+
Documents may carry stable block IDs on headings: `## Title{{attrs[#blk-abc12345]}}` (canonical form: no space before the marker). These IDs are the block's permanent identity for the host application.
|
|
159
|
+
|
|
160
|
+
**The non-negotiables:** IDs are immutable — when editing or rewriting a section, preserve its `{{attrs[#blk-...]}}` marker exactly, even if you rewrite the heading text completely. Never reuse, invent, regenerate, or duplicate an ID, and never convert to or from Pandoc `{#id}` syntax (unsupported; corrupts the heading).
|
|
161
|
+
|
|
162
|
+
**Before any edit to a document containing `{{attrs[#blk-...]}}`, read `references/block-ids.md`** — it has the full rules and a pre-save checklist.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Reference Files
|
|
167
|
+
|
|
168
|
+
| File | When to read |
|
|
169
|
+
|---|---|
|
|
170
|
+
| `references/syntax.md` | Full syntax with examples for every plugin, container, and extended markdown feature |
|
|
171
|
+
| `references/block-ids.md` | Stable block-ID preservation rules — REQUIRED reading before editing documents that use `{{attrs[#blk-...]}}` |
|
|
172
|
+
| `references/themes.md` | Custom theme guide: design tokens, element checklist, 10 design guidelines |
|
|
173
|
+
| `references/css-classes.md` | Every CSS class and HTML element the parser emits — the spec for theme authors |
|
|
174
|
+
| `assets/template.html` | Ready-to-use HTML page template with all scripts and CDN links wired up |
|
|
175
|
+
| `assets/minimal.css` | Structural-only stylesheet — starting point for custom themes |
|