Skip to content

Releases: AArlert/obsidian-auto-headings

1.0.25

Choose a tag to compare

@github-actions github-actions released this 10 Aug 11:19

Fixed: cursor and stray space when numbering a freshly-created empty heading / 修复:给刚生成的空标题编号时的光标错位与多余空格

English

A small but annoying bug: turn an empty line into a heading (e.g. with a heading shortcut) and wait for the plugin to number it — the cursor used to land before the number instead of right after it, so the next character you typed got inserted into the middle of the number. On top of that, the line ended up with two trailing spaces instead of one.

Both symptoms shared the same root cause — this only happens when the heading's title is still empty at the moment numbering is written:

  • The duplicate space came from the logic that preserves a trailing space you just typed. It checks whether the newly numbered line "already ends with" that space, but the check was tripped up by an invisible marker character the plugin appends right after the number when there's no title text yet, so it wrongly concluded the space was missing and added a second one.
  • The misplaced cursor came from how the number gets inserted: when the line is empty, the insertion point and your cursor sit at the exact same spot, and the editor's default behavior in that case is to leave the cursor before the inserted text rather than after it.

Both are fixed. Numbering a fresh, empty heading now leaves exactly one trailing space, with the cursor sitting right after it — ready for you to type the title. Headings that already have title text are unaffected.

中文

一个不大但很碍事的 bug:把一个空行转成标题(比如用标题快捷键)、等插件写入编号后,光标本该落在编号后面,却卡在了编号前面——接着打的字直接插进了编号中间。同时行尾还会多出一个空格,变成两个。

两个症状同源——只在编号写入那一刻标题正文仍为空时才会发生:

  • 多出的空格来自"保住你刚敲的行尾空格"这段逻辑:它靠判断新写入的这一行"是否已经带着"那个空格来决定要不要补,但标题为空时插件会在编号后面加一个不可见的标记字符,这个判断被它挡住、误以为空格没了,于是又补了一份。
  • 光标错位则是因为:标题为空时,编号的插入点和你的光标恰好落在同一个坐标上,而编辑器在这种情况下的默认行为是把光标留在插入内容之前,而不是之后。

两处都已修复。现在给刚生成的空标题编号,行尾只会有一个空格,光标也会准确落在它后面,可以直接接着打标题。已有标题正文的行不受影响。

1.0.24

Choose a tag to compare

@github-actions github-actions released this 09 Aug 14:28

Cleanup dialog now looks the same on mobile as on desktop / 清理外来编号对话框移动端视觉对齐桌面端

English

A small visual fix for the "clean up foreign numbering" dialog introduced in 1.0.23.

  • On narrow screens (including mobile), the checkbox used to sit on its own line above the diff, and the diff card itself was pushed narrower to make room. Now the checkbox floats in the left margin, aligned with the top of the "before" line, and the diff always spans the full width of the card — desktop and mobile now look and behave the same way, regardless of screen width.

中文

给 1.0.23 引入的"清理非本插件的标题编号"对话框做一处视觉修正。

  • 此前窄屏(含移动端)下,勾选框会独占一行显示在 diff 上方,diff 卡片本身也因此被挤窄。现在勾选框改为悬浮在卡片左侧留白处、对齐"现状"那一行的顶部,diff 始终占满卡片整个宽度——桌面端与移动端现在观感和布局完全一致,不再因屏幕宽度不同而分裂成两套样式。

1.0.23

Choose a tag to compare

@github-actions github-actions released this 09 Aug 13:00

Live numbering feels snappier, and the foreign-numbering cleanup dialog is now fully interactive / 编号响应更快,清理外来编号对话框全面可交互

English

Usability improvements from real day-to-day use of the plugin.

  • A heading you just typed gets numbered right away. Previously, if you typed ## Some title and moved the cursor straight to another line, the number never appeared — you had to make one more edit (pressing Enter was the usual accident that fixed it) before the plugin caught up. The same stall happened after changing a heading's level with #.

    The cause was a guard that froze the whole line your cursor was on. It existed for a good reason — to stop a trailing space you had just typed from being swallowed — but freezing the line also withheld the number, and its un-freeze condition ("once you move away") never actually fired: moving the cursor isn't an edit, so nothing woke the plugin up. That guard is gone. Only the trailing space itself is preserved now, and numbering is written in the same cycle no matter where your cursor is. The original trailing-space fix is fully intact: the space you just typed still survives, and is tidied up as before once you move on.

  • Numbering writes are surgical. Instead of rewriting the whole heading line, only the characters that actually changed are replaced. The number goes at the start of the line and your cursor is usually at the end, so the two no longer overlap — writing a number while you are still typing can't nudge your cursor or disturb a selection.

  • The "clean up foreign numbering" dialog is now interactive, not just a preview. Each heading gets its own checkbox (checked by default); uncheck the ones you actually wrote yourself, and they're left alone — except the plugin will still add its own numbering in front of them, the same as it would for any other unclaimed heading. Every "before → after" line now shows the real, final result — the number your template would actually produce — instead of the intermediate "stripped, not yet numbered" text. And with a search box at the top, you can jump straight to a specific heading in a long list instead of scrolling through it.

中文

来自日常实际使用的体验改进。

  • 刚敲出来的标题会立刻编号。 此前你敲下 ## 某个标题 然后光标直接切到另一行,编号根本不会出现——必须再编辑一次(多数人是碰巧按了 Enter 才发现好了)插件才补上。用 # 改标题层级后也会卡住同样一下。

    根因是一道「冻结光标所在整行」的守卫。它本身是有道理的——防止你刚敲下的行尾空格被静默吃掉——但冻结整行连编号也一并扣住了,而解除冻结的条件(「等你把光标移开」)实际上从不成立:移动光标不是一次编辑,插件根本不会被唤醒。这道守卫已经拿掉,现在只保住行尾空格本身,编号则不论光标在哪都照常在当轮写入。原来那个修复一点没丢:你刚敲的空格依然保得住,等你移开后也照旧被清理干净。

  • 编号写回改为精准改写。 插件不再重写整行标题,而是只替换真正变化的那几个字符。编号加在行首、你的光标通常在行尾,两者不再重叠——所以哪怕在你还在打字时写入编号,也不会挪动你的光标或打乱选区。

  • "清理非本插件的标题编号"对话框现在真正可交互,而不只是预览。每条标题都有独立的勾选框(默认勾选);取消勾选你自己手写的那些,插件不会去动它们的文字——但仍会像对待任何其它未接管的标题一样,在前面加上自己的编号。每一行"现状 → 清理后"对照现在展示的是套用模板后的真实最终结果,而不是"剥完外来编号、还没编号"的中间态。对话框顶部还加了搜索框,标题多的时候不必一条条翻找,直接搜、点结果就能跳过去。

1.0.22

Choose a tag to compare

@github-actions github-actions released this 09 Aug 07:02

Inherit depth: inheriting a parent number is no longer all-or-nothing / 继承级数:继承父级编号不再是全有或全无

English

One new setting, contributed by the community (PR #7 — thank you!).

  • Inherit depth, a new column in the template editor next to the existing inherit-parent checkbox. Until now, inheriting was all-or-nothing: a level either reached all the way up to the start level (1.1.1) or showed nothing but its own numeral (a)). There was no way to say "take just the one level above me."

    That middle ground is common in real documents. You want H1 to stand alone as 一、 / 二、, H2 to start its own count at 1, and H3 to carry only its H2 parent — 2.1, not 2.1.1 with H1 dragged into the prefix. The only previous workaround was pushing the start level deeper, which cancelled H1's numbering along with it.

    Set it per level: All (the default, unchanged behavior) or a number. The result never reaches above your start level, no matter how large a number you pick.

  • Everything else keeps working the same way. Ancestor numeral rendering only converts the ancestors you actually inherit; skip-level fill/drop applies within the trimmed range; the start-index offset lands on the real start-level segment, and is simply absent when that segment has been trimmed away. skipFill = don't number narrowed to match: a gap above the inherited range no longer blocks a heading from being numbered, while a missing direct parent still does.

Upgrade is a no-op. The field defaults to "All" and is absent from existing templates, which reads as "All" — every template you already have numbers exactly as it did in 1.0.21, byte for byte.

中文

一个新设置,来自社区贡献(PR #7,感谢!)。

  • 继承级数,模板编辑器里「继承前级」旁边新增的一列。此前继承是全有或全无:某一级要么一路拼到起始层级(1.1.1),要么只剩自己的序号(a)),没有办法表达「只往上带一级」。

    而这个中间态在真实文档里很常见。你想让 H1 独立成「一、」「二、」,H2 另起一套从 1 开始,H3 只带上它的 H2 父级——得到 2.1,而不是把 H1 也拖进前缀的 2.1.1。此前唯一的绕法是把起始层级调深,代价是连 H1 的编号一起取消了。

    逐级设置:全部(默认,即原有行为)或一个数字。无论填多大,结果都不会越过你设定的起始层级。

  • 其余字段的行为一律不变。 祖先序号渲染只转换你实际继承到的那些祖先段;跳级的补位 / 不补位只在截取后的范围内生效;起始编号数字的偏移落在真正的起始层级段上,该段被截掉时就不加偏移。skipFill = 不编号 同步收窄:继承范围之外的浅层缺失不再否决本级编号,范围之内缺直接父级仍然不编号。

升级无感。 该字段默认「全部」,且在你已有的模板里根本不存在——不存在即按「全部」处理,所有老模板的编号结果与 1.0.21 逐字节一致。

1.0.21

Choose a tag to compare

@github-actions github-actions released this 09 Aug 06:35

Skip a single heading, a plugin that finally speaks up, and eight releases' worth of fixes / 单标题跳过、一个终于会说话的插件,外加攒了八个版本的修复

English

This release bundles everything since 1.0.13 — 1.0.14 through 1.0.21 were built but not published individually, so if you're upgrading from the store's current 1.0.13, all of this is new to you.

  • Skip numbering on a single heading: append <!-- skip --> to the end of any heading line (case-insensitive, tolerant of extra spaces) and the plugin leaves it alone — no number, and it doesn't consume a counter slot either, so headings after it stay consecutive. Add the marker to a heading that already has a number and the next renumber removes that number. It's invisible in reading view. This solves the case the whitelist can't: "this one heading, in this one note, shouldn't be numbered — but the same word is a real chapter title elsewhere." For now it only affects the line it's on, not headings nested under it; a one-click toggle next to the heading is planned so you won't have to type it by hand.
  • Headings inside comment blocks are now skipped: # lines inside %%…%% and <!-- --> are no longer treated as headings — not numbered, and they don't consume a counter slot either, so commenting a section out no longer shifts every number after it.
  • "Foreign numbering detected" no longer goes silent forever. Previously, once the plugin skipped a file because its headings looked like someone else's numbering scheme, it warned you once and then said nothing else — ever, until you cleaned the file up yourself or reloaded the plugin. From your side, the plugin had simply stopped working on that file, with no clue why. Now: switching away from the file and back gets you a fresh warning, and the warning itself is clickable — click it to see exactly which headings look foreign and what they'd become, before anything is touched. Nothing is ever auto-cleaned without that preview, because the same detection that catches real foreign numbering also flags perfectly ordinary headings like "API design" or "TODO list."
  • "Clear numbering in current file" actually works now. It used to be decorative: the command cancelled the one pending debounce timer, then your next keystroke renumbered the file right back. Clearing now also pauses that file (writes obsidian-auto-headings: false, folded into the same transaction so one undo reverts everything). Run Renumber now to hand the file back — it removes the property, making clear ↔ renumber a symmetric pair.
  • The plugin no longer fights you for the keyboard. Type a space at the end of a heading and pause — that space used to get silently stripped by the automatic renumber. The automatic path now leaves the line your cursor is on alone; it's picked up on the next trigger after you move away.
  • Copy sanitization is now always on, with nothing to configure. Copying or cutting numbered headings has stripped the plugin's invisible marker character from your clipboard since 1.0.10, behind a default-on switch. The switch is gone: not putting invisible characters in your clipboard is a promise this plugin keeps, not something you opt into. Pasting the same text back into your vault in the same session still restores the original, so numbering re-flows correctly.
  • Freeze numbering and release ownership (entire vault) — Settings → sensitive operations. Keeps every number exactly as it is, as plain text, removes only the invisible markers, and stops all automatic numbering from then on — for "I like my numbering, I just don't want a plugin managing it" or "I'm uninstalling but want to keep the result." Markers are removed everywhere, including inside link anchors, so [[note#heading]] links keep resolving.
  • Docs: the Pandoc export path has actually been tested (pandoc 3.10). A working filter ships at assets/pandoc/strip-autoheadings.lua. The Dataview guidance has been corrected — there is no file.headers field, so the query this README used to suggest never worked.

中文

本次发布合并了 1.0.13 之后的全部改动——1.0.14 到 1.0.21 都已开发但未单独发布,所以如果你是从商店当前在架的 1.0.13 升级,以下全是新东西。

  • 单个标题可以跳过编号:在任意标题行尾加上 <!-- skip -->(大小写不敏感、容忍多余空格),插件就不再碰它——不编号,也不占计数器槽位,后面的标题照常连续编号。给一个已经有编号的标题补上这个标记,下次重排会把那个编号摘掉。它在阅读视图里不可见。这解决了白名单管不了的场景:「这篇笔记里的这一个标题不该编号,但同一个词在别的笔记里是正常的章节标题」。目前只作用于标记所在的这一行,不含下面的子标题;后续会在标题旁提供一键切换,不必再手写。
  • 注释块内的标题不再被编号%%…%%<!-- --> 内的 # 行不再视为标题——不编号,也不占计数器槽位,所以注释掉一节不会再让后面所有编号整体错位。
  • 「检测到疑似外来编号」不再永久沉默。 此前插件因为某个文件的标题看起来像别的编号方案而跳过它时,只提示一次,然后就再也没有任何反应——直到你自己把文件清理干净,或者重新加载插件。从你的角度看,插件在那个文件里就是安安静静地不工作了,没有任何线索。现在:切到别的文件再切回来会再收到一次提醒,而且这条提醒可以点击——点击后会先列出到底是哪些标题看起来带编号、清理后会变成什么样,确认过再动手。绝不会在没有预览的情况下自动清理:同一套判断在抓真正的外来编号时,也会把「API design」「TODO list」这类完全正常的标题一起误判进去。
  • 「清除当前文件编号」不再是摆设。 它此前只取消了当前那一个待处理的防抖计时器,你下一次按键就把编号编了回去。现在清除会同时暂停这一个文件(写入 obsidian-auto-headings: false,并入同一次事务,一次撤销即整体回退)。想重新交给插件管,跑一次**「立即重新编号」**即可,它会顺手移除那条属性。
  • 插件不再跟你抢键盘。 在标题末尾敲一个空格然后停顿,那个空格此前会被自动重排静默吃掉。自动路径现在会放过光标所在的那一行;等你把光标移开,下一次触发再补上。
  • 复制净化现在恒开,无需任何配置。 复制或剪切含编号标题的内容时,插件从 1.0.10 起就会把那个不可见标记字符从剪贴板里剥净,此前是一个默认开的开关。现在开关取消了:不往你的剪贴板里塞隐形字符是这个插件的固有承诺,不是一个你需要去打开的选项。同一会话内原样粘贴回本库仍会自动还原原文,编号照常正确重排。
  • 固化编号并交还所有权(全库)——设置 → 敏感操作。原样保留全部编号、只把不可见标记移除,此后插件停止一切自动编号,适合「喜欢现在的编号,只是不想再被插件管着」或「准备卸载但要留住编号成果」。标记全库移除,包括写在内部链接锚点里的[[笔记#标题]] 仍能正常解析。
  • 文档:Pandoc 导出路径这次真的实测过了(pandoc 3.10)。仓库内置可用的 assets/pandoc/strip-autoheadings.lua。Dataview 的建议也已订正——它没有 file.headers 字段,README 此前推荐的那条查询从来就不可能生效。

Upgrade note / 升级说明

Nothing in your existing files changes on upgrade. The one setting that's gone is copy sanitization — it used to be a toggle in Settings → General, and it's simply always on now, so if you'd turned it off, copying will start stripping the marker character again (this only affects what other apps receive when you copy/cut; your notes are untouched).

升级不改动你现有的任何文件。唯一消失的设置是**「复制净化」**开关——原来在 设置 → 全局设置 里,现在恒开,如果你之前关过它,复制时会重新开始剥离标记字符(这只影响你复制/剪切时外部应用收到的内容,你的笔记文件不受影响)。

1.0.13

Choose a tag to compare

@github-actions github-actions released this 18 Jul 09:27

Batch renumber & "No numbering" pseudo-template / 批量重编号与「不编号」伪模板

English

  • Per-rule batch renumber: every path rule now has an inline batch button. One confirmed click renumbers all files the rule matches — each file with its own effective template, so a root-rule batch never overrides more specific folder/file rules. Files opted out via frontmatter, containing foreign (non-plugin) numbering, or resolving to "No numbering" are skipped automatically; open files keep undo support, and the confirmation dialog shows the affected file count up front.
  • "No numbering" pseudo-template: the template dropdown of each path rule gains a No numbering option — switch off numbering for a whole folder in one move instead of adding a frontmatter flag to every file. It participates in normal most-specific-wins resolution (so daily/ → No numbering beats your root rule), and existing numbers are left frozen, not stripped.
  • Polish: the folder browser in the path suggestion popup now uses matching lucide arrow icons for "go up one level" (arrow-left) and "drill down" (arrow-right).

中文

  • 规则级批量重编号:每条路径规则行内新增批量按钮,确认一次即可对该规则命中的全部文件重新编号——每个文件用它自己生效的模板,点根规则的批量不会覆盖更具体的文件夹/文件规则。frontmatter 已关闭、含外来(非本插件)编号、或解析为「不编号」的文件会被自动跳过;已打开的文件支持撤销,确认框会先显示受影响的文件数。
  • 「不编号」伪模板:路径规则的模板下拉新增**「不编号」**选项——一步关闭整个文件夹的编号,不用再逐文件写 frontmatter 开关。它参与正常的「最具体规则优先」解析(daily/ → 不编号 能压过根规则),已有编号会冻结保留、不会被剥除。
  • 打磨:路径建议弹窗的文件夹浏览中,「返回上一级」与「下钻」改用同族 lucide 箭头图标(arrow-left / arrow-right)。

Also included since 1.0.9 (1.0.10–1.0.12 were never published as releases):

  • Clipboard sanitizing (1.0.10, on by default): copying numbered headings now strips the invisible Word Joiner marker from the clipboard, so pasting into chats/documents is clean — while pasting back into your own vault restores the original text via an in-memory map, avoiding double numbering.
  • Folder browsing in path suggestions (1.0.11–1.0.12): the path-rule input now opens a level-by-level folder browser (click a name to select it, use the arrow to drill down, header to select the current level), consistently — including when you re-click a rule already set to / or a folder.

另附 1.0.9 以来的变化(1.0.10–1.0.12 未单独发布过 Release):

  • 复制净化(1.0.10,默认开):复制已编号标题时会剥离剪贴板里的不可见 Word Joiner 标记,粘贴到聊天/文档更干净;粘贴回自己库内时经内存映射还原原文,避免双重编号。
  • 路径建议的文件夹浏览(1.0.11–1.0.12):路径规则输入框改为按层级浏览文件夹(点名字选中、点箭头下钻、点顶部选中当前层),且外观一致——包括重新点击已配置为 / 或某文件夹的规则行。

1.0.10

Choose a tag to compare

@github-actions github-actions released this 18 Jul 07:19

Copy sanitization — new, on by default / 复制净化——新功能,默认开启

English

  • Clean clipboard: copying or cutting numbered headings no longer leaks the plugin's invisible marker character (Word Joiner, U+2060) into your clipboard. External apps — WeChat, Notion, Word, email clients, search boxes — now receive plain, clean text.
  • No double numbering on paste-back: pasting the same copied text back into your vault (within the same Obsidian session) automatically restores the original markers, so numbering re-flows correctly instead of producing ## 2 1 Heading-style double numbers.
  • Works everywhere you copy: both the editor and reading view are covered; rich-text copies from reading view keep their formatting, minus the invisible characters.
  • Fail-safe by design: every step is synchronous and guarded — if anything is unavailable (e.g. a restricted WebView), the plugin backs off silently and the clipboard behaves exactly as before. Turn it off any time in Settings → General → "Sanitize copied text".
  • Privacy: the copied-text mapping used for restore lives in memory only and is never written to disk.
  • Known limitation: text that was edited in another app, or pasted back after restarting Obsidian, is treated as new content (it may get freshly numbered on top of its visible numbers — same as pasting any external text).

中文

  • 干净的剪贴板:复制 / 剪切带编号的标题时,插件写入的不可见标记字符(Word Joiner,U+2060)不再随剪贴板外泄——微信、Notion、Word、邮件客户端、搜索框收到的都是干净文本。
  • 粘贴回不再双重编号:同一 Obsidian 会话内把复制的内容原样粘贴回库里,插件自动还原原始标记,编号照常重排,不会出现 ## 2 1 标题 式的双重编号。
  • 复制路径全覆盖:编辑器与阅读视图都生效;从阅读视图复制的富文本保留格式,仅剥去不可见字符。
  • 失败即让路:所有判断同步完成、层层守卫——任一环节不可用(如受限 WebView)即静默退让,剪贴板行为与从前完全一致。可随时在 设置 → 全局设置 → 「复制净化」 关闭。
  • 隐私:用于还原的复制内容映射只存在内存中,绝不写入磁盘。
  • 已知边界:在外部应用改动过的文本、或重启 Obsidian 后再粘贴回,按新内容处理(其可见序号可能被叠加新编号——与粘贴任何外部文本一致)。

1.0.9

Choose a tag to compare

@AArlert AArlert released this 11 Jul 09:48
e1860b9

GUI Update

1.0.8

Choose a tag to compare

@AArlert AArlert released this 10 Jul 08:27
  • Standalone global backlink
  • Fix bugs

1.0.7

Choose a tag to compare

@AArlert AArlert released this 05 Jul 07:33
1ce1174

feat: Added migration guard for automatic path, skipping initial auto-write of suspected foreign-numbered files

Files migrated from other numbered plugins or handwritten numbering (e.g., ## 1 Redmi) will automatically have their numbering stacked into ## 1 1 Redmi when this plugin is installed and global auto-numbering is enabled (under Scheme A, any content without WJ is treated as main text and numbers are directly appended). This results in a visual effect indistinguishable from a bug.

Added a read-only detection flag, hasUnclaimedForeignNumbering: if the document contains no Word Joiner characters and the title resembles an external numbering format, skip writing during automatic execution of scheduleRenumber/renumberOnOpen/renumberActiveFile, instead displaying a single prompt saying "Please clean up non-plugin-generated title numbering first." Manual commands remain unaffected and will proceed normally, bypassing all switches.

Added J10 to testplan; updated spec.md with additional specifications; bumped to 1.0.7.