This was reported in Headings with special characters have broken links and renaming, which is now in the Bug graveyard. The answer there was that [[Example#heading!]] was written by hand, because the autocomplete wrote [[Example#heading]]. That no longer holds. The autocomplete now keeps most punctuation in heading links, so it writes the very link that lands on the wrong heading.
Steps to reproduce
-
Create a note
Note.md:# a b # a.b -
In another note, type
[[Note#and picka.bfrom the list. -
Click the link.
Did you follow the troubleshooting guide?
Yes. Reproduced in a fresh vault with default settings.
Expected result
The link the autocomplete writes, [[Note#a.b]], leads to the heading a.b.
Actual result
It leads to a b. Every link to the second heading lands on the first, in both formats: [[Note#a.b]] and [x](Note.md#a.b). So the second heading cannot be linked at all.
The match folds case, runs of whitespace, a no-break space, and every ASCII punctuation character except ', - and _. I checked all 32 ASCII punctuation characters, plus case and spacing. Each of these pairs collides:
a banda<c>b, for every punctuation character<c>except',-and_. Fora#bthe autocomplete writes[[Note#a b]], which also goes to the first heading.abandABa banda b(two spaces)a banda bwith a no-break space
a'b, a-b and a_b are reached correctly.
The help promises links to headings, and it says the autocomplete is the way to make them. A link the autocomplete writes for a heading should reach that heading. One fix that keeps existing links working: prefer a heading whose text matches the link exactly, and fall back to the loose match only when none does.
Related feature request: Support special characters in headings for linking
Environment
Obsidian 1.14.5, installer 1.14.5, Windows 11. Also the same on 1.15.0 (Catalyst).