Steps to reproduce
- Settings > Files and links: turn on Automatically update internal links.
- Create a note
target(any content). - Create a note
Awith exactly this content:
%% see [[target]] here
more
%%
after
- Create a note
Bwith exactly this content:
1. > [!note] T
> ab cd [[target]] end
- Rename
targettorenamed. - Open
AandBin Source mode.
Did you follow the troubleshooting guide?
Yes (reproduced in a fresh vault, no community plugins, default settings apart from step 1).
Expected result
A:%% see [[renamed]] hereB:> ab cd [[renamed]] end
Actual result
The rename writes the new link at the wrong place and destroys the surrounding text:
A:%% se[](renamed.md)]] here(thee [[targetis gone, and a broken markdown link is left behind)B:> ab cd [[](renamed.md)end
The cause is visible in the metadata cache: app.metadataCache.getFileCache(file).links[0].position.start.col is wrong on those two kinds of line.
| Line | [[ is at column |
The cache says |
|---|---|---|
%% see [[target]] here (first line of a %% block comment) |
7 | 5 (2 short, as if %% were not there) |
- %% see [[target]] here (the same, inside a list item) |
9 | 7 |
> ab cd [[target]] end (a callout’s unindented > line inside a list item) |
8 | 9 (1 past) |
> ab cd [[target]] end (the same line, indented under the item) |
11 | 11 (correct) |
Footnote references and embeds on those lines are off by the same amount (%% | ![[==mark==]], [[target]] reports the embed at column 3 and the link at 18; they are at 5 and 20). A link on any other line of the comment, or in an inline %%...%% comment, is renamed correctly.
So any feature that edits a note at the positions the cache reports (rename, and plugins that rewrite links) corrupts these lines. Writing a to-do or a note to self as %% TODO check [[note]] on the comment’s first line is a common way to use comments.
Environment
SYSTEM INFO:
Obsidian version: 1.14.5
Installer version: 1.14.4
Operating system: Windows 11 Pro 10.0.26300
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on
RECOMMENDATIONS:
none
Fresh vault, no community plugins, default theme. Also reproduced on the current Catalyst build.
Additional information
Re-paste “Show debug info” before posting.
Credit: found by @saberzero1 with the remark-obsidian parity harness; I re-checked it on 1.14.5 and the current Catalyst build.