- HEADING_REGEX now requires a space/EOL after '#' so tag lines (#project ...) are no longer misdetected as headings and corrupted. - Command enable/disable settings now take effect immediately via checkCallback/editorCheckCallback instead of requiring a reload. - New Adjacent File auto-increments (Untitled.md, Untitled 1.md, ...) instead of throwing once Untitled.md already exists. - Selection-change tracking is delegated from document instead of a one-time .cm-content scan, so editors opened after startup are covered. See CHANGELOG.md for details.
2.8 KiB
Changelog
All notable changes to this project are documented in this file. Format loosely follows Keep a Changelog.
[Unreleased]
Fixed
-
Heading toggle corrupted lines starting with a tag (
#tag ...).HEADING_REGEX(src/Constants.ts) matched any run of leading#characters as a heading marker, even without a following space. Obsidian tags like#project meeting noteswere therefore misread as an existing H1, so running Toggle Heading - H1 on such a line stripped the#instead of adding a heading (and running any other heading level inserted a stray heading marker before the tag). The regex now requires the#run to be followed by whitespace or end-of-line before it counts as a heading, matching the ATX heading rule already used by Toggle Heading (strip formatting). (src/Constants.ts,src/ToggleHeading.ts) -
Command enable/disable toggles in Settings required an Obsidian restart.
registerCommands()only ran once inonload(), checkingenabledCommandsat registration time. Flipping a toggle in the settings tab saved the new state but had no effect on the already-registered commands until the plugin was reloaded, contradicting the setting's own description ("Disabled commands will not appear in the command palette"). Commands are now always registered and gated throughcheckCallback/editorCheckCallback, so palette visibility and hotkeys respond immediately to settings changes. Command IDs are unchanged, so existing hotkey bindings are unaffected. (src/main.ts) -
"New Adjacent File" failed after the first use in a folder. The command always targeted a literal
Untitled.md;vault.create()throws if that path already exists (very likely, since it's also Obsidian's own default new-note name), surfacing a raw errorNoticeon every subsequent use. It now finds the next availableUntitled N.mdname in the folder, mirroring Obsidian's built-in new-note behavior. (src/FileHelper.ts) -
Selection-tracking listeners went stale for editors opened after startup.
registerSelectionChangeListeners()attachedkeydown/click/dblclicklisteners to every.cm-contentelement found via a singlequerySelectorAllat layout-ready. Editors created afterward (new panes, splits, tabs) got their own.cm-contentelement that was never instrumented, silently degrading the manual-vs-programmatic selection heuristic used by Select Next/Previous Occurrence. Listeners are now delegated fromdocumentin the capture phase, so any editor present now or opened later is covered. (src/main.ts)
Chore
- Reinstalled
node_modulesto pull the@esbuild/win32-x64binary; the checked in lockfile/install had resolved only@esbuild/linux-x64, sonpm run buildandnpm run devfailed outright on this machine.