Loading...

Loading...

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 in themes/matery/scripts/tags/index.js); admonition is provided by the markdown-it-container plugin (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 (raw paired with endraw), otherwise nunjucks pre-renders it and the build fails with unknown 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:

KeywordIconMeaning
defaultf0a9 (right arrow)plain hint
primaryf055 (plus)key emphasis
successf058 (check)operation succeeded
infof05a (info)supplementary
warningf06a (exclamation)caution
dangerf056 (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:

No left icon, but the warning-colored border is kept.

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.

PositionParameterRequiredDefaultDescription
1–2color keyword❌nonedefault / primary / info / success / warning / danger
1–2no-icon❌nonehides the left icon; interchangeable with the color position
3+collapse title❌noneall non-keyword arguments are joined into <summary>, rendered as Markdown
bodycontent❌empty stringrendered 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

CaseBehavior
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 keywordsonly 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 contentoutputs an empty div, no error
Forgetting {% endnote %}build fails with unclosed tag
Wanting a plain block but writing a titleimpossible — any non-keyword argument triggers collapsing; move the text into the body
Mixing with ::: containersdifferent 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).

PositionParameterRequiredDefaultDescription
arg 1 (before comma)overall title❌noneomitted = no overall title; rendered as Markdown
arg 2 (after comma)color class name❌noneappended to .timeline; valid values are decided by theme CSS (green / blue / red / orange etc.)
bodynode 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.js matches 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

CaseBehavior
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 commasplit(',') treats the second half as the color → title truncated
Wrong colorthe class name is still output, but no matching CSS exists, so it falls back to the default color
Just want a plain listskip timeline and write a Markdown list — lighter

2.7 Summary

  • Remember two things: node markers must be on their own line, and endtimeline must 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.

PositionParameterRequiredDefaultDescription
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
bodytab 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

CaseBehavior
No name[Tabs] Missing required tab name error log + the whole block outputs nothing
Two tabs on the same page with the same nameduplicate 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 commatruncated 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 Danger

Corresponding 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>">.

PositionParameterRequiredDefaultDescription
before @color❌defaultdefault / primary / success / info / warning / danger
after @text✅empty stringplain text (not Markdown; bold/links are not rendered)

When the text is empty, label.js calls log.warn('[Matery] Label text must be defined!') and renders an empty span.

4.4 Boundaries & pitfalls

CaseBehavior
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 labelnot supported; text is output verbatim
Multiple on one linesupported, 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 home

Corresponding 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 %}
### 5.3 Alias and text-only `` is the same function as ``; leaving the icon empty gives a text-only button (note the comma placeholder). **Effect**: About me Archives **Corresponding source**:
{% btn /about,About me,user-circle,About %}
{% button /archives,Archives,,Text-only button without an icon %}
### 5.4 Full parameters `button.js`: `args.join(' ').split(',')`, taking 4 values positionally. | Position | Parameter | Required | Default | Description | |---|---|---|---|---| | 1 | url | ✅ | — | target address, may be relative (`/`); when empty, `log.warn('URL can NOT be empty.')` and `href=""` | | 2 | text | ❌ | empty string | button label | | 3 | icon | ❌ | none | Font Awesome name; **when it does not start with `fa`**, `fa fa-` is prepended automatically, so `home` and `fa fa-home` are equivalent, while `fas fa-home` is kept as-is | | 4 | title | ❌ | none | hover tooltip text (**not a color**) | Output structure: `text`. ### 5.5 Advanced / composition - Buttons can be placed inside note / tabs / timeline content (all of them render Markdown). - For external links, add a title explaining the destination; for internal links use relative paths so they survive domain changes. - Look up icon names on [Font Awesome](https://fontawesome.com/search); a wrong name only yields an empty ``. ### 5.6 Boundaries & pitfalls | Case | Behavior | |---|---| | Text contains an ASCII comma | `split(',')` treats the rest as the icon → text truncated (the full-width comma `,` is safe) | | Icon written as `fas fa-home` | `startsWith('fa')` is true → no prefix added; outputs `` ✔ | | Icon written as `fa-home` | also no prefix → `class="fa-home"` lacks the `fa` base class, **the icon does not show** | | Only url, no text | renders a button with empty text (icon only, or nothing at all) | | Empty url (`,text`) | warning + `href=""` pointing at the current page | | Want a new window | the tag does not support `target`; hand-write `` | ### 5.7 Summary - **url first, text second, icon third, title fourth** - The easiest icon form has no prefix (`github`); don't write `fa-home` - Don't put ASCII commas in the text ## 6. githubCard > **Purpose**: show a GitHub repo info card (repo name / description / stars / branch count). > > **Learning path**: minimal example → size parameters → full parameters → advanced composition → boundaries & pitfalls → summary ### 6.1 Minimal example Arguments use the `key:value` form (colon-separated, space-separated between arguments); `user` is required. **Effect**:
**Corresponding source**:
{% githubCard user:appotry repo:hexo %}
### 6.2 Size parameters **Effect**:
**Corresponding source**:
{% githubCard user:appotry repo:hexo-theme-matery width:360 height:180 %}
### 6.3 Full parameters `github-card.js` splits each argument at its **first colon** into key/value, then turns them into `data-*` attributes for the front-end JS. | Parameter | Required | Default | Description | |---|---|---|---| | `user` | ✅ | — | GitHub username; when missing, a red error hint `缺少user参数` is output | | `repo` | ❌ | none | repo name; when omitted the card may show user info | | `width` | ❌ | decided by front-end JS | width; a `px` suffix is stripped automatically (`360px` → `360`) | | `height` | ❌ | decided by front-end JS | height; `px` stripped the same way | | `theme` | ❌ | `default` (attribute not output) | when the value equals `default`, no `data-theme` is written | | `target` | ❌ | `blank` (attribute not output) | when the value equals `blank`, no `data-target` is written | | `client_id` | ❌ | none | GitHub OAuth App client_id, used to raise the API limit | > **Security design**: `client_secret` is **not supported** — an OAuth secret in front-end HTML is public. For higher limits use `client_id` or a backend proxy. ### 6.4 Advanced / composition - Card content is fetched asynchronously from the GitHub API by front-end JS, so **the build output contains no repo data** and is not affected by Hexo's incremental cache. - Without JS a `
Comments
Data Loading...