Markdown link to a heading containing % is written unencoded and cannot be followed

Steps to reproduce

  1. Settings → Files and links: “Use [[Wikilinks]]” off.
  2. In a note, add ## Percent % in a heading.
  3. Below it, type [[# and pick the heading.
  4. From another note, type [[ and the note’s name, #, and pick the heading.
  5. Hover or click each link.

Did you follow the troubleshooting guide?

Y. Reproduced in the sandbox vault.

Expected result

The % is encoded as %25, and both links reach the heading.

Actual result

Autocomplete writes [Percent % in a heading](#Percent%20%%20in%20a%20heading). The % is left unencoded, so the destination holds invalid percent-encoding. Both links are styled as external links, show no preview, and do nothing when clicked.

Environment

<paste “Show debug info” output here>

Additional information

Related, archived: Incorrect autocompletion for hash wikilinks with percent sign (2022), where wikilink autocomplete dropped the % instead.