Headings with special characters have broken links and renaming

Renaming ## ! with the rename heading command renames links to the note itself.

## !

[[Example#!]]
[[Example]]

rename


Renaming ## heading? with the rename heading command also renames links to ## heading!.

Headings that differ only in special characters cannot be referenced properly. Here, the link to [[Example#heading!]] resolves to [[Example#heading?]]

## heading?

content?

## heading!

content!
[[Example#heading!]]

image

This is not a bug. Links to headers are stripped of non alphanumeric character.
## heading? and ## heading! are the same from Obsidian linking perspective.

You manually wrote [[Example#heading!]], because Obsidian autocomplete creates [[Example#heading]] for the above mentioned reason.

I know Obsidian autocomplete would do. The link behaviour is still unintuitive.

Is the first behaviour, renaming a heading with special characters only (or a heading with no name) also intended? Seems bizarre to me that the “rename heading” feature would result in renaming links where no heading was referenced.

## !

[[Example#!]]

[/quote]

This is not a thing that is supported. You manually wrote it. So renaming it is undefined.

It should however now touch the simple link [[Example]]. Will be fixed next release.

I suggest you open FR to handle special characters in links.

Thanks, I made the FR here.

Side note: being able to write things manually is one of Obsidian’s strengths, I don’t think it’s a reasonable expectation to only use autocomplete and commands. Also, writing it manually should still not make behaviour undefined. I’d rather unsupported things would just break (e.g. this would work like other dead links) than do unexpected things.

Also, what is “non-alphanumeric” here exactly? Headings with only emojis seem to work.

We strip punctuation chars.

Is it documented somewhere exactly which characters are stripped? I have been unable to find this information in the Help documentation. There are characters allowed in filenames that get stripped from headings, which was unexpected to me. (I imagine there are ranges of unicode characters that would be atripped too, not just ASCII punctuation? Any link tp documentation on this would be appreciated; thank you!

Given Obsidian Release v0.16.0 (Insider build):

Do you know if there is a list anywhere of what is stripped and what is kept? Thanks!

#, |, ^, \, [[, ]], and %