This article covers all 16 markdown-it plugins enabled by the theme. Every plugin follows the same learning path: minimal example → common variants → all syntax forms → parameters & options → boundaries & pitfalls. All examples appear as pairs — effect first, source after — so whatever you see, you immediately know how it was written.
Plugin registration lives in
markdown.pluginsof the root_config.yml; render options (breaks/linkify/typographer/html) live inmarkdown.renderof the same file.
1. emoji (markdown-it-emoji)
Purpose: Write emoji in Markdown body text as shortcodes, with no input method involved.
Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
1.1 Minimal example
Effect: 😄
Corresponding source:
:smile:Two colons wrap the shortcode name; after parsing you get the emoji character itself.
1.2 Common variants
Effect: ❤️ 🚀 👍
Corresponding source:
:heart: :rocket: :+1:Symbol shortcodes work too; names carrying signs such as
+1/-1are accepted as well.
Effect: ✅
Corresponding source:
:white_check_mark:Multi-word shortcodes are joined with underscores, not hyphens.
Effect: 中文😄中文
Corresponding source:
中文:smile:中文No spaces are needed around the colons; it converts even when touching CJK text.
1.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
:smile: | 😄 | Standard shortcode, the most common one |
:heart: :rocket: :+1: | ❤️ 🚀 👍 | Symbol shortcodes work too (signed names like +1/-1 as well) |
:white_check_mark: | ✅ | Multi-word shortcodes are joined with underscores |
| Type 😄 directly | 😄 | Unicode characters pass through verbatim, bypassing the plugin |
CJK adjacent 中文:smile:中文 | 中文😄中文 | No space needed |
1.4 Parameters & options
The plugin is enabled with a bare use(), no options: the whole shortcode table is registered in full, with no way to trim it to a whitelist.
The output is a plain emoji character (no extra <span> wrapper), so styling is entirely decided by the system emoji font.
1.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
:foo: non-standard shortcode | Output as the literal :foo:, no error |
Written inside inline code `:smile:` | Not converted (code content is protected) |
Missing closing colon :smile | Not converted |
CJK adjacent 中文:smile:中文 | Converts normally; no spaces needed around the colons |
| Written inside a code block | Not converted |
1.6 Summary
- If you cannot recall a shortcode name, just type the emoji character — same result
- Multi-word names always use underscores:
white_check_mark, notwhite-check-mark - Disabling a single shortcode is impossible — the plugin has no whitelist
Test assertion: the page contains rendered emoji characters (e.g. 😄 ✅).
2. abbr (markdown-it-abbr)
Purpose: Attach full names to abbreviations, shown on hover.
Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
2.1 Minimal example
Effect: W3C 制定 Web 标准。
Corresponding source:
*[W3C]: World Wide Web Consortium
W3C 制定 Web 标准。The definition line
*[abbr]: full nameoccupies a line of its own; the matching abbreviation in the body right after it automatically gets a dotted underline.
2.2 Common variants
Effect: HTML 定义结构,CSS 定义表现。
Corresponding source:
*[HTML]: Hyper Text Markup Language
*[CSS]: Cascading Style Sheets
HTML 定义结构,CSS 定义表现。Write definition lines one after another; define once and it applies document-wide.
Effect: 同一缩写出现两次:HTML 与 HTML。
Corresponding source:
*[HTML]: Hyper Text Markup Language
同一缩写出现两次:HTML 与 HTML。Every occurrence in the body gets
abbr; a single definition is enough.
2.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
*[HTML]: Hyper Text Markup Language | <abbr title="Hyper Text Markup Language">HTML</abbr> | Definition line, one per line |
| Several consecutive definition lines | Multiple abbreviations active at once | One per line |
| Same abbreviation repeated in the body | Every occurrence gets abbr | Applies document-wide |
| Definition line written after the body | Works just as well | The plugin collects all definitions before replacing (verified) |
2.4 Parameters & options
- The definition-line format is fixed:
*[abbr]: full name; a space after the colon is allowed - Abbreviations are case-sensitive: defining
HTMLwill not match lowercasehtml - Definition placement does not matter: the plugin collects all definitions during block parsing, so writing them after the body works just as well
2.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Definition line and body on the same line *[API]: …* API | The whole line is swallowed as a definition and the body is lost (renders empty, verified) |
Case mismatch html | No abbr added; text stays as-is |
| Abbreviation containing spaces or special characters | Unsupported; treated as plain text |
HTTP and HTTPS both present | Matched as whole words; define both separately |
| Inside a code block / inline code | Not replaced |
2.6 Summary
- Keep the definition line on a line of its own; never squeeze it into the body
- Case-sensitive:
HTML≠html - Putting the definitions at the end of the file is fine — position does not matter
Test assertion: the page contains the
<abbrmarker.
3. footnote (markdown-it-footnote)
Purpose: Attach markers in the body and collect the notes at the end of the article.
Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
3.1 Minimal example
Effect: Hexo 是一个快速静态博客框架[^hexo]。
Corresponding source:
Hexo 是一个快速静态博客框架[^hexo]。
[^hexo]: Hexo 官网:https://hexo.ioWrite
[^label]in the body and[^label]: contentanywhere; the marker, the end-of-article footnote list and the back-link arrows are generated automatically.
3.2 Common variants
Effect: 数字标签也行[1],命名标签也行[named]。
Corresponding source:
数字标签也行[^1],命名标签也行[^named]。
[^1]: 数字标签的脚注。
[^named]: 命名标签的脚注,标签可以是任意单词。The label only pairs references with definitions; the rendered numbers follow the order of appearance.
Effect: 同一脚注引用两次:第一处[dup],第二处[dup]。
Corresponding source:
同一脚注引用两次:第一处[^dup],第二处[^dup]。
[^dup]: 只有一条定义,但两个回链。From the second reference on a suffix is added (
[1:1]), and the end-of-article entry carries two ↩ back-links.
3.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
正文[^1] + [^1]: 内容 | Superscript [1] | Numeric footnote, numbered by order of appearance |
正文[^note] + [^note]: 内容 | Superscript [2] | Named footnote; the label can be any word |
| Same footnote referenced repeatedly | First [1], then [1:1] | A suffix is added from the second reference on |
| Indented continuation under the definition | Multi-paragraph footnote | A continuation indented 4 spaces joins the same footnote |
3.4 Parameters & options
The plugin has no options. The footnote list is appended automatically at the end of the article (<hr> + <section class="footnotes">), and the back-link arrow (↩) on each entry is generated automatically — no need to write it by hand.
3.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Reference without a definition [^x] | Output as-is [^x], no error |
| Definition without a reference | Not rendered at the end; the definition is discarded |
| Placement of the definition line | Can be grouped at the end (recommended); it does not have to follow the reference |
| Reference inside a code block / inline code | Not parsed |
| Label case | Treated as distinct labels; keep them consistent |
3.6 Summary
- Meaningful labels (
[^hexo]) are easier to maintain than numbers - Pile all definitions at the end; do not scatter them through the body
- Multiple references to one footnote are fine; back-links are generated automatically
Test assertion: the page contains footnote-related markers (
<suporfootnotes).
4. ins (markdown-it-ins)
Purpose:
++inserted text++renders as underlined inserted text (revision-marker semantics).Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
4.1 Minimal example
Effect: 这是 插入的内容。
Corresponding source:
这是 ++插入的内容++。4.2 Common variants
Effect: 本次更新 新增了暗色模式 支持。
Corresponding source:
本次更新 ++新增了暗色模式++ 支持。CJK phrases work just as well, as long as they close on the same line.
Effect: 多词 含空格
Corresponding source:
++多词 含空格++Unlike
~/^,++allows spaces inside the content.
4.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
++文本++ | <ins>文本</ins> | The only form; no other variants |
++多词 含空格++ | <ins>多词 含空格</ins> | Content may contain spaces |
4.4 Parameters & options
The plugin has no options; the <ins> styling (underline/color) is decided by the theme CSS, unrelated to the syntax.
4.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Unclosed ++text | Output as-is, no error |
Spanning lines (++ split over two lines) | No match; output as-is |
Written inside inline code `++x++` | Not converted |
Nested with ==highlight== ++==content==++ | Allowed, but a different nesting order yields different HTML; keep them separate |
4.6 Summary
- The only form is
++…++; there is no double-character variant like~~ - Must close on the same line
Test assertion: the page contains the
<insmarker.
5. sub (markdown-it-sub)
Purpose:
~subscript~renders as subscript, for chemical formulas and variable indices.Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
5.1 Minimal example
Effect: H2O 是水的化学式。
Corresponding source:
H~2~O 是水的化学式。5.2 Common variants
Effect: CO2 是二氧化碳。
Corresponding source:
CO~2~ 是二氧化碳。Effect: word 这种单词下标也可以。
Corresponding source:
~word~ 这种单词下标也可以。5.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
H~2~O | H<sub>2</sub>O | Wrapped in single ~ |
~word~ | <sub>word</sub> | Single-word subscript |
~多词短语~ (with spaces) | Not converted | Content cannot contain spaces (~a b~ renders as-is, verified) |
5.4 Parameters & options
The plugin has no options. Note: a single ~ is handled by this plugin; ~~ belongs to a different rule (strikethrough).
5.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
~~strikethrough~~ | Renders as <s> strikethrough (markdown-it built-in strikethrough), not sub |
~text~ containing spaces | Not converted |
Single ~ left unclosed | Output as-is |
Mixed with math $a_i$ | Prefer math syntax for sub/superscripts, avoiding ~/^ clashes |
5.6 Summary
- One
~is subscript, two~~is strikethrough — do not mix them up - Subscript content cannot contain spaces
Test assertion: the page contains the
<submarker.
6. sup (markdown-it-sup)
Purpose:
^superscript^renders as superscript, for exponents and units.Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
6.1 Minimal example
Effect: E=mc2 是质能方程。
Corresponding source:
E=mc^2^ 是质能方程。6.2 Common variants
Effect: 210 = 1024。
Corresponding source:
2^10^ = 1024。Effect: x2 + y2 = z2(同一行多次使用)
Corresponding source:
x^2^ + y^2^ = z^2^(同一行多次使用)6.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
E=mc^2^ | E=mc<sup>2</sup> | Wrapped in single ^ |
^n^ | <sup>n</sup> | Single-word superscript |
x^2^ + y^2^ | Two superscripts | May be used several times on the same line |
6.4 Parameters & options
The plugin has no options; the superscript font size is controlled by the theme CSS (sup styling).
6.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Content with spaces ^a b^ | Not converted |
Unclosed ^2 | Output as-is |
Written inside inline code `^2^` | Not converted |
^^ inside a table (merge marker) | Meaningless in body text; see §9 for table merging |
6.6 Summary
^…^content cannot contain spaces (unlike++)^^inside a table is merge syntax, unrelated to superscript
Test assertion: the page contains the
<supmarker.
7. mark (markdown-it-mark)
Purpose:
==highlight==renders as a highlighter mark.Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
7.1 Minimal example
Effect: 这是 重点内容。
Corresponding source:
这是 ==重点内容==。7.2 Common variants
Effect: 请特别注意 密码安全。
Corresponding source:
请特别注意 ==密码安全==。Effect: 多词 含空格 同样有效。
Corresponding source:
==多词 含空格== 同样有效。7.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
==重点内容== | <mark>重点内容</mark> | The only form |
==多词 含空格== | <mark>多词 含空格</mark> | Content may contain spaces |
7.4 Parameters & options
The plugin has no options; the highlight background is decided by the theme CSS. To change the color, change the mark style, not the syntax.
7.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Unclosed ==highlight | Output as-is |
Empty content ==== | No mark generated; output as-is |
| Spanning lines | No match (must be on one line) |
| Written inside inline code | Not converted |
7.6 Summary
==…==allows spaces, looser than~/^- Must close on the same line; empty content does nothing
Test assertion: the page contains the
<markmarker.
8. task-checkbox (markdown-it-task-checkbox)
Purpose:
- [x]/- [ ]renders as a read-only checkbox list.Learning path: Minimal example → Common variants → All syntax forms → Parameters & options → Boundaries & pitfalls
8.1 Minimal example
Effect:
Corresponding source:
- [x] 已完成任务
- [ ] 未完成任务8.2 Common variants
Effect:
Corresponding source:
- [x] 主题测试文章创建
- [x] 自动化测试脚本
- [ ] 视觉回归验证Effect (nested + inline syntax):
Corresponding source:
- [ ] 父级任务 **加粗** :rocket:
- [x] 子任务一
- [ ] 子任务二Content after the checkbox still goes through inline parsing: bold, emoji and inline code all work.
8.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
- [ ] 未完成 | Empty checkbox | One space inside the brackets |
- [x] 已完成 | Checked checkbox | Lowercase x |
Nested: - [ ] 父 + indented - [x] 子 | Two-level task list | Child items indent 2 spaces |
- [ ] **bold** :emoji: | Inline syntax still works | Content after the checkbox still goes through inline parsing |
8.4 Parameters & options
The plugin is enabled bare with no options, but it writes disabled onto the checkbox by default: renders as <input type="checkbox" disabled>, adds a task-list-item class to the <li> and a task-list class to the <ul>.
8.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
| Can the checkboxes be clicked? | No: disabled is display-only; clicking does nothing |
| Is the checked state saved? | No: plain static HTML; refreshing restores the original state |
[x] not preceded by a list marker body [x] | Not converted; treated as plain text |
Intermediate state [-] | Not recognised; treated as plain text |
Uppercase [X] | Verified to render as checked too (case-insensitive) |
8.6 Summary
- Display-only; do not expect readers to tick anything
- To persist progress you need a real to-do service — a static site cannot do it
Test assertion: the page contains
task-list-itemor checkbox markers.
9. multimd-table (markdown-it-multimd-table)
Purpose: Add alignment, row merging, column merging and captions on top of standard table syntax.
Learning path: Minimal example → alignment → row merge → column merge → caption → all syntax forms → parameters & options → boundaries & pitfalls
9.1 Minimal example
Effect:
| 左对齐 | 居中 | 右对齐 |
|---|---|---|
| a | b | c |
Corresponding source:
| 左对齐 | 居中 | 右对齐 |
| :----- | :--: | -----: |
| a | b | c |The colon position decides the alignment:
:---left,:--:center,---:right.
9.2 Common variants
Effect (row merge, ^^ means merge with the row above):
| 组 | 项 | 状态 |
|---|---|---|
| A | 基础 | ✅ |
| 高级 | ✅ | |
| B | 实验 | ⚠️ |
Corresponding source:
| 组 | 项 | 状态 |
| :--- | :--- | :--- |
| A | 基础 | ✅ |
| ^^ | 高级 | ✅ |
| B | 实验 | ⚠️ |Requires
rowspan: true(enabled in this project), and^^must sit in a consecutive row that has a row above it.
Effect (column merge, an empty cell spans to the right):
| 模块 | 说明 | 备注 |
|---|---|---|
| 表格 | ||
| 图片 | 单列 | 正常 |
Corresponding source:
| 模块 | 说明 | 备注 |
| :--- | :--- | :--- |
| 表格 | 跨两列 ||
| 图片 | 单列 | 正常 |Effect (caption, a standalone [title] line below the table):
| 插件 | 类型 | 状态 |
|---|---|---|
| emoji | 行内 | ✅ |
| footnote | 行内 | ✅ |
| mathjax3 | 块级 | ✅ |
Corresponding source:
| 插件 | 类型 | 状态 |
| :---- | :--- | :--- |
| emoji | 行内 | ✅ |
| footnote | 行内 | ✅ |
| mathjax3 | 块级 | ✅ |
[常用插件一览]The caption renders as
<caption>at the bottom (caption-side: bottom); separated by a blank line it still belongs to the table above.
9.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
| :--- | :--: | ---: | | Left / center / right | Colon position in the separator row sets the alignment |
| ^^ | | <td rowspan="2"> | Row merge: ^^ means “merge with the row above” (needs rowspan: true) |
| 跨列 || | <td colspan="2"> | Column merge: an empty cell spans to the right |
A line below the table [table caption] | <caption> | Table caption, rendered below the table |
| Header row + separator row | Normal table | The first row is always the header (headerless not enabled) |
Literal \| inside a cell | Literal vertical bar | Must be escaped as \\| |
9.4 Parameters & options
| Option | Value in this project | Purpose |
|---|---|---|
rowspan | true | Enables ^^ row merging |
colspan | true (default) | Enables empty-cell column spanning |
multiline | false (default) | Multi-line cells not enabled |
headerless | false (default) | Headerless tables not enabled |
To use multi-line cells, switch that option to
multiline: trueinmarkdown.pluginsand rebuild with a clean.
9.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Blank line inserted between rows before ^^ | Merging fails: treated as a new table, a second <tbody> is produced, ^^ shows literally |
| Writing cell content on several lines | multiline is not enabled; the line breaks split into new rows |
^^ in the first body row | No row above to merge with; ^^ shows literally |
| A row with one column too few / too many | Missing cells are padded empty; extra cells are dropped |
Literal \| inside a cell | Must be escaped as \\| |
| Blank line between caption and table | Still belongs to the table above (but easy to misattribute when tables are stacked; keep it adjacent) |
9.6 Summary
- Alignment comes from the separator colons, row merging from
^^, column merging from an empty cell ^^cannot cross a blank line, otherwise merging fails- Write the caption below the table, as
[title]
Test assertion: the page contains the
<tablemarker.
10. imsize (markdown-it-imsize)
Purpose: Control image display size with
=widthxheight, written into the<img>width/heightat compile time.Learning path: Minimal example → width only / height only → percentage → all syntax forms → parameters & options → boundaries & pitfalls
10.1 Minimal example
Effect:

Corresponding source:
The size string follows the URL, separated by a space.
10.2 Common variants
Effect (width only, height scales proportionally):

Corresponding source:
Effect (height only, width scales proportionally):

Corresponding source:
Effect (percentage width, the x is mandatory):

Corresponding source:
10.3 All syntax forms
| Form | Render attributes | Notes |
|---|---|---|
 | width="300" height="200" | Width + height |
 | width="300" | Width only; height auto |
 | height="200" | Height only; width auto |
 | width="50%" | Percentage width; the x is required |
 | width="50%" height="200" | Percentage width + fixed height |
10.4 Parameters & options
- The size string follows the URL, separated by a space:
 - No plugin-level options; the syntax itself is the parameter
- Percentages must be written as
=50%x(with thexplaceholder); a bare=50%is not recognised
10.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Writing only =50% (without x) | Does not work; the whole image syntax is output verbatim (verified) |
Writing only =300 (without x) | Not recognised; output as-is |
Wanting to add a title =300x200 "title" | Unsupported; the whole thing is output verbatim (verified) |
Missing space between URL and size url=300x200 | Not recognised |
| Size written in the alt text | No effect; it must be a separate parameter after the URL |
Difference from imgsize.js:
markdown-it-imsizeis a Markdown rendering plugin that processes the=widthxheightsyntax at compile time and writeswidth/heightattributes into<img>tags; the theme also hasscripts/events/lib/imgsize.js, which at runtime injects real dimensions into<img>elements without manually specified sizes (synchronous read for local images / asynchronous fetch for remote), preventing CLS. The two work together: manually specified sizes are handled by the imsize plugin, unspecified ones are filled in by imgsize.js as a fallback.
10.6 Summary
- Join the two numbers with
x; leave the missing one empty:=300x,=x200 - Percentages need the
x:=50%x; a bare=50%breaks the whole image syntax - Do not add a title after the size; the plugin does not accept it
Test assertion: the page contains an
imgwith size attributes.
11. container (markdown-it-container)
Purpose:
::: typerenders a semantic-colored callout container (a Markdown layer thing, not a tag plugin).Learning path: Minimal example → common types → all syntax forms → parameters & options → difference from note → boundaries & pitfalls
11.1 Minimal example
Effect:
这是 warning 容器。
Corresponding source:
::: warning
这是 warning 容器。
:::The opening and closing markers each occupy a line, and the container name must be one of the 7 whitelisted names.
11.2 Common types
Effect:
这是 tip 容器(蓝色,与 info 同义)。
Corresponding source:
::: tip
这是 tip 容器(蓝色,与 info 同义)。
:::Effect (multiple paragraphs, a blank line does not end the container):
第一段说明。
第二段仍在同一容器内。
Corresponding source:
::: note
第一段说明。
第二段仍在同一容器内。
:::11.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
::: warning … ::: | <div class="warning"> | Opening/closing markers each on their own line |
::: note … ::: | <div class="note"> | Same; pick any of the 7 names |
| Multi-paragraph content (blank lines between) | All paragraphs stay inside the same container | Blank lines do not end the container |
11.4 Parameters & options
The 7 container names registered in this project (other names are not recognised):
| Container name | Semantic color | Notes |
|---|---|---|
warning | Yellow / warning | |
note | Blue / note | |
info | Blue / info | |
tip | Blue / tip | Same as info |
hint | Blue / hint | Same as info |
attention | Purple / attention | |
error | Red / error |
No title parameter: the “container title” in ::: tip Container Title is discarded (verified: only <div class="tip"><p>content</p></div> is rendered). For a title, use the §19 admon or the {% note %} tag instead.
11.5 Difference from the note tag
{% note primary 说明 %}
正文
{% endnote %}| Dimension | ::: name container | note tag |
|---|---|---|
| Implementation layer | markdown-it-container (Markdown render stage) | Theme tag plugin (before Markdown rendering) |
| Output HTML | <div class="warning"> | <div class="note primary"> |
| Title support | ❌ discarded | ✅ title parameter supported |
| Icon/collapse support | ❌ | ✅ |
| Written inside a code block | Not parsed | Not parsed |
11.6 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Name outside the 7-item whitelist ::: custom | Not recognised; output as-is ::: custom |
| Adding a title after the name | The title is discarded; only the container remains |
| Container nested in a container | Unreliable: verified that the outer one closes early and a stray ::: paragraph is left behind |
| Opening/closing marker on the same line as other text | Not recognised |
| Opening without closing | The container runs to the end of the document (swallowing the rest) |
11.7 Summary
- When in doubt, remember three names:
warning/note/info - Need a title, an icon or collapse → use
{% note %}; do not fight the:::syntax - Never nest
:::, it breaks
Test assertion: the page contains the
note warningcontainer marker.
12. deflist (markdown-it-deflist)
Purpose: A structured term + description list (
<dl>/<dt>/<dd>).Learning path: Minimal example → multiple definitions → all syntax forms → parameters & options → boundaries & pitfalls
12.1 Minimal example
Effect:
- Markdown
- 轻量级标记语言。
Corresponding source:
Markdown
: 轻量级标记语言。There must be no blank line between the term line and the
: definitionline, and a space after the colon.
12.2 Common variants
Effect (one term, several definitions):
- Hexo
- 快速、简洁且高效的博客框架。
- 基于 Node.js 编写。
Corresponding source:
Hexo
: 快速、简洁且高效的博客框架。
: 基于 Node.js 编写。Effect (inline syntax inside a definition):
- Node.js
- 支持 JavaScript 与
npm生态。
Corresponding source:
Node.js
: 支持 **JavaScript** 与 `npm` 生态。12.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
term + newline + : definition | <dt> + <dd> | Simplest form |
Several : definition under one term | One <dt> + multiple <dd> | One term, many definitions |
| Several terms written consecutively | Grouped automatically | No blank line needed between them |
| Inline syntax inside the definition | Parsed normally | : 支持 **粗体** 与 \代码`` |
12.4 Parameters & options
The plugin has no options. Requirements: no blank line between the term line and the : definition line, and a space after the colon.
12.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
| Blank line inserted between term and definition | Split into two paragraphs; the definition does not apply |
No space after the colon :definition | Not recognised; treated as plain text |
| Definition spanning several lines | Continuation lines must be indented, otherwise they become a new paragraph |
| Adjacent to a table/footnote without a blank line | May be absorbed into the previous block; leave blank lines between blocks |
12.6 Summary
- The term line and the
: definitionline must touch; no blank line in between - One term can carry several definitions
Test assertion: the page contains
<dl/<dt/<dd>markers.
13. mathjax3 (markdown-it-mathjax3)
Purpose: Render LaTeX into SVG at compile time (SSR, no frontend JS dependency).
Learning path: inline → block → all syntax forms → parameters & options → boundaries & pitfalls
13.1 Inline formula
Effect: 质能方程
Corresponding source:
质能方程 $E=mc^2$ 是最著名的物理公式之一。Wrapped in single
$, on the same line as the text; it cannot span lines.
13.2 Block formula
Effect:
Corresponding source:
$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$Each
$$occupies its own line, and the centered content takes a block of its own.
Effect (multi-line block, \\ line breaks + the aligned environment):
Corresponding source:
$$
\begin{aligned}
a^2 + b^2 &= c^2 \\
\int_0^1 x^2 dx &= \frac{1}{3}
\end{aligned}
$$13.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
$E=mc^2$ | Inline SVG formula | On the same line as the text |
$$\n...\n$$ | Centered block formula | $$ on its own line; content written across lines |
\\(...\\) / \\[...\\] | Not supported | mathjax3 5.x hardcodes $/$$; degrades to plain bracket text (verified) |
| Multiple lines in a block | \\ line break, aligned/cases environments | Needs the ams package (built into mathjax) |
13.4 Parameters & options
| Item | Value |
|---|---|
| Engine | mathjax3 (default; outputs <mjx-container> SVG via SSR at build time) |
| Delimiters | $...$ inline / $$...$$ block |
inlineMath / displayMath in config | No effect (mathjax3 5.x hardcodes them; writing them does nothing) |
With texmath | Mutually exclusive; enabling both conflicts |
13.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Body text containing money $100 和 $200 | The two $ are treated as an inline formula and render incorrectly |
| Line break inside an inline formula | Does not span lines; use $$ for blocks |
Written as \\(...\\) or \\[...\\] | Not rendered; outputs plain bracket text |
Formula containing {} | Renders normally; if the template engine reports a parse error, wrap that block in `` | | Underscore `_` inside a formula | Fine (inside `$` it is unaffected by the `sub` plugin) | ### 13.6 Dual math engines (mathjax / katex, added 2026-09-10) The theme `post.math.engine` supports picking one of two (the root `_config.yml` markdown plugin switches in tandem): | Engine | Delimiters | Rendering | |---|---|---| | `mathjax` (default) | `$...$` inline / `$$...$$` block (mathjax3 5.x hardcodes them, `\(...\)` not supported) | Node-side SSR outputs MathJax SVG (` |
Not a single character of the source changes: the plugin inserts zero-width spaces (U+200B) between CJK characters and Latin letters/digits/Western punctuation as break opportunities.
Effect (scenarios the plugin does not cover may still overflow): an over-long URL inside a CJK sentence still overflows the container, because zero-width spaces are not inserted inside the URL.
Corresponding source:
{% raw %}中文句子里的超长 URL 仍会溢出容器:https://example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14.2 All syntax forms
No syntax: the plugin works automatically; not a single character of the source needs changing. It inserts break opportunities (zero-width spaces) between CJK characters and Latin letters/digits/Western punctuation, letting the browser wrap normally at CJK–Latin boundaries instead of pushing a whole English string to the next line or overflowing the container.
| Input | Output |
|---|---|
中文English中文 | 中文 + ZWSP + English + ZWSP + 中文 |
纯中文 | Unchanged |
英文 only | Unchanged |
14.3 Parameters & options
No options, no toggle; applies to all body text site-wide. Does not affect code blocks or inline code content.
14.4 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
| Pure CJK paragraph | No change (already breakable per character) |
Mixed 中文English中文 | Breaking is allowed at the CJK–Latin boundary |
| Inside code blocks / inline code | Not processed; kept as-is |
Combined with breaks: true | Only affects soft line breaks, not hard <br> |
| Long URL inside a CJK sentence | May still overflow (zero-width spaces are not inserted inside the URL) |
| Copying text | Zero-width spaces may be copied along, occasionally producing “invisible characters” when pasted elsewhere |
14.5 Summary
- Zero configuration, pure upside — nothing to learn
- The only caveat is that over-long URLs can still overflow; break them manually when needed
Test assertion: CJK text renders normally (no abnormal character breaks).
15. Advanced table walkthrough (multimd-table combinations)
Purpose: Combine alignment, row merging, column merging and a caption in one realistic table.
Learning path: combined example → enabled options → multiline notes → boundaries & pitfalls
15.1 Combined example
Effect:
| 分类 | 插件 | 状态 |
|---|---|---|
| 行内 | emoji | ✅ |
| footnote | ✅ | |
| mark | ✅ | |
| 块级 | mathjax3 | ✅ |
| container | ✅ |
Corresponding source:
{% raw %}| 分类 | 插件 | 状态 |
| :--- | :--- | :--: |
| 行内 | emoji | ✅ |
| ^^ | footnote | ✅ |
| ^^ | mark | ✅ |
| 块级 | mathjax3 | ✅ |
| ^^ | container | ✅ |
[按渲染阶段分类]Consecutive
^^merge upwards row by row (rowspanaccumulates), so the category column is written only once.
15.2 Common variants
Effect (column merge + right-aligned numbers):
| 项目 | 说明 | 数值 |
|---|---|---|
| 表格扩展 | ||
| 行合并 | ^^ | 2 |
| 表题 | [标题] | 1 |
Corresponding source:
{% raw %}| 项目 | 说明 | 数值 |
| :--- | :--- | ---: |
| 表格扩展 | 跨两列 ||
| 行合并 | `^^` | 2 |
| 表题 | `[标题]` | 1 |15.3 Enabled options
| Option | This project | Notes |
|---|---|---|
rowspan | ✅ enabled | ^^ merges upwards |
colspan | ✅ default | An empty cell spans to the right |
multiline | ❌ not enabled | Multi-line cells; needs an explicit multiline: true |
headerless | ❌ not enabled | Headerless tables |
Behaviour when multiline is off: a line break inside a cell is split into a new row instead of becoming multi-line content in the same cell. If you really need multi-line cells, change the config and rebuild with a clean, or use an HTML table.
15.4 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
| Blank line inserted between merged rows | The table breaks and ^^ shows literally |
^^ used in the first body row | No row above; shows literally |
| Column merge leaving the last column empty | The span equals the remaining column count; do not leave extras |
A cell containing | | Escape it as \| |
| Table with no blank line to the surrounding paragraphs | May be absorbed into the same paragraph and not render as a table |
15.5 Summary
- Row merge is
^^, column merge is an empty cell, caption is[title] - The easiest trap in combinations is a “blank line between rows” — merging stops immediately
Test assertion: the page contains the
<tablemarker (2+ tables).
16. Combined test (multiple plugins)
Purpose: Verify that several plugins do not interfere within the same block of content.
Learning path: combined example → item-by-item breakdown → boundaries & pitfalls
16.1 Combined example
Effect:
任务清单(task-checkbox + emoji):
定义列表(deflist):
- Markdown
- 轻量级标记语言。
- 由 John Gruber 发明。
脚注(footnote): 主题测试文章共 4 篇[1]。
Corresponding source:
{% raw %}**任务清单**(task-checkbox + emoji):
- [x] emoji 正常::white_check_mark:
- [x] 插入正常:++新增内容++
- [x] 数学正常:$a^2 + b^2 = c^2$
**定义列表**(deflist):
Markdown
: 轻量级标记语言。
: 由 John Gruber 发明。
**脚注**(footnote): 主题测试文章共 4 篇[^total]。
[^total]: 内容tag篇、交互视觉篇、布局页面篇、Markdown语法篇。16.2 Item-by-item breakdown
| Combination | Key point |
|---|---|
| Checkbox + emoji | Content after the checkbox goes through inline parsing, so emoji work |
| Checkbox + ins | ++…++ is handled at the inline stage, so it works inside list items |
| Task list + math | $…$ is handled at the inline parsing stage, unaffected by the list |
| Definition list + emphasis | : definition content goes through inline parsing; bold/code both work |
| Footnote + any block | A footnote can be referenced from any block; the list is appended once at the end |
16.3 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
~ (subscript) and $…$ in the same paragraph | Math wins inside the formula; ~ inside $ is not a subscript |
| Footnote reference inside a checkbox | Fine; the footnote is generated normally |
| Definition list right after a table | Leave a blank line to avoid absorption into the same block |
| Deeply nested tags + plugin syntax | Theme tags render before markdown; plugin syntax still works inside tag content |
16.4 Summary
- Plugins are largely non-conflicting; conflicts concentrate on symbol overlap:
~/^vs math,==vs attrs - When mixing, wrap raw syntax examples in code blocks first
Test assertion: the page contains a combination of multiple markers (checkbox + dl + footnote + ins).
17. Inline Attributes attrs (markdown-it-attrs)
Purpose: Add
id/class/ custom attributes to block and inline elements, for style targeting, anchors andtarget.Learning path: Minimal example → inline elements → links → all syntax forms → parameters & options → boundaries & pitfalls
17.1 Minimal example
Effect:
这是居中段落(class 定位)。
Corresponding source:
{% raw %}这是居中段落(class 定位)。
{.text-center}The attribute block occupies the next line and applies to the previous block-level element.
17.2 Common variants
Effect (immediately after an inline element, same line): 这是红色粗体的示例。
Corresponding source:
{% raw %}这是**红色粗体**{.red}的示例。The inline element and the attribute block must be on the same line, otherwise the attributes land on the paragraph.
Effect (attributes on a link): 带 target 的链接
Corresponding source:
{% raw %}[带 target 的链接](https://hexo.io){target="_blank"}Effect (several classes chained): 这里的文字同时带两个 class。
Corresponding source:
{% raw %}这里的文字同时带两个 class。
{.my-class .another-class}Multiple classes are chained with spaces;
#idandkey=valuecan be mixed in the same brace. The attribute block must touch the previous block — a blank line in between produces an empty paragraph<p class="…"></p>.
17.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
{.text-center} on the line below a paragraph | <p class="text-center"> | The attribute block sits on its own line and applies to the previous block |
**bold**{.red} | <strong class="red"> | Immediately after an inline element (same line) |
[link](url){target="_blank"} | <a target="_blank"> | Immediately after a link |
Heading {#custom-id} | <h2 id="custom-id"> | Anchor id on a heading |
{.a #id key=val} | Multiple attributes chained | Several classes allowed; value joined to key with = |
17.4 Parameters & options
| Form | Meaning |
|---|---|
#id | Sets the id (anchor / JS selector) |
.class | Appends a class; several allowed .a .b |
key=value | Arbitrary custom attribute |
key="with spaces" | Quote the value when it contains spaces |
17.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
Immediately after plain text text{.red} | Does not work; output as-is (it must follow an inline element or sit on its own line) |
Inline element and attributes on separate lines **bold** ↵ {.red} | The attributes land on the paragraph, not the bold text |
{.x} alone at the start of a line with no block above | Produces an empty paragraph <p class="x"></p> |
| Body text immediately after the attribute block with no blank line | May be absorbed into the previous block, widening the attribute scope |
Mixed with plugins like ==highlight== | Put it after the marker: ==text=={.x} |
Writing {target="_blank"} without quotes but with a space | The value breaks at the space and the attribute is truncated |
17.6 Summary
- Three positions: on its own line below a block, immediately after an inline element, immediately after a link
- The key is “same line” — a line break changes the target
- Plain text cannot carry attributes directly; wrap it in an inline element first
Test assertion: the page contains an element with the
text-centerclass.
18. External Link Attributes link-attributes (markdown-it-link-attributes)
Purpose: Automatically add
target="_blank"+rel="noopener noreferrer"to Markdown links.Learning path: Minimal example → internal links → anchors/bare URLs → all syntax forms → parameters & options → boundaries & pitfalls
18.1 Minimal example
Effect: Hexo 官网
Corresponding source:
{% raw %}[Hexo 官网](https://hexo.io)Opens in a new window + prevents reverse tabnabbing; nothing needs to be written in the source.
18.2 Common variants
Effect (internal links get target as well): 站内文章
Corresponding source:
{% raw %}[站内文章](/posts/8a11fe0a/)Effect (anchor links are matched too): 回到顶部
Corresponding source:
{% raw %}[回到顶部](#)Effect (bare URL auto-detected by linkify): https://hexo.io
Corresponding source:
{% raw %}https://hexo.ioThe bare URL is turned into a link by
linkify: true, then this plugin adds the attributes.
18.3 All syntax forms
| Form | Handling | Notes |
|---|---|---|
[text](https://hexo.io) | Adds target + rel | External link |
[text](/posts/xxx/) | Also adds target + rel | Internal relative links are matched too |
[text](#anchor) | Also adds target | Anchor links are matched too |
<https://hexo.io> (auto-linkified) | Also adds target | Bare URLs are processed after conversion |
[](b.html) | The outer <a> is processed too | Image link |
18.4 Parameters & options
| Config item | Value in this project | Notes |
|---|---|---|
attrs.target | _blank | Opens in a new window |
attrs.rel | noopener noreferrer | Prevents reverse tabnabbing + performance |
pattern | ^https?:// | No effect: the plugin only accepts a matcher function, not a pattern string |
18.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
| Internal links | Also get target="_blank" (config flaw: unexpected, but that is the current behaviour) |
| Template-generated links (prev/next, sidebar, nav) | Unaffected; they bypass Markdown rendering |
| Wanting internal links to open in the same window | Change the config to a matcher function, or drop pattern and keep only the external-link check |
Hand-written <a href> in HTML | Unaffected (the plugin only processes Markdown link tokens) |
Writing a pattern string | No error but it is ignored → every body link (internal and anchor included) gets target |
18.6 Summary
- “Only applies to external links” does not currently hold —
patternis an invalid config - Result: every link in the body opens a new window, internal navigation included
- To fix it, switch to a
matcherfunction and rebuild with a clean after changing the config
Test assertion: external
<a>containstarget="_blank"+rel="noopener noreferrer".
19. admon Callout Blocks (markdown-it-admon)
Purpose:
!!! typesyntax renders callout blocks (python-markdown style, coexisting with the:::of §11).Learning path: Minimal example → custom title → different types → all syntax forms → parameters & options → boundaries & pitfalls
19.1 Minimal example
Effect:
note
这是 note admon——最基础的提示块。
Corresponding source:
{% raw %}!!! note
这是 note admon——最基础的提示块。The body must be indented 4 spaces, otherwise it lands outside the block.
19.2 Common variants
Effect (custom title, written directly after the type):
部署前请先备份
改动 _config.yml 后记得 clean 构建。
Corresponding source:
{% raw %}!!! warning 部署前请先备份
改动 `_config.yml` 后记得 clean 构建。Effect (no title written, the type name is used with a capital first letter):
Tip
这是 tip admon——小技巧。
Corresponding source:
{% raw %}!!! tip
这是 tip admon——小技巧。Effect (multiple paragraphs + a list):
Danger
危险操作示例:
- 删除
public/ - 覆盖
_config.yml
Corresponding source:
{% raw %}!!! danger
危险操作示例:
- 删除 `public/`
- 覆盖 `_config.yml`After a blank line, keep indenting 4 spaces and the content still belongs to the same block.
19.3 All syntax forms
| Form | Render | Notes |
|---|---|---|
!!! note | <div class="admonition note"> | Blue info block |
!!! info / !!! tip | admonition block | Tip-type |
!!! warning | Yellow warning block | |
!!! danger / !!! error / !!! failure | Red danger block | |
!!! success | Green success block | |
!!! bug / !!! question / !!! quote / !!! example | Matching icon block | Semantic types |
!!! note Custom title | Title replaced with the given text | A space then the text after the type becomes admonition-title |
19.4 Parameters & options
| Item | Notes |
|---|---|
| Type | note / info / tip / warning / danger / error / success / failure / bug / question / quote / example (the plugin also accepts summary abstract tldr todo hint check done help faq attention caution fail missing snippet cite, but the theme CSS only colors the common types) |
| Title | A space then the text after the type, no quotes; when omitted the type name is used (capitalised, e.g. Success/Danger) |
| Content | Must be indented 4 spaces, otherwise it does not enter the block |
| Quotes | If you hand-write "Title", typographer converts the straight quotes into curly “” and displays them too |
19.5 Boundaries & pitfalls
| Case | Behaviour |
|---|---|
| Content not indented | Only the title enters the block; the body lands outside |
Collapsible block ??? note | Not supported: the current plugin version (1.0.1) has no collapse syntax; ??? note is output verbatim (verified) |
Misspelled type !!! cautoin | The type is accepted (no validation), but the theme has no matching color, so it renders as an unstyled block |
Mixed with the §11 ::: container | Two independent syntaxes: admon produces .admonition.<type>, container produces .<type>; the styles differ |
| Indented 2 spaces | Fewer than 4 spaces, treated as a normal paragraph |
| Title in quotes | The quotes are rendered (“Title”) — pure noise |
19.6 Summary
- Three ingredients:
!!! type, 4-space indentation, an optional title (no quotes) - Want collapse → use
{% note %}; admon’s???does not exist in this version - Types are not validated; a typo does not error but has no styling
Test assertion: the page contains admon rendering markers.
⚠️ Known pitfalls
Pitfall 1: Double heading numbering
Symptom: headings render as “1. 1. Overview” (two numbers).
Cause: the theme CSS automatically numbers h2–h6 (on by default), and hand-written numbers (e.g. ## 1. Overview) stack on top.
Fix: pages with hand-written numbering add closeAutoTocNum: true in front-matter; pages without hand-written numbering must not add this field.
This article correctly sets
closeAutoTocNum: true.
Pitfall 2: Forgetting the {% raw %}` wrapper **Symptom**: `{% note %}` or `{{ }}` in example source is actually executed or throws a template error. **Fix**: wrap every example code block that contains `{% %}` / `{{ }}` in `{% raw %}` … `{% endraw %}.
Pitfall 3: Config written but not effective
Symptom: link-attributes’ pattern: ^https?:// and mathjax3’s inlineMath are both written, yet the behaviour does not change.
Cause: both are cases of the plugin not recognising that key (one only accepts a matcher function, the other hardcodes $/$$ in its source), so the config silently fails.
Pitfall 4: Config changes require a clean build
Symptom: after modifying markdown.plugins in the root _config.yml (e.g. switching the mathjax/katex engine, enabling multiline), the page does not update.
Cause: Hexo’s cache does not automatically detect configuration changes.
Fix: after changing markdown plugin configuration you must run npm run clean && npm run build.
Appendix: markdown-it plugin quick reference
| Plugin | Syntax | Render | Test marker |
|---|---|---|---|
| emoji | :smile: | emoji character | emoji |
| abbr | *[ABBR]: 全称 | <abbr> | abbr |
| footnote | [^1] | footnote | footnote |
| ins | ++文本++ | <ins> | ins |
| sub | ~文本~ | <sub> | sub |
| sup | ^文本^ | <sup> | sup |
| mark | ==文本== | <mark> | mark |
| task-checkbox | - [x] | checkbox | task-list-item |
| multimd-table | table | <table> | table |
| imsize | =200x100 | sized image | img |
| container | ::: type | note container | note |
| deflist | 术语: 定义 | <dl> | dl |
| mathjax3 | $公式$ | SVG | math |
| cjk-breaks | automatic | CJK optimization | - |
| attrs | {#id .class key=val} | element attributes | class/id |
| link-attributes | external links auto | target=_blank + rel | target |
| admon | !!! type | callout block | admon |
References
系列教程
Hexo 主题功能测试系列
- Hexo主题功能测试-布局与页面篇 —— 页面布局、导航、侧边栏、卡片等结构功能
- Hexo主题功能测试-交互视觉篇 —— 代码高亮、图片灯箱、动画、明暗切换等交互
- Hexo主题功能测试-内容tag篇 —— note / tabs / timeline / label / button 等 tag 插件
- Hexo主题功能测试-Markdown语法篇 —— Markdown 渲染与扩展语法
- Hexo主题功能测试-自动化测试篇 —— 主题功能的自动化测试方案
内容tag篇、交互视觉篇、布局页面篇、Markdown语法篇。 ↩︎

