OLanO21 downloadsAuto-number Markdown headings with per-level rules: brackets, level separators and suffixes. Keeps [[note#heading]] links pointing at the right heading when numbers change.
English | 简体中文
An Obsidian plugin that numbers the headings in your notes level by level (H1–H6) with rules you define, and keeps [[note#heading]] links in sync whenever a heading's number changes.
Fully offline: no network requests, no telemetry, and no access to files outside your vault.
Don't number this level for a level you want left alone — the level still exists, and its sub-headings are numbered as usual;%%skip%% on the line below it; use %%skips%% to skip it together with everything under it;heading-guard: on / heading-guard: 方案A / heading-guard: on|方案A;A convenient companion for renaming headings: https://github.com/PlayerMiller109/obsidian-keep-headings
Community plugins (recommended): Settings → Community plugins → Browse → search for Heading Guard → Install → Enable.
Manual installation:
manifest.json, main.js and styles.css;.obsidian/plugins/heading-guard/ inside your vault and put the three files in it;Try a newer build with BRAT: install and enable BRAT, then use Add Beta plugin in its settings with nnq7/obsidian-heading-guard.
Search in Ctrl+P |
What it does |
|---|---|
| Number the current note now | Numbers the note immediately; when run manually it first shows a before/after comparison, and only writes after you confirm |
| Reset heading numbers in the current note | Removes the numbers from the headings and keeps the text. Some formats aren't recognized and need to be fixed by hand |
All notes / Only opted-in notes. The latter only numbers notes that have heading-guard: on (or on|style name) in their frontmatter; the two commands ignore this setting.%%skip%%, sub-headings either fill in the missing level (for example 1.1) or shift up one level.The interface language follows Obsidian's own language setting (Settings → About → Language): Simplified Chinese, Traditional Chinese, and English for everything else.
%%skip%% / %%skips%%Put the skip comment on the line right below the heading (putting it on the heading's own line does nothing):
# Heading
%%skip%%
| Marker | Effect |
|---|---|
%%skip%% |
Skips this heading only |
%%skips%% |
Skips this heading and every sub-heading below it |
1.1);%%skip%% to be numbered later).Add a heading-guard property to the note's frontmatter. Three forms:
heading-guard: on — turn auto numbering on for this note, using the rules from the plugin settings;heading-guard: 方案A — use the saved style named 方案A for this note, but do not turn auto numbering on;heading-guard: on|方案A — turn auto numbering on and use the saved style 方案A.The style name must match one you have saved. With the scope set to
Only opted-in notes, onlyonoron|方案Aturns auto numbering on — a bare style name does not.
data.json inside the plugin folder;Numbering doesn't happen. Check that Enable auto numbering is on. If the scope is Only opted-in notes, the note's frontmatter must contain heading-guard: on.
Why was a heading not numbered? Three possibilities: the note is inside an excluded folder, the line below that heading contains %%skip%% / %%skips%%, or that level has Don't number this level turned on.
Where does %%skip%% go? On the line right below the heading. On the heading's own line it does nothing.
I renamed a heading but the links didn't change. Skipped or unnumbered headings are not rewritten; if syncing fails, you'll see a "cannot sync links" notice and the headings are left unchanged.
I changed Obsidian's language but the plugin UI didn't change. The plugin follows Obsidian's language; after switching, Obsidian asks you to reload, and the plugin picks up the new language then.
See Releases.
MIT © nnq7
Video walkthrough (Chinese): https://www.bilibili.com/video/BV1BVau6TE4H
