Loading...

Loading...

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

Corresponding config (minimal working: language label + copy button, everything else off):

code:
  language:
    enable: true
    default: "TEXT"
  copy_btn: true

Standard 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: true

Whether 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-bar expand bar appears at the bottom of the collapsed state; clicking it sets the container maxHeight to scrollHeight via JS
  • Horizontal scrolling: the code container uses overflow-x: auto
  • Fullscreen: code.show_expand: true provides fullscreen viewing

Test assertion: page contains code-area marker (at least 4 code blocks); readmode use case (L11) verifies code is fully displayed after expansion.

1.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
code.language.enablebooltruetrue / falseTop-right language label switch
code.language.defaultstring"TEXT"any stringLabel text shown when the language cannot be recognized
code.copy_btnbooltruetrue / falseCopy button
code.show_fullbooltruetrue / falseExpand/collapse button for long code
code.shrinkbooltruetrue / falseManual collapse button
code.height_limitstring"450px"CSS length with units (px etc.)Auto-collapse above this height
code.breakbool—false (this file uses this value)Whether wide lines wrap; false means horizontal scrolling
code.show_expandbool—true / falseCode block fullscreen button

1.4 Boundaries & conflicts

  • height_limit lands in the CSS variable --code-max-height; on expand JS sets maxHeight directly to scrollHeight (no longer bound by that value), and restores it on collapse.
  • copy_btn / show_full / shrink are 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 to language.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_btn is enough
  • Afraid of exploding long posts: tune height_limit; show_full provides the “expand” bar
  • Want fewer wrapped lines: break: true wraps 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):

Lightbox test image 1

Lightbox test image 2

Corresponding config:

# Post images are automatically wrapped as .img-item by articleInit
image_zoom:
  enable: true

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

![Image description](/medias_webp/featureimages/1.webp)

② 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_paths is 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.lightgallery is not expanded in this file; other values are unverified.

2.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
image_zoom.enablebooltruetrue / falseLightbox master switch
libs.js.lightgallerystring—library URL (public CDN or local path)lightGallery library source
image_size_plugin.map_pathsmap—CDN path → local file pathMap remote images to local files for sizing

The full value shape of libs.js.lightgallery is not expanded in this file; other values are unverified.

2.4 Boundaries & conflicts

  • The lightbox depends on imgsize.js injecting width/height first: 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-item by articleInit()); banners/covers/card thumbnails are out of scope.
  • The size cache image_sizes_cache.json has 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.js runs 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.enable is 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: true

3.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
subtitle.enablebooltruetrue / falseWhether the banner subtitle is shown (the typewriter’s host)
subtitle.typed.enablebooltruetrue / falseBanner subtitle typewriter switch
subtitle.typed.loopbooltruetrue / falseWhether to loop
subtitle.typed.showCursorbooltruetrue / falseWhether to show the cursor
subtitle.typed.cursorCharstring"_"any single characterCursor character
subtitle.typed.startDelaynumber100millisecondsDelay before starting
subtitle.typed.typeSpeednumber80milliseconds/charTyping speed (smaller is faster)
subtitle.typed.backSpeednumber50milliseconds/charDeleting speed (50 < 80 means deleting is faster than typing)
post.typed.enablebooltruetrue / falsePost title typewriter switch

3.4 Boundaries & conflicts

  • subtitle.typed.* hangs off the subtitle: with subtitle.enable: false the subtitle is not shown at all, so the typewriter has no host.
  • loop: false types only once (whether the cursor remains afterward and other combinations are unverified).
  • typeSpeed / backSpeed / startDelay are 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 #typed or .typed-cursor marker.


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

4.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 id

4.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
effects.enablebooltruetrue / falseEffects master switch
effects.desktop_onlybooltruetrue / falseWhether to inject on desktop only
effects.page.defaultstringoffoff / random / any id in availableDefault page effect (single-select)
effects.page.available.<id>.labelstring—any display namePanel/menu display text
effects.page.available.<id>.libstring—sakura ripples leaf snowdown snowflake buble canvas_nest ribbon ribbon_dynamicLibrary actually loaded
effects.mouse.defaultstringoffoff / random / any id in availableDefault mouse effect (single-select)
effects.mouse.available.<id>.labelstring—any display namePanel/menu display text
effects.mouse.available.<id>.libstring—clicklove popupText star fireworksLibrary actually loaded

Key names (<id>) can be customized, but lib must be one of the library identifiers listed above; other lib values are unverified.

4.4 Boundaries & conflicts

  • page and mouse are each single-select: configuring several in the same group means only the one in default takes effect.
  • With desktop_only: true the desktopGate applies: width > BP.fun (1400px, falls back to 992 if BP is undefined) and localStorage viewCount > 1; desktop_only: false skips the gate and loads on mobile too.
  • The runtime panel writes localStorage matery.effect.page / matery.effect.mouse, which take priority over the default in config.
  • Changing the effects block 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: false the 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 of page.default picks the effect
  • Multiple in one group is useless: only default takes 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 switch

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

KeyTypeDefaultValues / rangePurpose
preference.translate.enablebooltruetrue / falseFooter “Traditional/Simplified” toggle switch

The old footer.translate has 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.translate is no longer read — leaving that block behind does not error, but it has no effect.
  • #translateLink is only output when enable: 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 #translateLink or 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: true

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

KeyTypeDefaultValues / rangePurpose
fun_features.progressbar.enablebooltruetrue / falseReading progress bar switch
fun_features.progressbar.height_pxnumber3pixel value (unitless)Progress bar height
fun_features.progressbar.colorstring"#29d"any CSS colorProgress bar color
backTop.enablebooltruetrue / falseBack-to-top button switch
libs.js.scrollProgressstringpublic CDN address (shown in the snippet)CDN or local path /libs/scrollprogress/scrollProgress.min.jsProgress bar library source

6.4 Boundaries & conflicts

  • height_px is a plain number (the key name carries a _px suffix); do not write "3px".
  • Pointing libs.js.scrollProgress at 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; backTop is a top-level key, not under fun_features.
  • Changing this section requires a clean build (see Pitfalls #5).

Test assertion: page contains .progress-bar or #backTop; TC-L15 G6 (tools/tests/core-events-integration.test.js, 2 assertions): layout callback registered >= 1 and refreshLayout() does not throw.

6.5 Summary

  • Two features, two key locations: fun_features.progressbar and the top-level backTop, mutually independent
  • Height unit written wrong: height_px only accepts a number
  • Progress bar not moving: first check whether libs.js.scrollProgress is 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.webp

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

KeyTypeDefaultValues / rangePurpose
post.reward.enablebooltruetrue / falseGlobal reward entry point switch
post.reward.titlestring"Thanks for reading! Consider tipping the author!" (as shown)any stringDialog title
post.reward.wechatstring—image path (webp/png recommended)WeChat payment QR code
post.reward.alipaystring—image pathAlipay payment QR code
post front-matter rewardbool—true / falsePer-post override of the global switch

7.4 Boundaries & conflicts

  • When front-matter has no reward, the global post.reward.enable applies; 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: true

8.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: false

8.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
print.enablebooltruetrue / falsePrint 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 print rules.


── 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 ID

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

KeyTypeDefaultValues / rangePurpose
music.enablebooltruetrue / falseMusic player switch
music.serverstringneteasenetease / tencent / kugou / xiami / baiduMusic source
music.typestringplaylistsong / playlist / album / search / artistParse type (determines what id means)
music.idstring | number—ID/keyword matching typePlaylist/song/album/artist ID
music.fixedboolfalsetrue / falseFixed bottom mode
music.autoplayboolfalsetrue / falseAutoplay
music.themestring'#42b983'any CSS colorPlayer theme color

9.4 Boundaries & conflicts

  • type and id must be paired: changing playlist to song while keeping a playlist ID resolves no tracks.
  • 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).
  • autoplay: true is subject to browser autoplay policies and usually produces no sound without user interaction.
  • Third-party source availability depends on upstream; services such as xiami have 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/id are a pair
  • Cannot autoplay: expected, a browser policy limitation

Test assertion: page contains aplayer container 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: true

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

KeyTypeDefaultValues / rangePurpose
dplayer.enablebooltruetrue / falseDPlayer resource loading and tag rendering switch
tag parameter urlstring—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: false the 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 dplayer container 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: true

11.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=xxx

In this file’s snippet iframeUrl is commented out; how to enable it and other values are unverified.

11.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
bilibili.enablebooltruetrue / falseBilibili card/tag switch
bilibili.iframeUrlstring— (commented out in the snippet)full player URLOptional: overrides the address generated by the tag

In this file’s snippet iframeUrl is commented out; how to enable it and other values are unverified.

11.4 Boundaries & conflicts

  • Without iframeUrl it works from the BV number passed by the tag (as the example in this file does); with it configured, iframeUrl wins.
  • With enable: false the 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: true

12.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 internally

12.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
echarts.enablebooltruetrue / falseECharts library and tag switch
tag 1st parameterstring—CSS width (example '100%')Container width
tag 2nd parameternumber—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: false is not verified in this file, but the Matery.echarts entry 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.echarts is registered (tools/tests/wordcloud.test.js L2g 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.init yourself instead of Matery.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

ItemLocationValue (snippet)Purpose
aos.durationthemes/matery/source/js/boot.js700msAnimation duration (other values unverified)
aos.delaythemes/matery/source/js/boot.js100msAnimation delay (other values unverified)

13.4 Boundaries & conflicts

  • Only applies to .card; .article is 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-enter and 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)

ControlPersistence keyValues / rangePurpose
Font scalingmatery.font-scale0.85–1.3, step 0.1Root --font-scale
Background modematery.bgoff / image / videoPage background (mutually exclusive single-select)
Simplified/traditional— (not listed in this file)simplified / traditionalNavigate to the corresponding language version
Display mode— (not listed in this file)light / auto / darkdata-user-color-scheme
Page effectsmatery.effect.page / matery.effect.mousesee §4Switch 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, not font-size — changing font-size directly will fight the panel.
  • Preferences left in localStorage take priority over config defaults (e.g. matery.bg over bgDefault).

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-scale is 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)

MethodPurpose
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 refreshLayout suffices, do not use refresh
  • 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-changed event is dispatched, the body background switches between the dark and light styles; the background mode (image/video/off) is controlled by the panel preference matery.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: true

16.3 All tunable keys

KeyTypeDefaultValues / rangePurpose
bgDefaultstring—off / image / videoDefault background mode when there is no local preference
matery.bg (localStorage)string—off / image / videoRuntime background preference (mutually exclusive single-select)
background.enablebool—true / falsePanel “Background” section master switch
background.image.enablebool—true / falseWhether the panel’s “Image” option is selectable
background.video.enablebool—true / falseWhether 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 over bgDefault; after clearing localStorage it falls back to the config value.
  • Turning off background.image.enable / background.video.enable makes the corresponding panel option unselectable; with both off only off remains.
  • The linkage relies on the theme-changed event: manually changing data-user-color-scheme without 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-changed means no sync
  • To disable the background section entirely: background.enable: false

Test assertion: tools/tests/banner-bg.test.js T5: 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: 70px clears the navbar bottom 64; z-index: 10000 sits 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 450px

17.3 All tunable keys

ItemLocationValue (snippet)Purpose
Card fullscreen classlayout / styl.card-block-fullscreenRead mode fullscreen
Floating ball positioningstylright: 1em; top: 70px; z-index: 10000Clears the navbar, sits above it
Exit classstyl.card-block-fullscreen-exitscale .98 + opacity 0
Code fullscreen classstyl.code-area.code-block-fullscreenFullscreen 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: 10000 is 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 scrollHeight and 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

ItemLocationValue (snippet)Purpose
libs.js.jquerytheme _config.ymlcommented outGlobal jQuery (disabled)
libs.js.jqueryUItheme _config.ymlcommented outjQuery UI (disabled)
libs.js.jqueryBarragertheme _config.ymlcommented outDanmaku library (disabled)
libs.js.jqueryPjaxtheme _config.ymlretainedStandalone library, not global jQuery
Core scripts deferlayoutuniformly deferDoes not block first-screen parsing
Analytics scripts asynclayoutuniformly asyncStays out of the first screen
First-screen critical scriptslayoutinline syncExecutes before defer

18.4 Boundaries & conflicts

  • After disabling jQuery, any inline script or third-party plugin depending on $ / jQuery will error — before adding a new library, confirm whether it ships its own jQuery dependency.
  • defer guarantees 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 / analytics async / first-screen inline
  • jqueryPjax is 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

FeatureConfig KeyKey ParametersAutomated Assertion Marker
Code blockcodelanguage/copy_btn/show_fullcode-area
Lightboximage_zoom + libs.js.lightgalleryenable.img-item / .lg-outer
Typewritersubtitle.typed / post.typedloop/showCursor/speed#typed
Effectssakura etc. 10+ switchesdesktop + viewCount > 2 gatewindowWidth > BP.fun
Trad/Simplang.translate.enableaggregated config (old zh_default/footer.translate removed)#translateLink
Progress barprogressbarheight/color.progress-bar
Back to topbackTopenable#backTop
Rewardpost.rewardwechat/alipay images#reward
Printprintenable@media print
APlayermusicserver/type/idaplayer
DPlayerdplayerurldplayer
BilibilibilibiliiframeUrlbilibili
EChartsechartsJSON configecharts
AOS animationaos (boot.js)duration/delay.card-aos-enter
Floating panelright-floating (ejs)font scaling/language/theme/effects#floating-panel
Event busMatery.eventsrefresh/refreshLayoutMatery.events
Banner dark/lightmatery.bg (localStorage)off/image/videobody background
Wiki line numbersprism line-numberswiki page code blocks.line-numbers
Read mode#read_mode (post-info button)card fullscreen + floating ball.card-block-fullscreen
Code fullscreen.code-area .code-fullscreencontainer fullscreen (independent of read mode).code-block-fullscreen
JS loading layerslibs.js (jquery commented out)core defer / analytics async / first-screen inline syncno global jQuery requests

References

系列教程

全部文章RSS订阅

Hexo 主题功能测试系列


Hexo Theme Feature Test - Interaction & Visual
Posted on
August 7, 2026
reprint policy. If reproduced, please indicate source
Support
Comments
Data Loading...
 Previous

Read More

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

Read More

Hexo Theme Feature Test - Content Tags
Hexo Theme Feature Test - Content Tags Hexo Theme Feature Test - Content Tags
Complete tutorial and test for matery theme content tag plugins: note callouts, timeline, tabs, labels, buttons, githubC
2026-08-07