Sanitize HTML inside headings for linking

Steps to reproduce

  1. In a note (suppose it is named Example.md) inside the vault, create a heading containing an HTML tag, such as ## <i lang='fr'>L’amour toujours</i>
  2. In another note, attempt to reference the specific section of the note by typing [[Example#L’amour toujours]].
  3. It won’t work, unless you change it to [[Example#<i lang='fr'>L’amour toujours</i>]]

Expected result

The suggested heading (as well as the one to be referenced) should be sanitized—hence stripped of all HTML tags inside it—before it is read.

I should be able to use [[Example#L’amour toujours]] both for ## L’amour toujours and ## <i lang='fr'>L’amour toujours</i>


Actual result

I have to change the content of the heading including HTML tags in order to make it work.


Environment

  • Operating system: MacOS 12.1
  • Debug info: N/A

Additional information

I don’t consider this a bug. You can open a feature request.