Content Tag Plugins
This page summarizes the 14 content tag plugins of the matery theme: note, timeline, tabs, label, button, githubCard, mermaid, pdf, insertmd, wechat_dialog, groupimage, cardurl, admonition, encrypt. Each plugin gives its purpose, syntax, example and effect — examples can be copied directly into a post for testing.
How to read this page: every plugin is shown as matched pairs of Effect → Corresponding source — see the real render first, then copy the Markdown below it. All defaults in the parameter tables come from the actual code in
themes/matery/scripts/tags/*.js, not guesses.Unlike the inline bold-label style of the “Layout & Pages” chapter, this page uses third-level subheadings (minimal example / common variants / full parameters / advanced composition / boundaries & pitfalls / summary) because it needs to host code blocks and live rendering examples.
The first 12 are native theme tags (registered uniformly inthemes/matery/scripts/tags/index.js);admonitionis provided by themarkdown-it-containerplugin (7 container types registered in the root_config.yml: warning/note/info/attention/error/tip/hint).
Note: when showing{% xxx %}tag syntax inside a Markdown code block, you MUST wrap it with raw tags (rawpaired withendraw), otherwise nunjucks pre-renders it and the build fails withunknown block tag.
Basic Tag Plugins
1. note
Purpose: colored callout blocks inside posts, for warning / success / info / danger emphasis.
Learning path: minimal example → six colors → hiding the icon → collapsible → nesting → full parameters → boundaries & pitfalls → summary
1.1 Minimal example
No keyword at all — just a grey-bordered callout. The structure is only “opening tag + content + closing tag”.
Effect:
This is the simplest callout.
Corresponding source:
{% note %}This is the simplest callout.{% endnote %}1.2 Six colors
Effect:
default note — plain hint
primary note — key emphasis
success note — operation completed
info note — supplementary explanation
warning note — caution
danger note — serious warning
Corresponding source:
{% note default %}**default** note — plain hint{% endnote %}
{% note primary %}**primary** note — key emphasis{% endnote %}
{% note success %}**success** note — operation completed{% endnote %}
{% note info %}**info** note — supplementary explanation{% endnote %}
{% note warning %}**warning** note — caution{% endnote %}
{% note danger %}**danger** note — serious warning{% endnote %}Color reference:
| Keyword | Icon | Meaning |
|---|---|---|
default | f0a9 (right arrow) | plain hint |
primary | f055 (plus) | key emphasis |
success | f058 (check) | operation succeeded |
info | f05a (info) | supplementary |
warning | f06a (exclamation) | caution |
danger | f056 (cross) | serious warning |
1.3 Hiding the icon (no-icon)
no-icon is a modifier, not a color. It occupies the second keyword slot and can be swapped with the color order.
Effect:
Corresponding source:
{% note warning no-icon %}No left icon, but the warning-colored border is kept.{% endnote %}1.4 Collapsible
Any remaining argument after the first two keywords is joined into the collapse title and output as <details><summary>.
Effect:
Click to expand: why a static site is enough
A static site has no server, but build-time snapshots provide most dynamic capabilities.
Trade-offs
- Content updates require a rebuild
- Search is a local index, not a full-text search service
Corresponding source:
{% note info Click to expand: why a static site is enough %}
A static site has no server, but **build-time snapshots** provide most dynamic capabilities.
**Trade-offs**
- Content updates require a rebuild
- Search is a local index, not a full-text search service
{% endnote %}Both the title and the body go through Markdown — the title can be bold, and the body can hold lists and code. But do not write
###subheadings inside the note body: they render as real headings and enter the page TOC.
1.5 Nesting
The body goes through Markdown rendering, so any tag can be nested inside.
Effect:
Composition example
This block contains a label and bold text, plus inline code console.log(1).
Nested note
A note can nest another note; the inner one uses its own color.
Corresponding source:
{% note success Composition example %}
This block contains {% label primary@a label %} and **bold text**, plus inline code `console.log(1)`.
{% note warning Nested note %}
A note can nest another note; the inner one uses its own color.
{% endnote %}
{% endnote %}1.6 Full parameters
Arguments are split by spaces; note.js loops over at most 2 keywords as CSS classes, and everything else is joined into the collapse title.
| Position | Parameter | Required | Default | Description |
|---|---|---|---|---|
| 1–2 | color keyword | ❌ | none | default / primary / info / success / warning / danger |
| 1–2 | no-icon | ❌ | none | hides the left icon; interchangeable with the color position |
| 3+ | collapse title | ❌ | none | all non-keyword arguments are joined into <summary>, rendered as Markdown |
| body | content | ❌ | empty string | rendered as Markdown, may nest other tags |
All possible values: 6 colors + 1 modifier no-icon (not a color, only hides the icon).
Alias: {% subnote %} registers the same function as {% note %} (two tag.register lines in index.js point to the same postNote); behavior and styles are identical — it is not a “secondary” note.
1.7 Boundaries & pitfalls
| Case | Behavior |
|---|---|
First word is not a keyword (e.g. {% note hint text %}) | no color class is added; that word becomes the collapse title → you get an uncolored collapsible block, not a plain block |
| Writing 3 color keywords | only the first 2 are used; the 3rd becomes the collapse title |
Misspelled color (Warning in caps) | case-sensitive → not treated as a keyword; becomes the collapse title with no color |
| Empty content | outputs an empty div, no error |
Forgetting {% endnote %} | build fails with unclosed tag |
| Wanting a plain block but writing a title | impossible — any non-keyword argument triggers collapsing; move the text into the body |
Mixing with ::: containers | different output: the tag is <div class="note primary">, the container is <div class="note"> (CSS already distinguishes them with attribute selectors) |
1.8 Summary
- Most used:
note info/note warning— two or three words are enough - Want it collapsed: write the title right after the color
- Want a plain color block without an icon: add
no-icon - Want nesting: keep writing tags in the body (remember to close them in pairs)
2. timeline
Purpose: show events / version logs / growth history in time order — a vertical line with dots connecting dated nodes.
Learning path: minimal example → no title and color → Markdown inside nodes → full parameters → boundaries & pitfalls → summary
2.1 Minimal example
One title plus one node is a complete timeline. A node is wrapped by <!-- timeline date --> and <!-- endtimeline -->.
Effect:
Theme feature evolution
Corresponding source:
{% timeline Theme feature evolution,green %}
<!-- timeline 2026-08 -->
- Added the content tag test page (full tutorial for note/timeline/tabs/label etc.)
- Gallery data refactor (three forms in galleries.yml)
<!-- endtimeline %}
{% endtimeline %}2.2 No title
The first argument of timeline (before the comma) is the overall title; when the whole argument is omitted there is no overall title and nodes are listed directly.
Effect:
2026-07
- Comment architecture optimization (comment: waline)
- Fixed the MIME style error for href=/
Corresponding source:
{% timeline %}
<!-- timeline 2026-07 -->
- Comment architecture optimization (comment: waline)
- Fixed the MIME style error for href=/
<!-- endtimeline -->
<!-- timeline 2020 -->
- Created the blog, started deep matery customization
<!-- endtimeline %}
{% endtimeline %}2.3 Color and Markdown inside nodes
The second argument is a class name appended to div.timeline (green / blue / red / orange etc. — decided by CSS); both the title and node content go through Markdown.
Effect:
v13.27 release notes
v13.27 released
The Douban card was changed to a local implementation; covers are downloaded at build time.
Corresponding source:
{% timeline **v13.27** release notes,blue %}
<!-- timeline v13.27 [released](https://blog.17lai.site) -->
The Douban card was changed to a **local implementation**; covers are downloaded at build time.
<!-- endtimeline -->
<!-- timeline v13.26 -->
CSS variables + dark-mode adaptation, touching `style/` and `color-schema.styl`.
<!-- endtimeline -->
{% endtimeline %}2.4 Full parameters
timeline.js joins the arguments with join(' ') and splits on ,: args[0] is the title, args[1] is the color class name (no trimming — writing title, green yields a class name with a leading space; it still displays fine but is untidy).
| Position | Parameter | Required | Default | Description |
|---|---|---|---|---|
| arg 1 (before comma) | overall title | ❌ | none | omitted = no overall title; rendered as Markdown |
| arg 2 (after comma) | color class name | ❌ | none | appended to .timeline; valid values are decided by theme CSS (green / blue / red / orange etc.) |
| body | node blocks | ✅ | — | each node = <!-- timeline node title --> + content + <!-- endtimeline --> |
Node titles also go through Markdown (links, bold, inline code are fine). With no node block, only an empty timeline container is output.
2.5 Advanced / composition
- Node content can contain further tags (e.g.
{% label %},{% button %}) because node content is rendered as Markdown. - The number of nodes is unlimited;
timeline.jsmatches globally with a regex and outputs them in order of appearance. - The timeline is not a semantic
<time>structure — dates are just node title text, and ordering depends entirely on the order you write (it never sorts by date).
2.6 Boundaries & pitfalls
| Case | Behavior |
|---|---|
No newline after the node marker (<!-- timeline 2026 -->content on the same line) | the regex requires \n right after --> → that node is silently dropped |
<!--timeline 2026--> (missing space after timeline) | the regex requires timeline with a space → no match, node lost |
Forgetting <!-- endtimeline --> | all following content is swallowed into the previous node, or the whole node is lost |
| Title contains a comma | split(',') treats the second half as the color → title truncated |
| Wrong color | the class name is still output, but no matching CSS exists, so it falls back to the default color |
| Just want a plain list | skip timeline and write a Markdown list — lighter |
2.7 Summary
- Remember two things: node markers must be on their own line, and
endtimelinemust be closed - Title is optional: omit the argument when you don’t want an overall title
- Color is a CSS class name; a wrong value doesn’t error but has no effect
3. tabs
Purpose: multi-tab content switching, great for categorized display / step-by-step instructions / comparisons.
Learning path: minimal example → choosing the active tab → icons in tab titles → full parameters → boundaries & pitfalls → summary
3.1 Minimal example
The first argument is the required unique name (used to generate DOM ids); omitting it makes the build error and outputs an empty string.
Effect:
- Full-featured: content tags cover 10+ plugins
- Flexible config: every feature independently toggleable
- Many config options, learning curve at first
- Some features depend on external CDN
Corresponding source:
{% tabs Theme feature comparison %}
<!-- tab Pros -->
- Full-featured: content tags cover 10+ plugins
- Flexible config: every feature independently toggleable
<!-- endtab -->
<!-- tab Cons -->
- Many config options, learning curve at first
- Some features depend on external CDN
<!-- endtab -->
<!-- tab Best for -->
- Tech blogs: code / tutorials / comparisons
- Personal blogs: galleries / projects / history
<!-- endtab -->
{% endtabs %}3.2 Choosing the active tab
The second argument is the active index, starting at 1; omitted or 0 activates the first tab.
Effect:
Not active by default.
Shown by default when the page opens.
Corresponding source:
{% tabs Active index example,2 %}
<!-- tab First -->
Not active by default.
<!-- endtab -->
<!-- tab Second -->
Shown by default when the page opens.
<!-- endtab -->
<!-- tab Third -->
Not active either.
<!-- endtab %}
{% endtabs %}3.3 Icons in tab titles
Append @icon in the tab title to add a Font Awesome icon: text before @, “prefix:icon-name” after @.
Effect:
@fas:info-circle → <i class="fas fa-info-circle">
Corresponding source:
{% tabs Icon example %}
<!-- tab Intro @fas:info-circle -->
`@fas:info-circle` → `<i class="fas fa-info-circle">`
<!-- endtab -->
<!-- tab Download @fas:download -->
`@fas:download` → `<i class="fas fa-download">`
<!-- endtab %}
{% endtabs %}3.4 Full parameters
tabs.js first does args.join(' ').split(','): args[0] = name, Number(args[1]) || 0 = active index.
| Position | Parameter | Required | Default | Description |
|---|---|---|---|---|
| 1 (before comma) | unique name | ✅ | — | when missing, hexo.log.error is called and an empty string is returned (nothing shows on the page) |
| 2 (after comma) | active index | ❌ | 0 (= first) | counted from 1; non-numeric values are treated as 0 |
| body | tab blocks | ✅ | — | each tab = <!-- tab title --> + content + <!-- endtab --> |
Icon prefix values (processIcon’s prefixMap): fas / far / fal / fad / fab, plus aliases solid→fas, regular→far, light→fal, duotone→fad; with no prefix it defaults to far (regular).
Alias: subtabs and subsubtabs register the same function; syntax and behavior are identical (the names only express a nesting convention — they do not produce nested styles).
3.5 Advanced / composition
- Each tab’s content area is rendered as Markdown independently and can hold lists, tables, code, and other tags.
- DOM structure:
<div class="tag-common tabs" id="name-lowercased-spaces-to-dashes">+ul.nav-tabs+div.tab-content; switching is done by front-end JS adding.active. - The name is converted into an id: lowercase + spaces replaced by
-; Chinese characters are kept as-is.
3.6 Boundaries & pitfalls
| Case | Behavior |
|---|---|
| No name | [Tabs] Missing required tab name error log + the whole block outputs nothing |
| Two tabs on the same page with the same name | duplicate ids → clicking may switch the wrong group |
Active index out of range (e.g. ,9 with 3 tabs) | no tab gets .active → all collapsed, must be opened manually |
Content written on the same line after <!-- tab title --> | the regex requires \n after --> → that tab is dropped |
Forgetting <!-- endtab --> | following content is swallowed into the previous tab |
| Name contains a comma | truncated by split(','); the second half becomes the active index |
3.7 Summary
- Name is required, and unique on the page
- Content areas are full Markdown and can nest anything
- Active index starts at 1
4. label
Purpose: inline colored mini labels for keywords / status / category annotations.
Learning path: minimal example → six colors → full parameters → boundaries & pitfalls → summary
4.1 Minimal example
The argument order is counter-intuitive: color@text — color before @, text after @.
Effect:
This site is built with Hexo and themed with matery.
Corresponding source:
This site is built with {% label primary@Hexo %} and themed with {% label success@matery %}.4.2 Six colors
Effect:
Default Primary Success Info Warning DangerCorresponding source:
{% label default@Default %} {% label primary@Primary %} {% label success@Success %} {% label info@Info %} {% label warning@Warning %} {% label danger@Danger %}4.3 Full parameters
label.js: args.join(' ').split('@') → classes = args[0] || 'default', text = args[1] || '', output as <span class="label label-<classes>">.
| Position | Parameter | Required | Default | Description |
|---|---|---|---|---|
before @ | color | ❌ | default | default / primary / success / info / warning / danger |
after @ | text | ✅ | empty string | plain text (not Markdown; bold/links are not rendered) |
When the text is empty,
label.jscallslog.warn('[Matery] Label text must be defined!')and renders an empty span.
4.4 Boundaries & pitfalls
| Case | Behavior |
|---|---|
Only {% label text %} (no @) | text is empty → renders an empty label + build warning; text is treated as the color class |
Misspelled color (label-warningx) | outputs class="label label-warningx"; no matching CSS → only the base .label style remains |
Text contains @ ({% label info@a@b %}) | split('@')[1] takes only a; b is dropped |
| Want bold/links inside the label | not supported; text is output verbatim |
| Multiple on one line | supported, separate with spaces (see 4.2) |
4.5 Summary
- Always
color@text— forget the@and you get an empty label - Text does not support Markdown
- Values outside the 6 colors don’t error but have no styling
5. button
Purpose: CTA buttons inside posts, for links / downloads / action entries.
Learning path: minimal example → icon and title → alias and text-only → full parameters → boundaries & pitfalls → summary
5.1 Minimal example
The link is the first argument (source: url=args[0], text=args[1]), the opposite of label’s “modifier first”.
Effect:
Back homeCorresponding source:
{% button /,Back home %}5.2 Icon and title
The third argument is a Font Awesome icon name; the fourth is the hover tooltip (not a color).
Effect:
Visit GitHub All tags **Corresponding source**:{% button https://github.com/appotry,Visit GitHub,github,Open the author's homepage %}
{% button /tags,All tags,tags %}{% btn /about,About me,user-circle,About %}
{% button /archives,Archives,,Text-only button without an icon %}{% githubCard user:appotry repo:hexo %}{% githubCard user:appotry repo:hexo-theme-matery width:360 height:180 %}