Loading...

Loading...

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.plugins of the root _config.yml; render options (breaks / linkify / typographer / html) live in markdown.render of 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 / -1 are 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

FormRenderNotes
: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

CaseBehaviour
:foo: non-standard shortcodeOutput as the literal :foo:, no error
Written inside inline code `:smile:`Not converted (code content is protected)
Missing closing colon :smileNot converted
CJK adjacent 中文:smile:中文Converts normally; no spaces needed around the colons
Written inside a code blockNot 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, not white-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 name occupies 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

FormRenderNotes
*[HTML]: Hyper Text Markup Language<abbr title="Hyper Text Markup Language">HTML</abbr>Definition line, one per line
Several consecutive definition linesMultiple abbreviations active at onceOne per line
Same abbreviation repeated in the bodyEvery occurrence gets abbrApplies document-wide
Definition line written after the bodyWorks just as wellThe 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 HTML will not match lowercase html
  • 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

CaseBehaviour
Definition line and body on the same line *[API]: …* APIThe whole line is swallowed as a definition and the body is lost (renders empty, verified)
Case mismatch htmlNo abbr added; text stays as-is
Abbreviation containing spaces or special charactersUnsupported; treated as plain text
HTTP and HTTPS both presentMatched as whole words; define both separately
Inside a code block / inline codeNot 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 <abbr marker.


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.io

Write [^label] in the body and [^label]: content anywhere; 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

FormRenderNotes
正文[^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 repeatedlyFirst [1], then [1:1]A suffix is added from the second reference on
Indented continuation under the definitionMulti-paragraph footnoteA 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

CaseBehaviour
Reference without a definition [^x]Output as-is [^x], no error
Definition without a referenceNot rendered at the end; the definition is discarded
Placement of the definition lineCan be grouped at the end (recommended); it does not have to follow the reference
Reference inside a code block / inline codeNot parsed
Label caseTreated 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 (<sup or footnotes).


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

FormRenderNotes
++文本++<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

CaseBehaviour
Unclosed ++textOutput 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 <ins marker.


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

FormRenderNotes
H~2~OH<sub>2</sub>OWrapped in single ~
~word~<sub>word</sub>Single-word subscript
~多词短语~ (with spaces)Not convertedContent 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

CaseBehaviour
~~strikethrough~~Renders as <s> strikethrough (markdown-it built-in strikethrough), not sub
~text~ containing spacesNot converted
Single ~ left unclosedOutput 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 <sub marker.


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

FormRenderNotes
E=mc^2^E=mc<sup>2</sup>Wrapped in single ^
^n^<sup>n</sup>Single-word superscript
x^2^ + y^2^Two superscriptsMay 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

CaseBehaviour
Content with spaces ^a b^Not converted
Unclosed ^2Output 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 <sup marker.


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

FormRenderNotes
==重点内容==<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

CaseBehaviour
Unclosed ==highlightOutput as-is
Empty content ====No mark generated; output as-is
Spanning linesNo match (must be on one line)
Written inside inline codeNot converted

7.6 Summary

  • ==…== allows spaces, looser than ~/^
  • Must close on the same line; empty content does nothing

Test assertion: the page contains the <mark marker.


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

FormRenderNotes
- [ ] 未完成Empty checkboxOne space inside the brackets
- [x] 已完成Checked checkboxLowercase x
Nested: - [ ] 父 + indented - [x] 子Two-level task listChild items indent 2 spaces
- [ ] **bold** :emoji:Inline syntax still worksContent 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

CaseBehaviour
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-item or 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:

左对齐居中右对齐
abc

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

FormRenderNotes
| :--- | :--: | ---: |Left / center / rightColon 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 rowNormal tableThe first row is always the header (headerless not enabled)
Literal \| inside a cellLiteral vertical barMust be escaped as \\|

9.4 Parameters & options

OptionValue in this projectPurpose
rowspantrueEnables ^^ row merging
colspantrue (default)Enables empty-cell column spanning
multilinefalse (default)Multi-line cells not enabled
headerlessfalse (default)Headerless tables not enabled

To use multi-line cells, switch that option to multiline: true in markdown.plugins and rebuild with a clean.

9.5 Boundaries & pitfalls

CaseBehaviour
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 linesmultiline is not enabled; the line breaks split into new rows
^^ in the first body rowNo row above to merge with; ^^ shows literally
A row with one column too few / too manyMissing cells are padded empty; extra cells are dropped
Literal \| inside a cellMust be escaped as \\|
Blank line between caption and tableStill 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 <table marker.


10. imsize (markdown-it-imsize)

Purpose: Control image display size with =widthxheight, written into the <img> width/height at 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:

![封面](https://blog.17lai.site/medias_webp/cover/hexo.webp =200x100)

The size string follows the URL, separated by a space.

10.2 Common variants

Effect (width only, height scales proportionally):

封面-只定宽

Corresponding source:

![封面-只定宽](https://blog.17lai.site/medias_webp/cover/hexo.webp =240x)

Effect (height only, width scales proportionally):

封面-只定高

Corresponding source:

![封面-只定高](https://blog.17lai.site/medias_webp/cover/hexo.webp =x80)

Effect (percentage width, the x is mandatory):

封面-百分比

Corresponding source:

![封面-百分比](https://blog.17lai.site/medias_webp/cover/hexo.webp =30%x)

10.3 All syntax forms

FormRender attributesNotes
![alt](url =300x200)width="300" height="200"Width + height
![alt](url =300x)width="300"Width only; height auto
![alt](url =x200)height="200"Height only; width auto
![alt](url =50%x)width="50%"Percentage width; the x is required
![alt](url =50%x200)width="50%" height="200"Percentage width + fixed height

10.4 Parameters & options

  • The size string follows the URL, separated by a space: ![alt](image-url =wxh)
  • No plugin-level options; the syntax itself is the parameter
  • Percentages must be written as =50%x (with the x placeholder); a bare =50% is not recognised

10.5 Boundaries & pitfalls

CaseBehaviour
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=300x200Not recognised
Size written in the alt textNo effect; it must be a separate parameter after the URL

Difference from imgsize.js: markdown-it-imsize is a Markdown rendering plugin that processes the =widthxheight syntax at compile time and writes width/height attributes into <img> tags; the theme also has scripts/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 img with size attributes.


11. container (markdown-it-container)

Purpose: ::: type renders 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

FormRenderNotes
::: 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 containerBlank lines do not end the container

11.4 Parameters & options

The 7 container names registered in this project (other names are not recognised):

Container nameSemantic colorNotes
warningYellow / warning
noteBlue / note
infoBlue / info
tipBlue / tipSame as info
hintBlue / hintSame as info
attentionPurple / attention
errorRed / 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 containernote tag
Implementation layermarkdown-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 blockNot parsedNot parsed

11.6 Boundaries & pitfalls

CaseBehaviour
Name outside the 7-item whitelist ::: customNot recognised; output as-is ::: custom
Adding a title after the nameThe title is discarded; only the container remains
Container nested in a containerUnreliable: verified that the outer one closes early and a stray ::: paragraph is left behind
Opening/closing marker on the same line as other textNot recognised
Opening without closingThe 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 warning container 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 : definition line, 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

FormRenderNotes
term + newline + : definition<dt> + <dd>Simplest form
Several : definition under one termOne <dt> + multiple <dd>One term, many definitions
Several terms written consecutivelyGrouped automaticallyNo blank line needed between them
Inline syntax inside the definitionParsed 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

CaseBehaviour
Blank line inserted between term and definitionSplit into two paragraphs; the definition does not apply
No space after the colon :definitionNot recognised; treated as plain text
Definition spanning several linesContinuation lines must be indented, otherwise they become a new paragraph
Adjacent to a table/footnote without a blank lineMay be absorbed into the previous block; leave blank lines between blocks

12.6 Summary

  • The term line and the : definition line 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: 质能方程 E=mc2是最著名的物理公式之一。

Corresponding source:

质能方程 $E=mc^2$ 是最著名的物理公式之一。

Wrapped in single $, on the same line as the text; it cannot span lines.

13.2 Block formula

Effect:

∫0∞e−x2dx=π2

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):

a2+b2=c2∫01x2dx=13

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

FormRenderNotes
$E=mc^2$Inline SVG formulaOn the same line as the text
$$\n...\n$$Centered block formula$$ on its own line; content written across lines
\\(...\\) / \\[...\\]Not supportedmathjax3 5.x hardcodes $/$$; degrades to plain bracket text (verified)
Multiple lines in a block\\ line break, aligned/cases environmentsNeeds the ams package (built into mathjax)

13.4 Parameters & options

ItemValue
Enginemathjax3 (default; outputs <mjx-container> SVG via SSR at build time)
Delimiters$...$ inline / $$...$$ block
inlineMath / displayMath in configNo effect (mathjax3 5.x hardcodes them; writing them does nothing)
With texmathMutually exclusive; enabling both conflicts

13.5 Boundaries & pitfalls

CaseBehaviour
Body text containing money $100 和 $200The two $ are treated as an inline formula and render incorrectly
Line break inside an inline formulaDoes 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 (``), no frontend JS needed | | `katex` | `$...$` / `$$...$$` + `\(...\)` / `\[...\]` (brackets must be standalone blocks) | SSR rendering + frontend loads KaTeX CSS (`static_prefix.katex`) | Switching to katex: comment out `markdown-it-mathjax3` in `markdown.plugins`, enable texmath, set `post.math.engine: katex`. Mind map (markmap) embedded formulas always use KaTeX (`.katex`), coexisting with body MathJax (dual channel). ### 13.7 Summary - Only use `$…$` / `$$…$$`; never write `\(…\)` - Watch the `$` in money amounts — a pair is treated as a formula - After changing the engine you must rebuild with a clean > **Test assertion**: the page contains math rendering markers (SVG or ``). --- ## 14. cjk-breaks (markdown-it-cjk-breaks) > **Purpose**: Insert zero-width break opportunities at CJK–Latin boundaries, so a long Latin run is not pushed onto the next line or out of the container. > > **Learning path**: effect comparison → all syntax forms → parameters & options → boundaries & pitfalls ### 14.1 Effect comparison **Effect**: the mixed CJK–Latin paragraph below lets the browser **break at CJK boundaries** (not only at spaces): 在 Hexo 博客中使用 markdown-it 插件渲染 SupercalifragilisticexpialidociousEnglishWord 这类长单词时,fallback 行为取决于断行机会。 **Corresponding source**: {% raw %}
在 Hexo 博客中使用 markdown-it 插件渲染 SupercalifragilisticexpialidociousEnglishWord 这类长单词时,fallback 行为取决于断行机会。
{% endraw %}

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/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
{% endraw %}

14.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.

InputOutput
中文English中文中文 + ZWSP + English + ZWSP + 中文
纯中文Unchanged
英文 onlyUnchanged

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

CaseBehaviour
Pure CJK paragraphNo change (already breakable per character)
Mixed 中文English中文Breaking is allowed at the CJK–Latin boundary
Inside code blocks / inline codeNot processed; kept as-is
Combined with breaks: trueOnly affects soft line breaks, not hard <br>
Long URL inside a CJK sentenceMay still overflow (zero-width spaces are not inserted inside the URL)
Copying textZero-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 | ✅ |

[按渲染阶段分类]
{% endraw %}

Consecutive ^^ merge upwards row by row (rowspan accumulates), 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 |
{% endraw %}

15.3 Enabled options

OptionThis projectNotes
rowspan✅ enabled^^ merges upwards
colspan✅ defaultAn empty cell spans to the right
multiline❌ not enabledMulti-line cells; needs an explicit multiline: true
headerless❌ not enabledHeaderless 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

CaseBehaviour
Blank line inserted between merged rowsThe table breaks and ^^ shows literally
^^ used in the first body rowNo row above; shows literally
Column merge leaving the last column emptyThe span equals the remaining column count; do not leave extras
A cell containing |Escape it as \|
Table with no blank line to the surrounding paragraphsMay 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 <table marker (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语法篇。
{% endraw %}

16.2 Item-by-item breakdown

CombinationKey point
Checkbox + emojiContent 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 blockA footnote can be referenced from any block; the list is appended once at the end

16.3 Boundaries & pitfalls

CaseBehaviour
~ (subscript) and $…$ in the same paragraphMath wins inside the formula; ~ inside $ is not a subscript
Footnote reference inside a checkboxFine; the footnote is generated normally
Definition list right after a tableLeave a blank line to avoid absorption into the same block
Deeply nested tags + plugin syntaxTheme 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 and target.

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}
{% endraw %}

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}的示例。
{% endraw %}

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"}
{% endraw %}

Effect (several classes chained): 这里的文字同时带两个 class。

Corresponding source:

{% raw %}
这里的文字同时带两个 class。
{.my-class .another-class}
{% endraw %}

Multiple classes are chained with spaces; #id and key=value can 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

FormRenderNotes
{.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 chainedSeveral classes allowed; value joined to key with =

17.4 Parameters & options

FormMeaning
#idSets the id (anchor / JS selector)
.classAppends a class; several allowed .a .b
key=valueArbitrary custom attribute
key="with spaces"Quote the value when it contains spaces

17.5 Boundaries & pitfalls

CaseBehaviour
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 aboveProduces an empty paragraph <p class="x"></p>
Body text immediately after the attribute block with no blank lineMay 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 spaceThe 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-center class.


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)
{% endraw %}

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/)
{% endraw %}

Effect (anchor links are matched too): 回到顶部

Corresponding source:

{% raw %}
[回到顶部](#)
{% endraw %}

Effect (bare URL auto-detected by linkify): https://hexo.io

Corresponding source:

{% raw %}
https://hexo.io
{% endraw %}

The bare URL is turned into a link by linkify: true, then this plugin adds the attributes.

18.3 All syntax forms

FormHandlingNotes
[text](https://hexo.io)Adds target + relExternal link
[text](/posts/xxx/)Also adds target + relInternal relative links are matched too
[text](#anchor)Also adds targetAnchor links are matched too
<https://hexo.io> (auto-linkified)Also adds targetBare URLs are processed after conversion
[![img](a.png)](b.html)The outer <a> is processed tooImage link

18.4 Parameters & options

Config itemValue in this projectNotes
attrs.target_blankOpens in a new window
attrs.relnoopener noreferrerPrevents reverse tabnabbing + performance
pattern^https?://No effect: the plugin only accepts a matcher function, not a pattern string

18.5 Boundaries & pitfalls

CaseBehaviour
Internal linksAlso 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 windowChange the config to a matcher function, or drop pattern and keep only the external-link check
Hand-written <a href> in HTMLUnaffected (the plugin only processes Markdown link tokens)
Writing a pattern stringNo 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 — pattern is an invalid config
  • Result: every link in the body opens a new window, internal navigation included
  • To fix it, switch to a matcher function and rebuild with a clean after changing the config

Test assertion: external <a> contains target="_blank" + rel="noopener noreferrer".


19. admon Callout Blocks (markdown-it-admon)

Purpose: !!! type syntax 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——最基础的提示块。
{% endraw %}

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 构建。
{% endraw %}

Effect (no title written, the type name is used with a capital first letter):

Tip

这是 tip admon——小技巧。

Corresponding source:

{% raw %}
!!! tip
    这是 tip admon——小技巧。
{% endraw %}

Effect (multiple paragraphs + a list):

Danger

危险操作示例:

  • 删除 public/
  • 覆盖 _config.yml

Corresponding source:

{% raw %}
!!! danger
    危险操作示例:

    - 删除 `public/`
    - 覆盖 `_config.yml`
{% endraw %}

After a blank line, keep indenting 4 spaces and the content still belongs to the same block.

19.3 All syntax forms

FormRenderNotes
!!! note<div class="admonition note">Blue info block
!!! info / !!! tipadmonition blockTip-type
!!! warningYellow warning block
!!! danger / !!! error / !!! failureRed danger block
!!! successGreen success block
!!! bug / !!! question / !!! quote / !!! exampleMatching icon blockSemantic types
!!! note Custom titleTitle replaced with the given textA space then the text after the type becomes admonition-title

19.4 Parameters & options

ItemNotes
Typenote / 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)
TitleA space then the text after the type, no quotes; when omitted the type name is used (capitalised, e.g. Success/Danger)
ContentMust be indented 4 spaces, otherwise it does not enter the block
QuotesIf you hand-write "Title", typographer converts the straight quotes into curly “” and displays them too

19.5 Boundaries & pitfalls

CaseBehaviour
Content not indentedOnly the title enters the block; the body lands outside
Collapsible block ??? noteNot supported: the current plugin version (1.0.1) has no collapse syntax; ??? note is output verbatim (verified)
Misspelled type !!! cautoinThe type is accepted (no validation), but the theme has no matching color, so it renders as an unstyled block
Mixed with the §11 ::: containerTwo independent syntaxes: admon produces .admonition.<type>, container produces .<type>; the styles differ
Indented 2 spacesFewer than 4 spaces, treated as a normal paragraph
Title in quotesThe 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

PluginSyntaxRenderTest marker
emoji:smile:emoji characteremoji
abbr*[ABBR]: 全称<abbr>abbr
footnote[^1]footnotefootnote
ins++文本++<ins>ins
sub~文本~<sub>sub
sup^文本^<sup>sup
mark==文本==<mark>mark
task-checkbox- [x]checkboxtask-list-item
multimd-tabletable<table>table
imsize=200x100sized imageimg
container::: typenote containernote
deflist术语: 定义<dl>dl
mathjax3$公式$SVGmath
cjk-breaksautomaticCJK optimization-
attrs{#id .class key=val}element attributesclass/id
link-attributesexternal links autotarget=_blank + reltarget
admon!!! typecallout blockadmon

References

系列教程

全部文章RSS订阅

Hexo 主题功能测试系列


  1. 内容tag篇、交互视觉篇、布局页面篇、Markdown语法篇。 ↩︎


Hexo Theme Feature Test - Markdown Syntax
Posted on
August 8, 2026
reprint policy. If reproduced, please indicate source
Support
Comments
Data Loading...
 Previous

Read More

Hexo Theme Feature Test - Automated Testing
Hexo Theme Feature Test - Automated Testing Hexo Theme Feature Test - Automated Testing
Complete tutorial for the theme's automated testing system: testing pyramid (L1 build / L13 unit gate / L11 Playwright i
2026-09-11
Next 

Read More

Hexo Theme Feature Test - Layout & Pages
Hexo Theme Feature Test - Layout & Pages Hexo Theme Feature Test - Layout & Pages
Complete tutorial and test for matery theme layout and page features: post layout features (prev/next navigation, copyri
2026-08-07