**Steps to replicate the issue** (include links if applicable):
* Go to a talk page
* Click the "new section" tab
* Type `#Test` for the heading
* Fill in some random text for the message
* Save the edit
* Go to the history tab
**What happens?**:
* Edit summary is `→#Test: new section`
* Clicking on that does not jump you to the right section. Jumps you to the non-existent "Test" section instead of `#Test` section.
**What should have happened instead?**:
* Edit summary should be `→##Test: new section`
* Clicking on that should jump you to the `#Test` section.
**Software version** (skip for WMF-hosted wikis like Wikipedia):
**Other information** (browser name/version, screenshots, etc.):
* Was not able to reproduce with # in the middle of the section title. So this bug only occurs at the beginning.
* One might think there is no use case for starting a talk page heading with #. But it does happen sometimes in the wild. For example, https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)##Anchors_in_links_appear_to_be_broken_on_all_wikis,_all_skins and https://en.wikipedia.org/w/index.php?title=Wikipedia:Administrators%27_noticeboard&oldid=1106281408##WPWP_photo_contest_again