Renaming a heading jumps to the internal link location, and links inside %% comments are converted to []()

Steps to reproduce

Bug 1 — After renaming a heading, Obsidian jumps to the internal link instead of staying at the edited heading

  1. Open a note that contains:
  • A heading ## Example Heading
  • An internal link pointing to this heading, e.g. [[#Example Heading]]
  • Important: this internal link is located above the heading in the same file.
  1. Right-click the heading → choose Rename heading.
  2. Change the heading text and click Save.

Bug 2 — Internal links preceded by %% (comments) are incorrectly converted to []() format

  1. In a note, add an Obsidian comment %% ... %% containing an internal link to a heading, such as:
%% [[#Example Heading]] %%
  1. Right-click the heading → Rename heading → Save.

Did you follow the troubleshooting guide? [Y/N]

Y
Reproduced in sandbox vault with:

  • Default theme
  • No community plugins
  • No CSS snippets

Expected result

Bug 1

After clicking Save, the editor should remain at the heading I just renamed.
It should not jump to any internal link elsewhere in the document.

Bug 2

The internal link inside %% ... %% should be updated normally as [[#New Heading]],
and must not be transformed into the markdown link syntax []().


Actual result

Bug 1

After clicking Save, the editor jumps to the location of the internal link that points to this heading (especially when that link is located above the heading).
This disrupts editing because the cursor is moved away from the heading location.

Bug 2

The internal link inside %% ... %% is incorrectly rewritten into empty markdown link syntax:

[]()

instead of the correct Obsidian wikilink syntax:

[[#New Heading]]

Environment

(Please paste your Show Debug Info output here.)

Obsidian:1.10.3


Additional information

Screenshots or screen recordings will help reproduce this issue more precisely.