This article is both a complete usage tutorial for matery theme interaction & visual features and an automated test arena.
Covers: code block enhancements, image lightbox, typewriter, page effects, simplified/traditional Chinese conversion, reading progress bar, back-to-top, reward popup, print styles.How to read: for every feature, look at the Effect first (real rendering or behavior description), then the Corresponding config (the minimal snippet that produces that effect); when you need to look up parameters, jump straight to the “All tunable keys” table.
── Code & Print ──
1. Code Block Enhancements
Purpose: code blocks automatically carry a language label and provide copy / expand / collapse / fullscreen operations; overly long code is height-limited.
Learning path: turn on language labels → configure copy and expand buttons → tune the height limit → full parameter table → boundaries & conflicts
1.1 How to enable
Effect (the code blocks below are the real rendered result: language label in the top-right corner + copy button, and an “expand” bar at the bottom of long blocks):
# Bash: system operations
sudo apt update
docker compose up -d
systemctl status nginx# Python: data processing
def process(data):
"""Process data and return results"""
result = [x * 2 for x in data if x > 0]
return result
print(process([1, -2, 3, 4]))// JavaScript: async requests
async function fetchData(url) {
const response = await fetch(url);
const data = await response.json();
console.log("Data:", data);
}# YAML: config file
server:
host: 0.0.0.0
port: 8080
workers: 4Corresponding config (minimal working: language label + copy button, everything else off):
code:
language:
enable: true
default: "TEXT"
copy_btn: trueStandard Markdown code blocks are enough — no extra syntax needed; the four blocks above are plain triple-backtick + language name.
1.2 Common options
① Height limit & expand (the most common combination)
Effect: the long Python block below exceeds the 450px height threshold, is collapsed by default, shows an “expand” bar at the bottom, and displays in full after clicking (no more height limit):
# Python: long code example (exceeds 450px height threshold, triggers "expand" button)
# Simulates a simple blog post processing pipeline
import hashlib
import json
import re
from collections import Counter
from datetime import datetime
from pathlib import Path
def read_posts(directory):
"""Read all Markdown posts in a directory"""
posts = []
for path in Path(directory).glob("*.md"):
posts.append(path.read_text(encoding="utf-8"))
return posts
def extract_front_matter(content):
"""Extract Front-Matter metadata"""
match = re.match(r"^---\n(.*?)\n---\n", content, re.DOTALL)
if not match:
return {}
meta = {}
for line in match.group(1).splitlines():
if ":" in line:
key, value = line.split(":", 1)
meta[key.strip()] = value.strip()
return meta
def analyze_posts(directory):
"""Main analysis flow: word frequency, summary generation, word count"""
all_words = Counter()
for content in read_posts(directory):
meta = extract_front_matter(content)
body = re.sub(r"^---\n.*?\n---\n", "", content, flags=re.DOTALL)
text = re.sub(r"[#*`>\[\]()]", "", body)
words = re.findall(r"[\u4e00-\u9fa5]|[a-zA-Z]+", text)
all_words.update(words)
word_count = len(words)
summary = " ".join(words[:20])
checksum = hashlib.md5(content.encode()).hexdigest()[:8]
print(f"{meta.get('title', 'untitled')} | {word_count} words | {checksum}")
print(f" Summary: {summary}...")
print(f"\nTotal unique words analyzed: {len(all_words)}")
return all_words
if __name__ == "__main__":
result = analyze_posts("content/posts")
top_words = result.most_common(10)
print("Top 10 frequent words:")
for word, count in top_words:
print(f" {word}: {count}")Corresponding config:
code:
height_limit: "450px" # auto-collapse above this height
show_full: true # show an "expand" button at the bottom of collapsed blocks
shrink: true # provide a "collapse" button② Language label fallback text
Effect: for an unrecognized language (or a block with no language), the label position shows the text specified by default; the default value is TEXT.
Corresponding config:
code:
language:
enable: true
default: "TEXT" # change to "CODE" and the label shows CODE③ Copy button
Effect: a copy button appears in the top-right corner; clicking it copies the whole block.
Corresponding config:
code:
copy_btn: true # false = only the language label remains in the top-right corner④ Fullscreen button
Effect: a fullscreen button appears in the code block toolbar; clicking it makes that code block fill the viewport (this is also “code fullscreen” in §17).
Corresponding config:
code:
show_expand: trueWhether the fullscreen button appears also depends on resource loading — this section does not verify every combination; other values are unverified.
⑤ Wide line wrapping / horizontal scrolling
Effect: with break: false, wide lines do not wrap and scroll horizontally instead (this article uses this value).
Corresponding config:
code:
break: false⑥ Expand internals (why clicking removes the height limit)
Effect: after clicking “expand”, the container maxHeight is set to scrollHeight (full height, no inner scrollbar — scrolling is handed to the page); clicking “collapse” restores maxHeight to empty, back to the 450px of --code-max-height.
Corresponding mechanism (code-area component, not a config key):
- Height limit:
code.height_limit(default"450px") lands in the CSS variable--code-max-height - Expand: a
scroll-down-barexpand bar appears at the bottom of the collapsed state; clicking it sets the containermaxHeighttoscrollHeightvia JS - Horizontal scrolling: the code container uses
overflow-x: auto - Fullscreen:
code.show_expand: trueprovides fullscreen viewing
Test assertion: page contains
code-areamarker (at least 4 code blocks); readmode use case (L11) verifies code is fully displayed after expansion.
1.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
code.language.enable | bool | true | true / false | Top-right language label switch |
code.language.default | string | "TEXT" | any string | Label text shown when the language cannot be recognized |
code.copy_btn | bool | true | true / false | Copy button |
code.show_full | bool | true | true / false | Expand/collapse button for long code |
code.shrink | bool | true | true / false | Manual collapse button |
code.height_limit | string | "450px" | CSS length with units (px etc.) | Auto-collapse above this height |
code.break | bool | — | false (this file uses this value) | Whether wide lines wrap; false means horizontal scrolling |
code.show_expand | bool | — | true / false | Code block fullscreen button |
1.4 Boundaries & conflicts
height_limitlands in the CSS variable--code-max-height; on expand JS setsmaxHeightdirectly toscrollHeight(no longer bound by that value), and restores it on collapse.copy_btn/show_full/shrinkare three independent buttons that can be combined freely; turning all off leaves a bare code block.- The language label is only output when
language.enable: true; unrecognized languages fall back tolanguage.default. - Any change in this section requires a clean build to take effect (see Pitfalls #5).
Code Block Delegation Idempotency (codeWidget)
Encrypted wiki page code block buttons (collapse/copy) fail on click. Root cause: codeWidget() is called multiple times (page load + post-decryption refresh), accumulating click delegates on document; classList.toggle executes an even number of times, producing no net effect. Fix: named handler (_codeWidgetClickHandler) calls removeEventListener before add; Prism fallback callback gets _codeWidgetPrismRegistered idempotency flag.
Test assertion:
readmode-integration.test.js“codeWidget second invocation still works with single click”.
Wiki Page Line Numbers (prism line-numbers)
Wiki documentation pages (layout/wiki.ejs) render code blocks with prism and enable line-numbers, coexisting with the article page code block enhancements (toolbar).
Test assertion: TC-L15 G5 (
tools/tests/wiki-prism-integration.test.js, 4 assertions): tutorial page loads / prism-core / code blocks / line-numbers.
1.5 Summary
- Minimal:
language.enable+copy_btnis enough - Afraid of exploding long posts: tune
height_limit;show_fullprovides the “expand” bar - Want fewer wrapped lines:
break: truewraps instead of horizontal scrolling - Changes not taking effect: almost always cache — clean build (Pitfall 5)
── UI Interaction & Motion ──
2. Image Lightbox (lightGallery)
Purpose: click post images to enlarge for browsing, with zoom/paging/download support.
Learning path: enable the lightbox → plain images are enough → size injection preprocessing → full parameters → boundaries & conflicts
2.1 How to enable
Effect (real rendering: shadow + border on hover, click opens a fullscreen lightbox with zoom and paging, alt shown as the caption):


Corresponding config:
# Post images are automatically wrapped as .img-item by articleInit
image_zoom:
enable: true2.2 Common options
① Plain Markdown images are enough
Effect: body <img> elements are wrapped into .img-item by articleInit(), and clicking opens the .lg-outer lightbox (that is the behavior of the two images above).
Corresponding config (Markdown source, no extra attributes):
② Remote image size mapping
Effect: CDN images matching the mapping table read the local file for their true dimensions (saving one network request); misses are fetched asynchronously — the image does not jump when the lightbox opens (prevents CLS).
Corresponding config:
image_size_plugin:
map_paths:
<CDN path>: <local file path>The full structure of
map_pathsis not expanded in this file; other values are unverified.
③ Lightbox library source
Effect: determines the library implementing the lightbox capability; pointing it at an unreachable address disables the lightbox entirely.
Corresponding config:
libs:
js:
lightgallery: <CDN address or local path>The full value shape of
libs.js.lightgalleryis not expanded in this file; other values are unverified.
2.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
image_zoom.enable | bool | true | true / false | Lightbox master switch |
libs.js.lightgallery | string | — | library URL (public CDN or local path) | lightGallery library source |
image_size_plugin.map_paths | map | — | CDN path → local file path | Map remote images to local files for sizing |
The full value shape of
libs.js.lightgalleryis not expanded in this file; other values are unverified.
2.4 Boundaries & conflicts
- The lightbox depends on
imgsize.jsinjectingwidth/heightfirst: script order is fixed, and skipping size injection makes the lightbox trigger reflow (CLS) on open. - It only applies to body images (wrapped as
.img-itembyarticleInit()); banners/covers/card thumbnails are out of scope. - The size cache
image_sizes_cache.jsonhas a 30-day TTL and a 5000-entry cap; older entries are evicted and their images re-measured.
Image Size Injection Preprocessing (imgsize.js)
Before the lightbox opens, the theme script scripts/events/lib/imgsize.js injects real width/height into all <img> elements on the page (prevents CLS):
- Local images: synchronously reads file dimensions and injects directly
- Remote images: cache hit uses cached values; CDN→local mapping (
image_size_plugin.map_paths) reads local file; others fetched asynchronously - Persistent cache:
image_sizes_cache.json(30-day TTL, 5000-entry cap) - Regex compatibility: matches src in three forms (double-quoted / single-quoted / unquoted), compatible with hexo-minify’s quote stripping
This script runs before lightbox binding, ensuring articleInit() wrapping img → .img-item already has dimension attributes, so the lightbox opening doesn’t trigger reflow.
Test assertion: images are wrapped as
.img-item, clicking opens.lg-outer.
2.5 Summary
- Works out of the box:
image_zoom.enable: true, then write plain Markdown images - Body images only: covers/thumbnails never enter the lightbox
- First-screen jumping: check whether
imgsize.jsruns before the lightbox rather than changing lightbox parameters
3. Typewriter (Typed)
Purpose: character-by-character typing animation for the banner subtitle / post title.
Learning path: enable subtitle typing → loop and cursor → speed tuning → full parameters → boundaries & conflicts
3.1 How to enable
Effect: the homepage banner subtitle types out character by character, pauses when done, deletes itself, then types the next line; the page contains #typed and .typed-cursor markers.
Corresponding config:
subtitle:
enable: true
typed:
enable: true
subtitle.enableis the host switch — turn it off and the subtitle disappears entirely, leaving the typewriter without a host.
3.2 Common options
① Loop rotation
Effect: loop: true deletes and retypes after each round; loop: false types only once (whether the cursor remains afterward and other combinations are unverified).
Corresponding config:
subtitle:
typed:
loop: true② Cursor appearance
Effect: with showCursor: true a blinking cursor (.typed-cursor) sits at the end, and its character is set by cursorChar — this file uses the underscore _.
Corresponding config:
subtitle:
typed:
showCursor: true
cursorChar: "_"③ Speed and start delay
Effect: smaller typeSpeed types faster, smaller backSpeed deletes faster (50 < 80 means deleting is faster than typing), and startDelay is the pause before typing starts.
Corresponding config:
subtitle:
typed:
startDelay: 100 # start delay (ms)
typeSpeed: 80 # typing speed (ms/char)
backSpeed: 50 # deleting speed (ms/char)④ Post title typewriter
Effect: the post page title also types out character by character (a separate switch from the banner subtitle).
Corresponding config:
post:
typed:
enable: true3.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
subtitle.enable | bool | true | true / false | Whether the banner subtitle is shown (the typewriter’s host) |
subtitle.typed.enable | bool | true | true / false | Banner subtitle typewriter switch |
subtitle.typed.loop | bool | true | true / false | Whether to loop |
subtitle.typed.showCursor | bool | true | true / false | Whether to show the cursor |
subtitle.typed.cursorChar | string | "_" | any single character | Cursor character |
subtitle.typed.startDelay | number | 100 | milliseconds | Delay before starting |
subtitle.typed.typeSpeed | number | 80 | milliseconds/char | Typing speed (smaller is faster) |
subtitle.typed.backSpeed | number | 50 | milliseconds/char | Deleting speed (50 < 80 means deleting is faster than typing) |
post.typed.enable | bool | true | true / false | Post title typewriter switch |
3.4 Boundaries & conflicts
subtitle.typed.*hangs off the subtitle: withsubtitle.enable: falsethe subtitle is not shown at all, so the typewriter has no host.loop: falsetypes only once (whether the cursor remains afterward and other combinations are unverified).typeSpeed/backSpeed/startDelayare all in milliseconds; writing strings (e.g."80ms") is outside the scope verified by these snippets.- Changing this section requires a clean build (see Pitfalls #5).
3.5 Summary
- Just want the typewriter:
subtitle.enable+subtitle.typed.enable, two lines - Too slow: lower
typeSpeed/backSpeed - Post title not animating: that is
post.typed.enable, unrelated to the banner
Test assertion: page contains
#typedor.typed-cursormarker.
4. Page Effects
Purpose: decorative effects — page/background effects (cherry blossoms / water ripples / falling leaves / snowfall / snowflakes / network / ribbons, etc.) and mouse/click effects (hearts / stars / fireworks, etc.), each group mutually exclusive single-select.
Learning path: turn on the master switch → pick one page effect → pick one mouse effect → desktop gate → full parameters → conflicts
4.1 How to enable
Effect: the selected decoration animation appears on the page (e.g. cherry blossoms falling continuously), and the selected click effect appears on mouse move/click; by default nothing loads on mobile.
Corresponding config (page effect only, mouse effect left off):
effects:
enable: true
page:
default: sakura # cherry blossoms
mouse:
default: off4.2 Common options
① Page/background effects (single-select)
Effect: only the one specified by default takes effect — sakura shows cherry blossoms, ripples shows ripples, off adds nothing.
Corresponding config:
effects:
page:
default: off # off | random | specific id
available:
sakura: { label: Cherry Blossoms, lib: sakura }
ripples: { label: Water Ripples, lib: ripples }
leaf: { label: Falling Leaves, lib: leaf }
snowdown: { label: Snowfall, lib: snowdown }
snowflake: { label: Snowflakes, lib: snowflake }
buble: { label: Bubbles, lib: buble }
canvas_nest: { label: Network, lib: canvas_nest }
ribbon: { label: Ribbons, lib: ribbon }
ribbon_dynamic: { label: Dynamic Ribbons, lib: ribbon_dynamic }② Mouse/click effects (single-select)
Effect: the corresponding feedback appears on click or mouse move — clicklove hearts, mouseStar stars, fireworks explosions, popupText popup text.
Corresponding config:
effects:
mouse:
default: off
available:
clicklove: { label: Hearts, lib: clicklove }
popupText: { label: Popup Text, lib: popupText }
mouseStar: { label: Stars, lib: star }
fireworks: { label: Fireworks, lib: fireworks }③ Inject on desktop only
Effect: with desktop_only: true the effect scripts do not load on mobile at all (saves battery and bandwidth); setting false loads them on mobile too.
Corresponding config:
effects:
desktop_only: true④ Runtime switching (no code changes)
Effect: open the bottom-right floating panel to switch page/mouse effects; the choice is written to localStorage and takes priority over the default in config.
Corresponding config (no config change needed; values live in the browser):
# localStorage keys (written at runtime, not _config.yml)
# matery.effect.page → page effect id
# matery.effect.mouse → mouse effect id4.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
effects.enable | bool | true | true / false | Effects master switch |
effects.desktop_only | bool | true | true / false | Whether to inject on desktop only |
effects.page.default | string | off | off / random / any id in available | Default page effect (single-select) |
effects.page.available.<id>.label | string | — | any display name | Panel/menu display text |
effects.page.available.<id>.lib | string | — | sakura ripples leaf snowdown snowflake buble canvas_nest ribbon ribbon_dynamic | Library actually loaded |
effects.mouse.default | string | off | off / random / any id in available | Default mouse effect (single-select) |
effects.mouse.available.<id>.label | string | — | any display name | Panel/menu display text |
effects.mouse.available.<id>.lib | string | — | clicklove popupText star fireworks | Library actually loaded |
Key names (
<id>) can be customized, butlibmust be one of the library identifiers listed above; otherlibvalues are unverified.
4.4 Boundaries & conflicts
pageandmouseare each single-select: configuring several in the same group means only the one indefaulttakes effect.- With
desktop_only: truethedesktopGateapplies: width >BP.fun(1400px, falls back to 992 ifBPis undefined) and localStorageviewCount> 1;desktop_only: falseskips the gate and loads on mobile too. - The runtime panel writes localStorage
matery.effect.page/matery.effect.mouse, which take priority over thedefaultin config. - Changing the
effectsblock requires a clean build (see Pitfalls #5).
Activation conditions (desktopGate, when desktop_only is enabled)
- Desktop width >
BP.fun(1400px, falls back to 992 if BP is undefined) - localStorage
viewCount> 1 (prevents loading on first visit) - With
desktop_only: falsethe gate is skipped (loads on mobile too)
Test assertion: effect scripts load according to gate (
windowWidth > BP.fun) + page/mouse mutual exclusion works.
4.5 Summary
- Minimal:
effects.enable+ one line ofpage.defaultpicks the effect - Multiple in one group is useless: only
defaulttakes effect - Nothing on desktop: check the width is > 1400px first, then
viewCount(not loaded on first visit) - Changed your mind: switch from the floating panel instead of editing config repeatedly
── Internationalization & Architecture ──
Note: This partition is grouped for reading navigation. §6–§8 functionally belong to “UI Interaction”, “UI Interaction”, and “Code & Print” respectively.
5. Simplified/Traditional Chinese Conversion
Purpose: one-click switching between traditional and simplified Chinese on the page.
Learning path: turn on the switch → footer button → choose how it is remembered → full parameters → boundaries & conflicts
5.1 How to enable
Effect: a “Traditional/Simplified” toggle link appears in the footer (page contains #translateLink); clicking converts all page text between the two forms.
The conversion is done by the JS languageToggle (a traditional/simplified character-table mapping). The user’s choice is written to localStorage (key targetEncoding_<host>, and also set as a cookie), and is reused automatically on the next visit.
Corresponding config (migrated into the preference block on 2026-08-16, site-wide language config unified on 2026-09-08):
preference: # Language preference aggregation (old footer.translate removed)
translate:
enable: true # Traditional/simplified conversion switch5.2 Common options
① Turn off the entry point
Effect: #translateLink is no longer output and the footer shows no toggle link; but a user’s saved choice is not cleared.
Corresponding config:
preference:
translate:
enable: false② Where the user’s choice is remembered
Effect: the choice is stored in the cookie targetEncoding_<host> (not localStorage); clearing the cookie returns to simplified by default.
Corresponding mechanism (no config key, description only):
cookie: targetEncoding_<host>5.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
preference.translate.enable | bool | true | true / false | Footer “Traditional/Simplified” toggle switch |
The old
footer.translatehas been removed; other key names not migrated do not appear in this file, and other values are unverified.
5.4 Boundaries & conflicts
- The old
footer.translateis no longer read — leaving that block behind does not error, but it has no effect. #translateLinkis only output whenenable: true; after turning it off, an already-saved choice is not cleared.- The choice is stored in the cookie
targetEncoding_<host>(not localStorage); clearing the cookie returns to simplified by default.
5.5 Summary
- Only one config line:
preference.translate.enable - Configured but no reaction: check whether you are still writing the removed
footer.translate - Cannot clear the conversion: clear the
targetEncoding_<host>cookie
Test assertion: page contains
#translateLinkor toggle button.
6. Reading Progress Bar / Back to Top
Purpose: reading progress indicator + one-click back to top.
Learning path: enable the progress bar → tune height and color → enable back-to-top → swap the library → full parameters → boundaries
6.1 How to enable
Effect: a thin progress bar appears at the top of the page and grows from left to right as you scroll; a back-to-top button appears in the bottom-right corner (click for smooth scroll to top).
Corresponding config:
fun_features:
progressbar:
enable: true
# Back to top button
backTop:
enable: true6.2 Common options
① Progress bar height
Effect: the thickness of the top progress bar changes (3 means 3px).
Corresponding config:
fun_features:
progressbar:
height_px: 3 # plain number, do not write "3px"② Progress bar color
Effect: the progress bar takes on any CSS color you supply (this file uses the blue #29d).
Corresponding config:
fun_features:
progressbar:
color: "#29d"③ Progress bar library source
Effect: the progress bar is implemented on the ScrollProgress library, whose address can be swapped for a public CDN or a local path; an unreachable address removes the bar entirely.
Corresponding config:
libs:
js:
scrollProgress: https://lib.baomitu.com/scrollprogress/3.0.2/scrollProgress.min.js④ Recalculate after dynamic content
Effect: after decryption / pagination / pull-to-load and other content changes, refreshLayout() is called to destroy the old instance and recalculate — preventing stacked listeners from miscalculating progress.
Corresponding mechanism (registered as a layout callback, no config key):
Matery.events.registerLayoutCallback(function () { /* recalculate progress */ });
Matery.events.refreshLayout();6.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
fun_features.progressbar.enable | bool | true | true / false | Reading progress bar switch |
fun_features.progressbar.height_px | number | 3 | pixel value (unitless) | Progress bar height |
fun_features.progressbar.color | string | "#29d" | any CSS color | Progress bar color |
backTop.enable | bool | true | true / false | Back-to-top button switch |
libs.js.scrollProgress | string | public CDN address (shown in the snippet) | CDN or local path /libs/scrollprogress/scrollProgress.min.js | Progress bar library source |
6.4 Boundaries & conflicts
height_pxis a plain number (the key name carries a_pxsuffix); do not write"3px".- Pointing
libs.js.scrollProgressat an unreachable address removes the progress bar entirely (there is no built-in fallback implementation). - The two features are independent: turning off the progress bar does not affect back-to-top, and vice versa;
backTopis a top-level key, not underfun_features. - Changing this section requires a clean build (see Pitfalls #5).
Test assertion: page contains
.progress-baror#backTop; TC-L15 G6 (tools/tests/core-events-integration.test.js, 2 assertions): layout callback registered >= 1 andrefreshLayout()does not throw.
6.5 Summary
- Two features, two key locations:
fun_features.progressbarand the top-levelbackTop, mutually independent - Height unit written wrong:
height_pxonly accepts a number - Progress bar not moving: first check whether
libs.js.scrollProgressis reachable
7. Reward Popup
Purpose: post reward button + WeChat/Alipay QR code popup dialog.
Learning path: enable the global entry point → change the title → configure both QR codes → override per post → full parameters → boundaries
7.1 How to enable
Effect: a “Reward” button appears at the bottom of the post (page contains #reward); clicking it opens a QR code dialog with Alipay/WeChat tabs, dismissible via the close button or by clicking the overlay.
Corresponding config:
post:
reward:
enable: true
title: "Thanks for reading! Consider tipping the author!"
wechat: /medias_webp/reward/wechat.webp
alipay: /medias_webp/reward/alipay.webp7.2 Common options
① Dialog title
Effect: the title at the top of the dialog becomes the supplied text (this file uses “Thanks for reading! Consider tipping the author!”).
Corresponding config:
post:
reward:
title: "Thanks for reading! Consider tipping the author!"② The two payment QR codes
Effect: these determine the QR images shown in the “WeChat” and “Alipay” tabs respectively; configuring only one leaves the other tab with no image to show (whether the tab is hidden is unverified).
Corresponding config:
post:
reward:
wechat: /medias_webp/reward/wechat.webp
alipay: /medias_webp/reward/alipay.webp③ Per-post override of the global setting
Effect: writing reward: true in front-matter enables rewards for that post (even if the global switch is off); omitting it follows the global post.reward.enable.
Corresponding config:
reward: true # Enable reward for this post (optional, follows global setting by default)7.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
post.reward.enable | bool | true | true / false | Global reward entry point switch |
post.reward.title | string | "Thanks for reading! Consider tipping the author!" (as shown) | any string | Dialog title |
post.reward.wechat | string | — | image path (webp/png recommended) | WeChat payment QR code |
post.reward.alipay | string | — | image path | Alipay payment QR code |
post front-matter reward | bool | — | true / false | Per-post override of the global switch |
7.4 Boundaries & conflicts
- When front-matter has no
reward, the globalpost.reward.enableapplies; when present, the post value wins. - With only one QR code configured, the other tab has no image to show (whether the tab is hidden is unverified).
- Image paths are site-relative and go through CDN replacement; when switching to an external image, confirm it can be linked directly.
7.5 Summary
- Enable globally:
post.reward.enable: true, then configure both QR codes - Per-post control: front-matter
reward: true/false - Opened but no image: check whether the path was replaced by the CDN with an unreachable address
Test assertion: page contains
#reward+ reward button.
8. Print Styles
Purpose: layout optimization when printing articles.
Learning path: turn on the switch → check print preview → full parameters → boundaries
8.1 How to enable
Effect: applies only under @media print — print preview hides navigation/sidebar/footer, centers the body with optimized whitespace, and shows link URLs; there is no visible difference on screen at all.
Corresponding config:
print:
enable: true8.2 Common options
① Turn off print optimization
Effect: browser printing returns to the page as-is — navigation/sidebar are printed as usual, and pagination and whitespace are not optimized.
Corresponding config:
print:
enable: false8.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
print.enable | bool | true | true / false | Print styles switch |
8.4 Boundaries & conflicts
- Only affects
@media print: nothing differs on screen, so it must be verified in the browser’s print preview. - Hiding navigation/sidebar/footer is pure CSS; it does not change the DOM and does not affect on-screen interaction.
- After turning it off, browser printing is still the page as-is (neither pagination nor whitespace is optimized).
8.5 Summary
- Only one line:
print.enable - Special verification: you must look at print preview, not hunt for differences on screen
- Zero risk: pure CSS, no effect on screen
Test assertion: CSS contains
@media printrules.
── Media & Data Visualization ──
Note: This partition is grouped for reading navigation. §13–§14 belong to “UI Interaction”, §15/§18 belong to “Architecture”, §16–§17 belong to “UI Interaction”.
9. Music Player (APlayer)
Purpose: embed a music player in posts/sidebar (MetingJS parsing + APlayer playback).
Learning path: turn on the switch → pick the source and type → fill in the id → fixed bottom → full parameters → boundaries
9.1 How to enable
Effect: a music card appears on the page (cover + playback controls + progress bar, page contains the aplayer container marker), adapting automatically to dark mode.
Corresponding config:
music:
enable: true
server: netease # netease/tencent/kugou/xiami/baidu
type: playlist # song/playlist/album/search/artist
id: 190133732 # NetEase playlist/song ID9.2 Common options
① Source and parse type
Effect: server determines which platform to parse from, and type determines what id means — playlist + a playlist ID yields a list, song + a song ID yields a single track. The two must be paired.
Corresponding config:
music:
server: netease
type: playlist
id: 190133732② Fixed bottom mode
Effect: with fixed: true the player is pinned to the bottom of the page, mutually exclusive with the inline card form (only one at a time).
Corresponding config:
music:
fixed: false # true = fixed at bottom mode③ Autoplay
Effect: autoplay: true attempts to start playback automatically; but browser autoplay policies usually prevent actual sound without user interaction.
Corresponding config:
music:
autoplay: false④ Theme color
Effect: the playback controls take on any CSS color you supply (this file uses the green #42b983).
Corresponding config:
music:
theme: '#42b983'9.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
music.enable | bool | true | true / false | Music player switch |
music.server | string | netease | netease / tencent / kugou / xiami / baidu | Music source |
music.type | string | playlist | song / playlist / album / search / artist | Parse type (determines what id means) |
music.id | string | number | — | ID/keyword matching type | Playlist/song/album/artist ID |
music.fixed | bool | false | true / false | Fixed bottom mode |
music.autoplay | bool | false | true / false | Autoplay |
music.theme | string | '#42b983' | any CSS color | Player theme color |
9.4 Boundaries & conflicts
typeandidmust be paired: changingplaylisttosongwhile keeping a playlist ID resolves no tracks.- With
fixed: truethe player is pinned to the bottom of the page, mutually exclusive with the inline card form (only one at a time). autoplay: trueis subject to browser autoplay policies and usually produces no sound without user interaction.- Third-party source availability depends on upstream; services such as
xiamihave shut down, so the config can still be written but may return nothing (not verified in this file).
9.5 Summary
- Minimal:
enable+server+type+id - Changed the type, change the id:
type/idare a pair - Cannot autoplay: expected, a browser policy limitation
Test assertion: page contains
aplayercontainer marker.
10. Video Player (DPlayer)
Purpose: embed a video player in posts (supports HLS/live streams, etc.).
Learning path: turn on the switch → write the tag → full parameters → boundaries
10.1 How to enable
Effect: a video player appears in the body (play/pause/progress/volume, supports danmaku), and the page contains the dplayer container marker.
Corresponding config:
dplayer:
enable: true10.2 Common options
① Specify the video source
Effect: the player loads the video pointed to by url; a local path plays a local file.
Corresponding config (write the tag in the body, not YAML):
{% dplayer url=/medias_webp/video/demo.mp4 %}10.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
dplayer.enable | bool | true | true / false | DPlayer resource loading and tag rendering switch |
tag parameter url | string | — | video address (local or remote) | Video source |
Other tag parameters (danmaku etc.) do not appear in this file; other values are unverified.
10.4 Boundaries & conflicts
- With
dplayer.enable: falsethe tag outputs no player (not even a container) — it is not “an empty player is shown”. - The tag in the example is body-rendered content and is itself unaffected by this article’s config — that config is site-level.
- If the local video path is wrong, the player still renders and the video just 404s (showing a black screen).
10.5 Summary
- Site-level switch + body tag are two separate things; do not conflate them
- Black screen, check the path first: a successfully rendered player does not mean the video exists
- Turning it off removes rendering entirely: it does not leave an empty player
Test assertion: page contains
dplayercontainer marker.
11. Bilibili Video Card
Purpose: embed Bilibili videos (iframe or card).
Learning path: turn on the switch → write the BV number → optionally override the address → full parameters → boundaries
11.1 How to enable
Effect: a Bilibili player iframe appears in the body, and the page contains bilibili-related container markers.
Corresponding config:
bilibili:
enable: true11.2 Common options
① Embed by BV number
Effect: the BV number in the tag determines which video plays (the example in this file works this way).
Corresponding config (write the tag in the body):
{% bilibili BV1oa4y1L7mw %}② Globally override the player address
Effect: when iframeUrl is configured it wins and the BV number from the tag is ignored (suitable for a fixed embed of a live/player page).
Corresponding config:
bilibili:
# iframeUrl: //player.bilibili.com/player.html?aid=xxx&bvid=xxxIn this file’s snippet
iframeUrlis commented out; how to enable it and other values are unverified.
11.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
bilibili.enable | bool | true | true / false | Bilibili card/tag switch |
bilibili.iframeUrl | string | — (commented out in the snippet) | full player URL | Optional: overrides the address generated by the tag |
In this file’s snippet
iframeUrlis commented out; how to enable it and other values are unverified.
11.4 Boundaries & conflicts
- Without
iframeUrlit works from the BV number passed by the tag (as the example in this file does); with it configured,iframeUrlwins. - With
enable: falsethe tag does not render, leaving only a blank line in the body. - The player is an iframe and is subject to upstream region/Referer policies; local preview may show a black screen.
11.5 Summary
- Two usages: by BV number (default) or globally overridden by
iframeUrl - Black screen locally: common, an upstream policy rather than a config error
- Turned off leaves a blank line: a gap appears in the body
Test assertion: page contains bilibili-related container markers.
12. ECharts
Purpose: embed interactive ECharts charts in posts.
Learning path: turn on the switch → write the tag (width/height + JSON) → dark/light following → full parameters → boundaries
12.1 How to enable
Effect: interactive charts appear in the body (bar/line/pie, etc.), the container occupies a fixed height (prevents CLS), and switching dark/light theme rebuilds the chart colors automatically.
Corresponding config:
echarts:
enable: true12.2 Common options
① Width/height + chart config
Effect: the first parameter is the container width ('100%' fills the body width), the second is the container height (400 means 400px), and the rest is the ECharts option JSON.
Corresponding config (write the tag in the body):
{% echarts '100%' 400 %}
{
"title": {"text": "Sample Chart"},
"xAxis": {"type": "category", "data": ["A", "B", "C"]},
"series": [{"data": [10, 20, 30], "type": "bar"}]
}
{% endecharts %}② Dark/light theme auto-switching
Effect: on theme switch the chart is disposed, reinitialized with the new theme, and setOption called again — no light-colored axes are left behind on a dark page.
Corresponding mechanism (goes through the unified entry Matery.echarts.init, no config key):
Matery.echarts.init(id, option); // listens to theme-changed internally12.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
echarts.enable | bool | true | true / false | ECharts library and tag switch |
| tag 1st parameter | string | — | CSS width (example '100%') | Container width |
| tag 2nd parameter | number | — | pixel height (example 400) | Container height |
12.4 Boundaries & conflicts
- The height is fixed by the tag’s second parameter (the container reserves space first to prevent CLS); a taller chart does not grow the container.
- Only charts going through
Matery.echarts.init(id, option)follow dark/light switching (dispose→reinit); charts you init yourself do not follow the theme. - The output shape of the tag with
enable: falseis not verified in this file, but theMatery.echartsentry is not registered.
Dark/Light Theme Auto-Switching Scope (unified on 2026-09-06 P11)
All ECharts charts inside the theme (article tag / word cloud / radar / article stats 3 charts / calendar / music) uniformly go through Matery.echarts.init(id, option) — listening to the theme-changed event, they automatically dispose + reinit (new theme) + setOption on dark/light switching. The container CSS uses fixed height placeholders to prevent CLS.
Test assertion: page contains echarts container marker +
Matery.echartsis registered (tools/tests/wordcloud.test.jsL2g verifies dark/light switching).
12.5 Summary
- Both things are required: site-level
echarts.enable, plus a tag in the body - Height is fixed: an oversized chart will not grow the container, so adjust the second parameter yourself
- Not following dark/light: most likely you called
echarts.inityourself instead ofMatery.echarts.init
13. AOS Card Enter Animation
Purpose: enter animation when homepage waterfall cards load.
Learning path: see the effect → understand the trigger → where the parameters live → boundaries
13.1 How to enable
Effect: new cards (loaded by infScroll pull-to-load) fade in and move up (fade-in-up) when entering the viewport; older cards already in the viewport do not replay.
Corresponding config: enabled by default, no switch; parameters live in themes/matery/source/js/boot.js (AOS duration 700ms / delay 100ms, snippet values — other values unverified).
13.2 How it works
Effect: animation only plays when scrolled into the viewport — IntersectionObserver watches .card and adds the .card-aos-enter class on entry; .article does not get it (Masonry absolute positioning, to avoid overlap).
Corresponding mechanism (no YAML key):
IntersectionObserver watches .card → enters viewport → adds .card-aos-enter (fade-in-up, 500ms)
.article excluded (Masonry absolute positioning)13.3 All tunable keys
| Item | Location | Value (snippet) | Purpose |
|---|---|---|---|
aos.duration | themes/matery/source/js/boot.js | 700ms | Animation duration (other values unverified) |
aos.delay | themes/matery/source/js/boot.js | 100ms | Animation delay (other values unverified) |
13.4 Boundaries & conflicts
- Only applies to
.card;.articleis excluded — otherwise Masonry absolute positioning would overlap. - The card animation class itself declares 500ms (
fade-in-up) while the AOS global parameters are 700ms / 100ms; both values coexist — the actual CSS/JS wins.
13.5 Summary
- No YAML switch: on by default, parameters in
boot.js - Only new cards animate: driven by IntersectionObserver, not CSS running immediately
- Related to §15: after dynamic content loading,
refreshLayout()takes over again
Test assertion: after pull-to-load, new cards contain
.card-aos-enterand cards have no overlap (tools/tests/infinite-scroll-aos.test.js).
14. Floating Panel (right-floating)
Purpose: the “Preferences” panel opened by the gear button in the bottom-right corner — font scaling, language switching (simplified/traditional), display mode (light/auto/dark), page effects toggle, etc. Selections are saved in localStorage and persist across pages.
Learning path: click the gear → font scaling → language → background → persistence → boundaries
14.1 How to enable
Effect: the panel is hidden by default; clicking the gear button (.btn-floating) in the bottom-right corner expands it with flex, and clicking again collapses it. Panel sections: font / language / display mode / effects / background.
Corresponding config: the panel is a pure frontend component (layout/_partial/common/right-floating.ejs + floating-panel.styl) with no independent config switch; each option inside the panel links to existing theme features (language via lang.translate, display mode via data-user-color-scheme, effects via the effects switch).
14.2 Common options
① Font scaling
Effect: A+ / A− step by 0.1 in the range 0.85–1.3, applied immediately to the root --font-scale; ↺ restores 1.0 in one click; preserved across refresh/page navigation.
Corresponding config (written to localStorage at runtime, not YAML):
matery.font-scale # 0.85 ~ 1.3, step 0.1, default 1.0② Language section
Effect: a language dropdown (with flags, showing only the flag when the row is too narrow) plus a simplified/traditional segmented control, writing the local preference and navigating to the corresponding language version.
Corresponding config: no independent key — it uses the theme’s existing language config (separate site versions for simplified/traditional).
③ Background section
Effect: the page background can be off / image / video; the available choices are controlled by background.image.enable / background.video.enable, and with both off only off remains.
Corresponding config:
matery.bg # off | image | video (runtime preference)14.3 All tunable keys (panel controls)
| Control | Persistence key | Values / range | Purpose |
|---|---|---|---|
| Font scaling | matery.font-scale | 0.85–1.3, step 0.1 | Root --font-scale |
| Background mode | matery.bg | off / image / video | Page background (mutually exclusive single-select) |
| Simplified/traditional | — (not listed in this file) | simplified / traditional | Navigate to the corresponding language version |
| Display mode | — (not listed in this file) | light / auto / dark | data-user-color-scheme |
| Page effects | matery.effect.page / matery.effect.mouse | see §4 | Switch effects |
Persistence keys not listed here do not appear in this file; other values are unverified.
14.4 Boundaries & conflicts
- The panel itself has no master switch; visibility is indirectly controlled by the feature switches behind each section (
effects.enable/background.enable). - Font scaling writes the CSS variable
--font-scale, notfont-size— changingfont-sizedirectly will fight the panel. - Preferences left in localStorage take priority over config defaults (e.g.
matery.bgoverbgDefault).
14.5 Summary
- No config entry point: to change default behavior, edit each feature’s own config rather than looking for a panel switch
- Persistence is in localStorage: clearing browser data returns to defaults
- Font scaling goes through a CSS variable:
--font-scaleis the single exit point
Test assertion: TC-L14 (
tools/tests/floating-panel-integration.test.js, 8 assertions, part of release-test L11): panel hidden by default / gear opens / font scaling / reset to defaults, etc.
15. Event Bus (Matery.events)
Purpose: the unified event bus for inter-component communication within the theme, solving “components need reinitialization after dynamic content loading” — decryption, pagination, pull-to-load and other scenarios trigger the corresponding refresh, and each component only registers a callback without coupling to others.
Learning path: register callbacks → trigger refresh → distinguish full vs layout → full API table → boundaries
15.1 How to enable
Effect: registered callbacks run on the corresponding refresh — a full refresh re-renders MathJax/mermaid/Prism, a layout refresh only re-lays-out (AOS/Masonry/progress bar), and neither triggers the other.
Corresponding config (themes/matery/source/js/events.js):
// After dynamic content loading, re-rendering is needed -> full refresh
Matery.events.registerRefreshCallback(function () { /* re-render */ });
// Only layout changes (resize / content height change) -> lightweight layout refresh
Matery.events.registerLayoutCallback(function () { /* re-layout */ });
Matery.events.refreshLayout();15.2 Common options
① Full refresh (re-render content)
Effect: when triggered, every callback registered via registerRefreshCallback runs in order — used after decryption or pagination to re-render formulas/charts/code highlighting.
Corresponding config:
Matery.events.registerRefreshCallback(cb);
Matery.events.refresh();② Layout refresh (re-layout only, no re-render)
Effect: runs only registerLayoutCallback callbacks without retriggering layout-independent re-rendering — lighter than refresh, suited to window resize and content height changes.
Corresponding config:
Matery.events.registerLayoutCallback(cb);
Matery.events.refreshLayout();15.3 All tunable keys (API)
| Method | Purpose |
|---|---|
Matery.events.registerRefreshCallback(cb) | Register a full refresh callback (content re-rendering: MathJax/mermaid/Prism, etc.) |
Matery.events.registerLayoutCallback(cb) | Register a layout refresh callback (layout recalculation only: AOS/Masonry/progress bar) |
Matery.events.refresh() | Trigger all refresh callbacks |
Matery.events.refreshLayout() | Trigger all layout callbacks (lightweight, no content re-rendering) |
15.4 Boundaries & conflicts
- refresh and refreshLayout are isolated: a full refresh does not redundantly trigger layout, and a layout refresh does not re-render content.
- After decryption, uniformly use refresh (see content tag article §14 / layout article §11).
- Doing heavy work inside a callback must be idempotent — repeated triggers must not bind listeners twice (cf. the codeWidget lesson in §1.4).
15.5 Summary
- Decide which one first: content changed →
refresh; only size changed →refreshLayout - Prefer the lightweight one: if
refreshLayoutsuffices, do not userefresh - Registering is enough: no extra initialization step
Test assertion: TC-L15 G3 (
tools/tests/core-events-integration.test.js, 4 assertions): API exists / refresh triggers full refresh / refreshLayout triggers layout / isolation.
16. Banner Dark/Light Switching
Purpose: the banner background follows dark/light theme switching — after the
theme-changedevent is dispatched, the body background switches between the dark and light styles; the background mode (image/video/off) is controlled by the panel preferencematery.bg.Learning path: switch dark/light to see the linkage → choose the background mode → set the default → full parameters → boundaries
16.1 How to enable
Effect: after clicking the display-mode switch (light/dark), the banner and body background change color together — you never get “the text turned white but the background is still white”.
Corresponding config:
bgDefault: image # default background mode when there is no local preference (off / image / video)16.2 Common options
① Runtime background mode
Effect: choose the background mode in the floating panel; the choice is stored in localStorage matery.bg and takes priority over bgDefault; clearing localStorage falls back to the config value.
Corresponding config:
matery.bg # off | image | video (mutually exclusive single-select, image or video)② Which backgrounds are selectable in the panel
Effect: turning off background.image.enable / background.video.enable makes the corresponding panel option unselectable; with both off only off remains.
Corresponding config:
background:
enable: true
image:
enable: true
video:
enable: true16.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
bgDefault | string | — | off / image / video | Default background mode when there is no local preference |
matery.bg (localStorage) | string | — | off / image / video | Runtime background preference (mutually exclusive single-select) |
background.enable | bool | — | true / false | Panel “Background” section master switch |
background.image.enable | bool | — | true / false | Whether the panel’s “Image” option is selectable |
background.video.enable | bool | — | true / false | Whether the panel’s “Video” option is selectable |
The specific address keys for background images/videos are not expanded in this file; other values are unverified.
16.4 Boundaries & conflicts
matery.bg(local preference) takes priority overbgDefault; after clearing localStorage it falls back to the config value.- Turning off
background.image.enable/background.video.enablemakes the corresponding panel option unselectable; with both off onlyoffremains. - The linkage relies on the
theme-changedevent: manually changingdata-user-color-schemewithout dispatching the event leaves the banner background unchanged.
16.5 Summary
- The default lives in
bgDefault, the user’s choice in localStorage, and the latter wins - Linkage relies on the event, not CSS: bypassing
theme-changedmeans no sync - To disable the background section entirely:
background.enable: false
Test assertion:
tools/tests/banner-bg.test.jsT5: body background dark/light changes (theme-changed dispatch).
17. Read Mode & Code Fullscreen (split into two independent features on 2026-09-06)
Purpose:
- Read mode (read_mode): one-click fullscreen immersive reading of the post card, hiding other page elements
- Code fullscreen (code-fullscreen): fullscreen view of a single code block container, independent of read mode (the class is applied to the code container, not the card)
Learning path: enter read mode → see the floating ball → exit animation → code fullscreen → expand mechanism → boundaries
17.1 How to enable
Effect: clicking the read mode button (#read_mode) in the post info bar (post-info) fills the screen with the whole post card (.card-block-fullscreen) and hides other page elements; click again to exit. The code block toolbar’s fullscreen button (.code-area .code-fullscreen) instead makes only that code container fullscreen (.code-area.code-block-fullscreen).
Corresponding config: both buttons are built-in UI, no YAML switch; behavior is determined by layout and styl.
17.2 Common options
① Enter animation and floating ball
Effect: the card springs in with elastic 1s; the floating ball fades in after a delay (readmode-ball-fade .3s ease .75s both) — the elastic transform creates a containing block that makes the fixed floating ball jump, and the delayed fade-in avoids exactly that.
Corresponding mechanism:
.card-block-fullscreen { animation: elastic 1s; }
readmode-ball-fade { .3s ease .75s both }
floating ball { position: fixed; right: 1em; top: 70px; z-index: 10000 }
top: 70pxclears the navbar bottom 64;z-index: 10000sits above the navbar’s 997.
② Exit animation
Effect: on exit, card-block-fullscreen-exit fades out (scale .98 + opacity 0), and the fullscreen class is removed only after 220ms — otherwise the floating ball would snap back instantly.
Corresponding mechanism:
exit class → fade out (scale .98 + opacity 0) → 220ms → remove fullscreen class③ Code block expand (linked to the §1 height limit)
Effect: after clicking the expand bar, pre.style.maxHeight = pre.scrollHeight + 'px' (full height, no inner scrollbar, page scrolls); on collapse maxHeight='', restoring --code-max-height 450px.
Corresponding mechanism:
pre.style.maxHeight = pre.scrollHeight + 'px'; // expand
pre.style.maxHeight = ''; // collapse → back to 450px17.3 All tunable keys
| Item | Location | Value (snippet) | Purpose |
|---|---|---|---|
| Card fullscreen class | layout / styl | .card-block-fullscreen | Read mode fullscreen |
| Floating ball positioning | styl | right: 1em; top: 70px; z-index: 10000 | Clears the navbar, sits above it |
| Exit class | styl | .card-block-fullscreen-exit | scale .98 + opacity 0 |
| Code fullscreen class | styl | .code-area.code-block-fullscreen | Fullscreen for a single code block only |
The above are style class names and values; changing them means changing source code, not configuration.
17.4 Boundaries & conflicts
- Read mode and code fullscreen are two independent classes: entering read mode does not fullscreen code blocks, and vice versa.
- The floating ball must fade in with a delay — removing the delay makes it visibly jump (elastic creates a containing block).
- The exit animation must wait 220ms before removing the class, otherwise the floating ball snaps back.
z-index: 10000is hardcoded while the navbar is 997; when changing navbar layering, check this value too.
17.5 Summary
- Do not conflate the two: card fullscreen vs code container fullscreen
- Animation timing is essential: delayed fade-in + a 220ms exit wait; removing them causes jumping
- Linked to code block enhancements: expand switches to
scrollHeightand is not bound by 450px
Test assertion:
tools/tests/readmode-integration.test.js(L2f PASS=14): read mode enter/exit, floating ball, code fullscreen, full code display after expand.
18. JS Loading Layers & jQuery Removal (2026-09-05 P4/P5)
Purpose: remove the site-wide jQuery dependency (rewritten with native DOM API) and load scripts in layers by first-screen priority to reduce first-screen blocking.
Learning path: see the side effects → confirm jQuery is disabled → see the layering strategy → boundaries
18.1 How to enable
Effect: the page no longer requests the global jQuery library; core scripts carry defer and do not block first-screen parsing; analytics scripts use async; first-screen critical inline scripts are injected synchronously and execute before all defer scripts.
Corresponding config:
libs:
js:
# jquery: ... # commented out and disabled (P4/P5 site-wide jQuery removal complete)
# jqueryUI: ... # commented out and disabled
# jqueryBarrager: ... # commented out and disabled
jqueryPjax: ... # retained (standalone library, not global jQuery)18.2 Common options
① Layering strategy
Effect: core scripts are deferred without blocking parsing, analytics stay out of the first screen entirely, and inline critical scripts jump to the front — guaranteeing dependency order without waiting on the network.
Corresponding config:
Core scripts (materialize/masonry/imagesloaded/aos/events/plugins) → defer
Analytics (umami/busuanzi) → async
First-screen critical scripts → inline sync (before defer)② Effect libraries rewritten natively
Effect: the ripples effect was rewritten natively, dropping its jQuery dependency (the contact page has been removed).
Corresponding mechanism: see the effects.mouse / effects.page config in §4; behavior is unchanged, the implementation no longer depends on jQuery.
18.3 All tunable keys
| Item | Location | Value (snippet) | Purpose |
|---|---|---|---|
libs.js.jquery | theme _config.yml | commented out | Global jQuery (disabled) |
libs.js.jqueryUI | theme _config.yml | commented out | jQuery UI (disabled) |
libs.js.jqueryBarrager | theme _config.yml | commented out | Danmaku library (disabled) |
libs.js.jqueryPjax | theme _config.yml | retained | Standalone library, not global jQuery |
Core scripts defer | layout | uniformly defer | Does not block first-screen parsing |
Analytics scripts async | layout | uniformly async | Stays out of the first screen |
| First-screen critical scripts | layout | inline sync | Executes before defer |
18.4 Boundaries & conflicts
- After disabling jQuery, any inline script or third-party plugin depending on
$/jQuerywill error — before adding a new library, confirm whether it ships its own jQuery dependency. deferguarantees execution in document order but not before DOMContentLoaded — logic sensitive to dependency order must either be inline or explicitly listen for events.- Layering is a global strategy, not a per-page switch.
18.5 Summary
- jQuery is removed site-wide: the three
libs.js.jquery*entries are commented out, not usable switches - Think priority before adding a script: core
defer/ analyticsasync/ first-screen inline jqueryPjaxis the exception: it has jQuery in its name but is a standalone library
Test assertion: Page has no global jQuery requests; core scripts have
defer.
⚠️ Known Pitfalls
Pitfall 1: Double Section Numbering
Symptom: Headings render as “1. 1. Overview” (two numbers).
Cause: Theme CSS auto-adds numbers to h2–h6 by default; 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 already correctly sets
closeAutoTocNum: true.
Pitfall 5: Config Changes Require Clean Build
Symptom: Changed effects/subtitle.typed/image_zoom etc. configuration but the page didn’t update.
Cause: Hexo’s caching mechanism doesn’t auto-detect configuration changes.
Fix: After changing config, you must npm run clean && npm run build. Changing only article content (e.g. images/text) doesn’t require clean; incremental builds work normally.
Appendix: Interaction & Visual Feature Quick Reference
| Feature | Config Key | Key Parameters | Automated Assertion Marker |
|---|---|---|---|
| Code block | code | language/copy_btn/show_full | code-area |
| Lightbox | image_zoom + libs.js.lightgallery | enable | .img-item / .lg-outer |
| Typewriter | subtitle.typed / post.typed | loop/showCursor/speed | #typed |
| Effects | sakura etc. 10+ switches | desktop + viewCount > 2 gate | windowWidth > BP.fun |
| Trad/Simp | lang.translate.enable | aggregated config (old zh_default/footer.translate removed) | #translateLink |
| Progress bar | progressbar | height/color | .progress-bar |
| Back to top | backTop | enable | #backTop |
| Reward | post.reward | wechat/alipay images | #reward |
print | enable | @media print | |
| APlayer | music | server/type/id | aplayer |
| DPlayer | dplayer | url | dplayer |
| Bilibili | bilibili | iframeUrl | bilibili |
| ECharts | echarts | JSON config | echarts |
| AOS animation | aos (boot.js) | duration/delay | .card-aos-enter |
| Floating panel | right-floating (ejs) | font scaling/language/theme/effects | #floating-panel |
| Event bus | Matery.events | refresh/refreshLayout | Matery.events |
| Banner dark/light | matery.bg (localStorage) | off/image/video | body background |
| Wiki line numbers | prism line-numbers | wiki page code blocks | .line-numbers |
| Read mode | #read_mode (post-info button) | card fullscreen + floating ball | .card-block-fullscreen |
| Code fullscreen | .code-area .code-fullscreen | container fullscreen (independent of read mode) | .code-block-fullscreen |
| JS loading layers | libs.js (jquery commented out) | core defer / analytics async / first-screen inline sync | no global jQuery requests |
References
系列教程
Hexo 主题功能测试系列
- Hexo主题功能测试-布局与页面篇 —— 页面布局、导航、侧边栏、卡片等结构功能
- Hexo主题功能测试-交互视觉篇 —— 代码高亮、图片灯箱、动画、明暗切换等交互
- Hexo主题功能测试-内容tag篇 —— note / tabs / timeline / label / button 等 tag 插件
- Hexo主题功能测试-Markdown语法篇 —— Markdown 渲染与扩展语法
- Hexo主题功能测试-自动化测试篇 —— 主题功能的自动化测试方案

