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
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
# Syntax Reference — orz-markdown
|
|
2
|
+
|
|
3
|
+
Complete syntax reference for all features. Covers standard markdown, official plugin extensions, containers, and all custom `{{...}}` plugins.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Markdown (CommonMark)
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
# H1 ## H2 ### H3 #### H4 ##### H5 ###### H6
|
|
11
|
+
|
|
12
|
+
**bold** *italic* ***bold italic***
|
|
13
|
+
`inline code`
|
|
14
|
+
[link text](https://url.com)
|
|
15
|
+
[link with title](https://url.com "Title")
|
|
16
|
+

|
|
17
|
+
 ← image sizing (markdown-it-imsize)
|
|
18
|
+
|
|
19
|
+
> blockquote
|
|
20
|
+
> > nested blockquote
|
|
21
|
+
|
|
22
|
+
- unordered item
|
|
23
|
+
* also unordered
|
|
24
|
+
1. ordered item
|
|
25
|
+
2. second item
|
|
26
|
+
|
|
27
|
+
--- (horizontal rule — also *** or ___)
|
|
28
|
+
|
|
29
|
+
indented code block
|
|
30
|
+
|
|
31
|
+
```language
|
|
32
|
+
fenced code block
|
|
33
|
+
```
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Extended Syntax (Official Plugins)
|
|
39
|
+
|
|
40
|
+
### Highlighting, Insert, Delete — `markdown-it-mark`, `markdown-it-ins`
|
|
41
|
+
|
|
42
|
+
```markdown
|
|
43
|
+
==highlighted text== → <mark>
|
|
44
|
+
++inserted text++ → <ins>
|
|
45
|
+
~~deleted text~~ → <s> (also ~~strikethrough~~)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Sub / Superscript — `markdown-it-sub`, `markdown-it-sup`
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
H~2~O → H₂O (subscript)
|
|
52
|
+
E = mc^2^ → E = mc² (superscript)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Task Lists — `markdown-it-task-lists`
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
- [x] Completed task
|
|
59
|
+
- [ ] Uncompleted task
|
|
60
|
+
- [x] Another done item
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Renders `<li class="task-list-item">` with `<input type="checkbox" class="task-list-item-checkbox">`.
|
|
64
|
+
|
|
65
|
+
### Footnotes — `markdown-it-footnote`
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
Here is a footnote reference[^1] and another[^note].
|
|
69
|
+
|
|
70
|
+
[^1]: First footnote text.
|
|
71
|
+
[^note]: Named footnote text.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### KaTeX Math — `@traptitech/markdown-it-katex`
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
Inline math: $E = mc^2$
|
|
78
|
+
|
|
79
|
+
Display (block) math:
|
|
80
|
+
$$
|
|
81
|
+
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
|
|
82
|
+
$$
|
|
83
|
+
|
|
84
|
+
mhchem chemistry (built-in extension):
|
|
85
|
+
$\ce{H2O}$
|
|
86
|
+
$\ce{Fe^{2+} + 2e- -> Fe}$
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Requires KaTeX CSS in the page head: `https://cdn.jsdelivr.net/npm/katex@0.16.35/dist/katex.min.css`
|
|
90
|
+
|
|
91
|
+
### Heading Anchors — `markdown-it-anchor`
|
|
92
|
+
|
|
93
|
+
Every heading automatically gets an `id` attribute and a `<a class="header-anchor">` permalink prepended inside it. No special syntax — it's automatic.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Containers — `::: name ... :::`
|
|
98
|
+
|
|
99
|
+
All containers use fenced colon syntax: `::: name` — **the space between `:::` and the name is required** (`:::name` without a space does not parse). Nesting is supported: the outer container must use more fence-colons than the inner (e.g. `::::` outer, `:::` inner).
|
|
100
|
+
|
|
101
|
+
### Semantic callouts
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
::: success
|
|
105
|
+
**Success!** The operation completed without errors.
|
|
106
|
+
:::
|
|
107
|
+
|
|
108
|
+
::: info
|
|
109
|
+
**Note:** Here is some important information.
|
|
110
|
+
:::
|
|
111
|
+
|
|
112
|
+
::: warning
|
|
113
|
+
**Warning:** This action cannot be undone.
|
|
114
|
+
:::
|
|
115
|
+
|
|
116
|
+
::: danger
|
|
117
|
+
**Error:** Authentication failed.
|
|
118
|
+
:::
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Renders `<div class="success|info|warning|danger">`. In themes, the first `**bold**` in the first paragraph is styled with the callout's accent color.
|
|
122
|
+
|
|
123
|
+
### Layout containers
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
::: left
|
|
127
|
+
Floats left. Text following in the source wraps on the right side.
|
|
128
|
+
:::
|
|
129
|
+
|
|
130
|
+
::: left 30%
|
|
131
|
+
Optional width argument sets both max-width and width.
|
|
132
|
+
Accepts any CSS length: %, px, em, rem, vw.
|
|
133
|
+
:::
|
|
134
|
+
|
|
135
|
+
::: right
|
|
136
|
+
Floats right.
|
|
137
|
+
:::
|
|
138
|
+
|
|
139
|
+
::: center
|
|
140
|
+
Centers horizontally (max 42rem).
|
|
141
|
+
:::
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Width argument is only supported on `left`. `right` and `center` have no argument.
|
|
145
|
+
|
|
146
|
+
### Spoiler (collapsible)
|
|
147
|
+
|
|
148
|
+
```markdown
|
|
149
|
+
::: spoil Click to reveal
|
|
150
|
+
Hidden content shown when the summary is clicked.
|
|
151
|
+
|
|
152
|
+
Can contain any markdown content.
|
|
153
|
+
:::
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The text after `::: spoil` becomes the `<summary>` label. Renders `<details class="spoil">`.
|
|
157
|
+
|
|
158
|
+
### Tabs
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
:::: tabs
|
|
162
|
+
::: tab JavaScript
|
|
163
|
+
```js
|
|
164
|
+
console.log("Hello");
|
|
165
|
+
```
|
|
166
|
+
:::
|
|
167
|
+
::: tab Python
|
|
168
|
+
```python
|
|
169
|
+
print("Hello")
|
|
170
|
+
```
|
|
171
|
+
:::
|
|
172
|
+
::::
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Outer fence uses four colons `::::`. Inner tab panes use three `:::`. The text after `::: tab` is the button label (set as `data-label` attribute). JavaScript initializes the tab bar — without JS all panels fall back to block display.
|
|
176
|
+
|
|
177
|
+
### Columns
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
:::: cols
|
|
181
|
+
::: col
|
|
182
|
+
Equal-width column one.
|
|
183
|
+
:::
|
|
184
|
+
::: col
|
|
185
|
+
Equal-width column two.
|
|
186
|
+
:::
|
|
187
|
+
::::
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Without arguments, all `col` children share equal width. Pass space-separated values to set column widths:
|
|
191
|
+
|
|
192
|
+
- **Plain numbers** → become `fr` units: `:::: cols 1 2` → `grid-template-columns: 1fr 2fr`
|
|
193
|
+
- **CSS lengths** → pass through as-is: `:::: cols 30% 70%` → `grid-template-columns: 30% 70%`
|
|
194
|
+
- Both forms can be mixed: `:::: cols 1fr 200px 2fr`
|
|
195
|
+
|
|
196
|
+
```markdown
|
|
197
|
+
:::: cols 1 2 1
|
|
198
|
+
::: col
|
|
199
|
+
One quarter.
|
|
200
|
+
:::
|
|
201
|
+
::: col
|
|
202
|
+
Two quarters.
|
|
203
|
+
:::
|
|
204
|
+
::: col
|
|
205
|
+
One quarter.
|
|
206
|
+
:::
|
|
207
|
+
::::
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The number of values should match the number of `col` children, but mismatches are handled by CSS grid rules.
|
|
211
|
+
|
|
212
|
+
### Nesting containers
|
|
213
|
+
|
|
214
|
+
Each nesting level requires an additional colon. The outermost container uses the most colons; each layer inside uses one fewer:
|
|
215
|
+
|
|
216
|
+
```markdown
|
|
217
|
+
:::: info
|
|
218
|
+
Outer info box.
|
|
219
|
+
|
|
220
|
+
::: warning
|
|
221
|
+
Nested warning inside the info box.
|
|
222
|
+
:::
|
|
223
|
+
|
|
224
|
+
Back to info content.
|
|
225
|
+
::::
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Three levels deep:
|
|
229
|
+
|
|
230
|
+
```markdown
|
|
231
|
+
::::: outer-class
|
|
232
|
+
:::: cols
|
|
233
|
+
::: col
|
|
234
|
+
Column A content.
|
|
235
|
+
:::
|
|
236
|
+
::: col
|
|
237
|
+
Column B content.
|
|
238
|
+
:::
|
|
239
|
+
::::
|
|
240
|
+
:::::
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Arbitrary class name
|
|
244
|
+
|
|
245
|
+
Any `::: name` that is not a reserved keyword becomes `<div class="name">`:
|
|
246
|
+
|
|
247
|
+
```markdown
|
|
248
|
+
::: my-card
|
|
249
|
+
Content inside a div with class="my-card".
|
|
250
|
+
:::
|
|
251
|
+
|
|
252
|
+
::: highlight-box
|
|
253
|
+
Use your own CSS to style arbitrary containers.
|
|
254
|
+
:::
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Custom Plugins — `{{name[args] body}}`
|
|
260
|
+
|
|
261
|
+
The unified plugin dispatch syntax. Both block and inline forms are supported.
|
|
262
|
+
|
|
263
|
+
**Inline:** `{{name[args] body}}`
|
|
264
|
+
**Block (multi-line):**
|
|
265
|
+
```
|
|
266
|
+
{{name[args]
|
|
267
|
+
body content
|
|
268
|
+
spanning lines
|
|
269
|
+
}}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Aliases:** most plugins have a short alias (e.g., `sp` = `span`, `yt` = `youtube`).
|
|
273
|
+
**Escaping:** `\{{name}}` renders as literal `{{name}}`.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
### span / sp — Inline colored or styled text
|
|
278
|
+
|
|
279
|
+
```markdown
|
|
280
|
+
{{sp[red] red text}}
|
|
281
|
+
{{sp[yellow] amber text}}
|
|
282
|
+
{{sp[green] green text}}
|
|
283
|
+
{{sp[blue] blue text}}
|
|
284
|
+
|
|
285
|
+
{{sp[success] ✓ Done}}
|
|
286
|
+
{{sp[info] ℹ Note}}
|
|
287
|
+
{{sp[warning] ⚠ Caution}}
|
|
288
|
+
{{sp[danger] ✗ Error}}
|
|
289
|
+
|
|
290
|
+
{{span[my-custom-class] any class name works}}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
The first argument (inside `[...]`) is used verbatim as the `class` attribute on a `<span>`. Built-in color classes: `red`, `yellow`, `green`, `blue`. Built-in badge classes: `success`, `info`, `warning`, `danger`. Any custom class name works — style it yourself in your theme.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
### emoji / em — Unicode emoji from name
|
|
298
|
+
|
|
299
|
+
```markdown
|
|
300
|
+
{{emoji wave}} → 👋
|
|
301
|
+
{{em smile}} → 😊
|
|
302
|
+
{{emoji tada}} → 🎉
|
|
303
|
+
{{em rocket}} → 🚀
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Uses `node-emoji` for name lookup. The emoji text alias (e.g., `wave`, `smile`) is resolved to the Unicode character at render time — no client-side library needed.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
### space — Inline horizontal whitespace
|
|
311
|
+
|
|
312
|
+
```markdown
|
|
313
|
+
{{space 4}} → (4 non-breaking spaces)
|
|
314
|
+
{{space 1}} →
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
### qrcode / qr — Inline QR code
|
|
320
|
+
|
|
321
|
+
```markdown
|
|
322
|
+
{{qr https://example.com}}
|
|
323
|
+
{{qrcode mailto:hello@example.com}}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Renders an inline SVG QR code inside `<span class="qrcode">`. The inline version is small; clicking it expands to a fullscreen overlay (requires the QR runtime script in the page). Requires a white background on the span — themes must set `background: #fff` on `.qrcode` so the SVG is readable on dark backgrounds.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
### youtube / yt — Responsive YouTube embed
|
|
331
|
+
|
|
332
|
+
```markdown
|
|
333
|
+
{{youtube dQw4w9WgXcQ}}
|
|
334
|
+
{{yt https://youtu.be/dQw4w9WgXcQ}}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Accepts a bare video ID or a full YouTube URL. Renders a `<div class="youtube-embed">` with a 16:9 padding-bottom responsive iframe wrapper. Iframes are never shown in print.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
### mermaid / mm — Diagram (client-side rendered)
|
|
342
|
+
|
|
343
|
+
```markdown
|
|
344
|
+
{{mermaid
|
|
345
|
+
graph LR
|
|
346
|
+
A[Start] --> B{Decision}
|
|
347
|
+
B -->|Yes| C[Result]
|
|
348
|
+
B -->|No| D[Other]
|
|
349
|
+
}}
|
|
350
|
+
|
|
351
|
+
{{mm
|
|
352
|
+
sequenceDiagram
|
|
353
|
+
Alice->>Bob: Hello Bob
|
|
354
|
+
Bob-->>Alice: Hi Alice
|
|
355
|
+
}}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Renders `<div class="mermaid">` containing the raw DSL text. Mermaid.js runs client-side and replaces the div with an SVG. Requires `mermaid.min.js` in the page. Supports all Mermaid diagram types: `graph`, `sequenceDiagram`, `flowchart`, `classDiagram`, `gantt`, `pie`, etc.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
### smiles / sm — Chemical structure (client-side rendered)
|
|
363
|
+
|
|
364
|
+
```markdown
|
|
365
|
+
{{smiles CCO}}
|
|
366
|
+
{{sm C1=CC=CC=C1}}
|
|
367
|
+
{{smiles
|
|
368
|
+
[Cu+2].[O-]S(=O)(=O)[O-]
|
|
369
|
+
}}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Renders `<div class="smiles-render"><canvas data-smiles="...">`. SmilesDrawer.js draws into the canvas element client-side. Requires `smiles-drawer.min.js` in the page. Pass SMILES notation strings — any valid SMILES formula works.
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
### toc — Table of contents
|
|
377
|
+
|
|
378
|
+
```markdown
|
|
379
|
+
{{toc}}
|
|
380
|
+
{{toc 2,3}}
|
|
381
|
+
{{toc 1,4}}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Auto-generates a `<nav class="toc">` from all headings in the document. Optional argument is a comma-separated level range (`min,max`), defaulting to all levels. Must appear after the headings it references in the source (or at the start — the parser makes a pass over the full document).
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
### attrs — Inject HTML attributes
|
|
389
|
+
|
|
390
|
+
```markdown
|
|
391
|
+
# My Section {{attrs[id="hero"]}}
|
|
392
|
+
# Another {{attrs[class="featured" data-x="y"]}}
|
|
393
|
+
|
|
394
|
+
A paragraph. {{attrs[style="color:red"]}}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Injects any HTML attributes onto the immediately preceding token (heading, paragraph, etc.). Accepts any valid HTML attribute syntax inside `[...]`.
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### markdown / md — Embed external file
|
|
402
|
+
|
|
403
|
+
```markdown
|
|
404
|
+
{{md ./path/to/other.md}}
|
|
405
|
+
{{markdown ../shared/footer.md}}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
Reads and inlines the content of a local markdown file at render time. Path is resolved relative to `markdownBasePath` (passed as the second argument to `md.render(source, { markdownBasePath })`). For remote URL includes, pre-process with `prepareSources()` first.
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
### yaml / yml — Invisible YAML metadata block
|
|
413
|
+
|
|
414
|
+
```markdown
|
|
415
|
+
{{yaml
|
|
416
|
+
title: My Document
|
|
417
|
+
author: Alice
|
|
418
|
+
tags: [markdown, tutorial]
|
|
419
|
+
created: 2025-01-01
|
|
420
|
+
}}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Emits `<script type="application/yaml">` with the raw YAML text. Invisible to the user. Accessible via JavaScript: `document.querySelector('script[type="application/yaml"]').textContent`.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
### nyml — Invisible parsed metadata block
|
|
428
|
+
|
|
429
|
+
```markdown
|
|
430
|
+
{{nyml
|
|
431
|
+
title: My Document
|
|
432
|
+
count: 42
|
|
433
|
+
items:
|
|
434
|
+
- alpha
|
|
435
|
+
- beta
|
|
436
|
+
}}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
Parsed using the NYML key-value syntax and emitted as `<script type="application/json">`. Invisible to the user. Accessible via: `JSON.parse(document.querySelector('script[type="application/json"]').textContent)`.
|