| 开发者 | kimjiwoon |
|---|---|
| 更新时间 | 2026年7月19日 01:07 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPL-3.0-or-later |
| 版权网址: | 版权信息 |
axismundi/toc block: a dynamic,
server-rendered list built from the current post's headings, with a scroll-spy
that marks the section you are reading.
The block render and a render_block_core/post-content filter share one
deterministic slug function, so the table-of-contents anchors always match the
heading ids — regardless of render order or where you place the block (a template
aside or inside the content). Author-provided HTML anchors are respected, and
duplicate headings are de-duplicated (-2, -3).
<details> whose summary can echo the current
section). A "Table of contents (above content)" pattern ships the disclosure
ready to drop before the post content.h2–h4 by default (configurable per block).toc-list / toc-h2…h4 / is-current class vocabulary so a
theme's table-of-contents skin couples for free; ships a Material Design 3
token skin (with fallbacks) in the meantime..toc-list / .is-current).No. The table of contents is built on the server from the post's own headings.
From the heading text via sanitize_title(), de-duplicated in document order. If
a heading already has an HTML anchor, that id is kept. The same function feeds the
block and the heading-id injection, so the anchors always resolve.
Yes. Non-ASCII headings (for example Korean) are percent-encoded into the same value on both the heading id and the table-of-contents link, and the scroll-spy matches them literally.
axismundi/toc block (server-rendered list from post
headings) with deterministic, shared heading-id slugs and is-current
scroll-spy.toc-list /
is-current vocabulary; smooth in-page scrolling is owned by the theme.<details>;
placement and sticky behavior are controlled by the host theme or template.
Open-by-default and summary mode are per-block, and its summary can track the
current section. Ships a "Table of contents (above content)" pattern.