orz-markdown 1.0.0 → 1.2.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 +28 -2
- 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/dist/plugins/mermaid.js +14 -1
- package/dist/plugins/mermaid.js.map +1 -1
- package/dist/plugins/qrcode.js +11 -1
- package/dist/plugins/qrcode.js.map +1 -1
- package/dist/plugins/smiles.js +4 -1
- package/dist/plugins/smiles.js.map +1 -1
- package/dist/plugins/youtube.js +9 -1
- package/dist/plugins/youtube.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +283 -0
- package/dist/runtime.js.map +1 -1
- package/orz-markdown-skills/SKILL.md +179 -0
- package/orz-markdown-skills/assets/minimal.css +658 -0
- package/orz-markdown-skills/assets/template.html +505 -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 +4 -2
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# CSS Class Reference — orz-markdown
|
|
2
|
+
|
|
3
|
+
Every CSS class and structural HTML element emitted by the parser. Use this as the definitive spec when writing or auditing a theme. All selectors should be scoped under `.markdown-body` in theme files.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Article wrapper
|
|
8
|
+
|
|
9
|
+
| Selector | Source | Notes |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `.markdown-body` | `<article>` wrapping all rendered content | Every theme scopes its styles here |
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Standard markdown elements
|
|
16
|
+
|
|
17
|
+
No plugin-specific classes. Style by tag name scoped under `.markdown-body`.
|
|
18
|
+
|
|
19
|
+
| Element | Notes |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `h1` – `h6` | Headings. `markdown-it-anchor` adds `id` and injects `<a class="header-anchor">` inside. |
|
|
22
|
+
| `p` | Paragraph. |
|
|
23
|
+
| `a` | Hyperlink. |
|
|
24
|
+
| `strong`, `em` | Bold / italic. |
|
|
25
|
+
| `s`, `del` | Strikethrough. |
|
|
26
|
+
| `mark` | Highlighted text (`==text==` via `markdown-it-mark`). |
|
|
27
|
+
| `ins` | Inserted text (`++text++` via `markdown-it-ins`). |
|
|
28
|
+
| `sub`, `sup` | Subscript / superscript (`~sub~` / `^sup^`). |
|
|
29
|
+
| `code` | Inline code. |
|
|
30
|
+
| `pre > code` | Fenced code block. Highlight.js adds token classes when active. |
|
|
31
|
+
| `blockquote` | Block quote. |
|
|
32
|
+
| `ul`, `ol`, `li` | Lists. |
|
|
33
|
+
| `table`, `thead`, `tbody`, `tr`, `th`, `td` | GFM table. |
|
|
34
|
+
| `hr` | Horizontal rule. |
|
|
35
|
+
| `img` | Image. `markdown-it-imsize` adds `width`/`height` attributes when `=WxH` syntax used. |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## markdown-it-anchor
|
|
40
|
+
|
|
41
|
+
| Class | Element | Description |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `.header-anchor` | `<a>` | Permalink prepended inside each heading. Hide by default, show on heading hover. |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## markdown-it-task-lists
|
|
48
|
+
|
|
49
|
+
| Class | Element | Description |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `.task-list-item` | `<li>` | List item beginning with `[ ]` or `[x]`. Remove default list-style. |
|
|
52
|
+
| `.task-list-item-checkbox` | `<input type="checkbox">` | Checkbox inside the task item. Usually `pointer-events: none`. |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## markdown-it-footnote
|
|
57
|
+
|
|
58
|
+
| Class | Element | Description |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| `.footnote-ref` | `<sup><a>` | Inline superscript reference (`[^1]`). |
|
|
61
|
+
| `.footnotes` | `<section>` | Container for all footnotes at page bottom. |
|
|
62
|
+
| `.footnotes-sep` | `<hr>` | Separator between body and footnotes section. |
|
|
63
|
+
| `.footnote-backref` | `<a>` | Back-link from definition to reference. |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## KaTeX
|
|
68
|
+
|
|
69
|
+
| Class | Element | Description |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `.katex` | `<span>` | Wrapper for every inline math expression (`$...$`). |
|
|
72
|
+
| `.katex-display` | `<span>` | Wrapper for display block math (`$$...$$`). Add overflow-x for wide equations. |
|
|
73
|
+
| `.katex-error` | `<span>` | Shown when KaTeX cannot parse the expression. Style as a visible error (red, monospace). |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Semantic callouts (`markdown-it-container`)
|
|
78
|
+
|
|
79
|
+
| Class | Element | Description |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `.success` | `<div>` | Green success callout. `:::success ... :::` |
|
|
82
|
+
| `.info` | `<div>` | Blue info callout. `:::info ... :::` |
|
|
83
|
+
| `.warning` | `<div>` | Amber warning callout. `:::warning ... :::` |
|
|
84
|
+
| `.danger` | `<div>` | Red danger callout. `:::danger ... :::` |
|
|
85
|
+
|
|
86
|
+
Each has `> *:last-child { margin-bottom: 0 }` as a best practice.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Layout containers
|
|
91
|
+
|
|
92
|
+
| Class | Element | Description |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `.left` | `<div>` | Float-left wrapper. `:::left ... :::` Needs mobile unfloat breakpoint. |
|
|
95
|
+
| `.right` | `<div>` | Right-aligned wrapper. `:::right ... :::` |
|
|
96
|
+
| `.center` | `<div>` | Centred wrapper. `:::center ... :::` |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Spoiler
|
|
101
|
+
|
|
102
|
+
| Selector | Element | Description |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| `details.spoil` | `<details>` | Collapsible spoiler block. `:::spoil My Title ... :::` |
|
|
105
|
+
| `details.spoil > summary` | `<summary>` | Toggle label. Hide `::webkit-details-marker`. Provide open/close marker via `::before`. |
|
|
106
|
+
| `details.spoil[open] > summary` | `<summary>` | Style when open. Update `::before` content. |
|
|
107
|
+
| `details.spoil > :not(summary)` | any | Body content area. Apply padding here. |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Tabs
|
|
112
|
+
|
|
113
|
+
| Selector | Element | Description |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| `.tabs` | `<div>` | Outer wrapper. `:::: tabs ... ::::` |
|
|
116
|
+
| `.tabs[data-js]` | `<div>` | Added by JS after initialisation. Use `.tabs:not([data-js])` for no-JS fallback. |
|
|
117
|
+
| `.tabs-bar` | `<div>` | Tab button bar injected by JS. |
|
|
118
|
+
| `.tabs-bar-btn` | `<button>` | Individual tab button. |
|
|
119
|
+
| `.tabs-bar-btn.active` | `<button>` | Currently selected tab button. |
|
|
120
|
+
| `.tab` | `<div>` | Individual tab panel. **Must be `display: none` by default.** |
|
|
121
|
+
| `.tab.active` | `<div>` | Currently visible panel. **Must be `display: block`.** |
|
|
122
|
+
| `.tabs:not([data-js]) .tab` | `<div>` | No-JS fallback: show all panels. **Must be `display: block`.** |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Columns
|
|
127
|
+
|
|
128
|
+
| Class | Element | Description |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| `.cols` | `<div>` | CSS grid wrapper. `:::cols ... :::` Use `grid-template-columns: repeat(auto-fit, minmax(..., 1fr))`. |
|
|
131
|
+
| `.col` | `<div>` | Individual column cell. `:::col ... :::` |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Custom plugins
|
|
136
|
+
|
|
137
|
+
### YouTube embed
|
|
138
|
+
|
|
139
|
+
| Class | Element | Description |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| `.youtube-embed` | `<div>` | 16:9 responsive wrapper. Use padding-bottom trick (`height:0; padding-bottom:56.25%`). |
|
|
142
|
+
|
|
143
|
+
```css
|
|
144
|
+
div.youtube-embed { position: relative; height: 0; padding-bottom: 56.25%; overflow: hidden; }
|
|
145
|
+
div.youtube-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Mermaid diagram
|
|
149
|
+
|
|
150
|
+
| Class | Element | Description |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `.mermaid` | `<div>` | Contains raw Mermaid DSL. Mermaid.js replaces it with `<svg>` client-side. |
|
|
153
|
+
|
|
154
|
+
```css
|
|
155
|
+
div.mermaid { overflow-x: auto; text-align: center; }
|
|
156
|
+
div.mermaid svg { max-width: 100%; height: auto; }
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### SMILES chemical structure
|
|
160
|
+
|
|
161
|
+
| Class | Element | Description |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `.smiles-render` | `<div>` | Wrapper around the canvas. Centered by `common.css` structural rules. |
|
|
164
|
+
| `canvas[data-smiles]` | `<canvas>` | Drawing target. Width/height set as HTML attributes. SmilesDrawer draws here client-side. |
|
|
165
|
+
|
|
166
|
+
The structural flex centering is already in `common.css`. Theme only needs background/border on `.smiles-render` (usually `background: transparent; border: none`).
|
|
167
|
+
|
|
168
|
+
### QR code
|
|
169
|
+
|
|
170
|
+
| Class | Element | Description |
|
|
171
|
+
|---|---|---|
|
|
172
|
+
| `.qrcode` | `<span>` | Inline wrapper around the SVG. **Must have `background: #fff; padding: 4px`** so the black SVG is readable on any background. |
|
|
173
|
+
| `.qrcode__icon` | `<span>` | Expand icon shown on hover. Structural rules in `common.css`. |
|
|
174
|
+
| `.qrcode.is-expanded` | `<span>` | Added while expanded. `common.css` hides the source with `visibility: hidden`. |
|
|
175
|
+
| `.qrcode-overlay` | `<span>` (cloned) | Fixed-position fullscreen overlay. All geometry handled by `common.css`. Theme can adjust `background`. |
|
|
176
|
+
|
|
177
|
+
```css
|
|
178
|
+
span.qrcode { background: #fff; padding: 4px; /* or 6px */ vertical-align: middle; }
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Span (inline color / badge)
|
|
182
|
+
|
|
183
|
+
| Selector | Description |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `span.red` | Color only — set `color: var(--span-red)` |
|
|
186
|
+
| `span.yellow` | Color only — set `color: var(--span-yellow)` |
|
|
187
|
+
| `span.green` | Color only — set `color: var(--span-green)` |
|
|
188
|
+
| `span.blue` | Color only — set `color: var(--span-blue)` |
|
|
189
|
+
| `span.success` | Badge — background, text color, border matching success palette |
|
|
190
|
+
| `span.info` | Badge — background, text color, border matching info palette |
|
|
191
|
+
| `span.warning` | Badge — background, text color, border matching warning palette |
|
|
192
|
+
| `span.danger` | Badge — background, text color, border matching danger palette |
|
|
193
|
+
|
|
194
|
+
Note: `span.success/info/warning/danger` also have `display: inline-flex; align-items: center; line-height: 1; white-space: nowrap` set by `common.css`. Add `padding`, `border-radius`, `font-size`, and colors in the theme.
|
|
195
|
+
|
|
196
|
+
### Table of Contents
|
|
197
|
+
|
|
198
|
+
| Class | Element | Description |
|
|
199
|
+
|---|---|---|
|
|
200
|
+
| `.toc-wrapper` | `<div>` | Outer wrapper (for positioning). |
|
|
201
|
+
| `nav.toc` / `.toc-list` | `<nav>` | The `<ul>` tree of heading links. Reset list bullets in TOC context. |
|
|
202
|
+
|
|
203
|
+
```css
|
|
204
|
+
nav.toc, .toc-list {
|
|
205
|
+
padding: ...;
|
|
206
|
+
border: 1px solid var(--border);
|
|
207
|
+
}
|
|
208
|
+
nav.toc ul, .toc-list ul { margin: 0; padding-left: 1.1rem; }
|
|
209
|
+
nav.toc li, .toc-list li { list-style: none; margin-bottom: 0.25rem; }
|
|
210
|
+
nav.toc a, .toc-list a { text-decoration: none; color: var(--link); }
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Test elements (development only)
|
|
214
|
+
|
|
215
|
+
| Class | Element | Description |
|
|
216
|
+
|---|---|---|
|
|
217
|
+
| `.test-block` | `<div>` | Block debug output. Style as a visually distinct dev-only box. |
|
|
218
|
+
| `.test-inline` | `<span>` | Inline debug output. |
|
|
@@ -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)`.
|