**Steps to replicate the issue** (include links if applicable):
* Go to https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:%C3%89chos_de_la_fondation#ChezLesDevs_:_nouvelles_fonctionnalités_pour_aider_au_contrôle_de_la_qualité_des_contributions_(EditCheck);
* Check the HTML source of this section;
* Observe that the span with the identifiant is:
```
lang=html
<span data-mw-comment-start="" id="c-Lofhi-20240125225100-ChezLesDevs_:_nouvelles_fonctionnalités_pour_aider_au_contrôle_de_la_qualité_"></span>
```
* Observe that the identifiant used in the HTML anchor for the message initiating the discussion is:
```
lang=html
<a href="https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:%C3%89chos_de_la_fondation#c-Lofhi-20240125225100-ChezLesDevs_:_nouvelles_fonctionnalités_pour_aider_au_contrôle_de_la_qualité_" class="ext-discussiontools-init-timestamplink">25 janvier 2024 à 23:51 (CET)</a>
```
* Observe the trailing whitespaces encoded as `_`;
* Try to use this anchor to autoscroll on the discussion;
**What happens?**:
The bug arises from the title of a discussion topic, which includes a trailing space (`_`) in its identifier. The generated identifier for the discussion includes this trailing space, such as `c-Lofhi-20240125225100-ChezLesDevs_:_nouvelles_fonctionnalités_pour_aider_au_contrôle_de_la_qualité_`. Depending of the POV, you could say that the bug stems from MediaWiki truncating the identifier because it's too long, which leads choosing an identifier that ends with a space.
But it seems less simple than it looks: you could think about a ending space cleaned from the URL since it is an unsafe character... but it seems more like a JavaScript/Parsoid trimming implementation problem. My request autosent by DiscussionTools to Parsoid after using the "add a link" button for previewing in visual mode is:
```
action "discussiontoolspreview"
format "json"
formatversion "2"
uselang "fr"
type "topic"
page "Wikipédia:Le_Bistro/31_janvier_2024"
wikitext "[[Wikipédia:Échos+de+la+fondation#c-Lofhi-20240125225100-ChezLesDevs+:+nouvelles+fonctionnalités+pour+aider+au+contrôle+de+la+qualité|Wikipédia:Échos+de+la+fondation#c-Lofhi-20240125225100-ChezLesDevs+:+nouvelles+fonctionnalités+pour+aider+au+contrôle+de+la+qualité+]]"
sectiontitle ""
useskin "vector-2022"
```
The whitespace is already removed even before submitting the message. The problem seem even more global, since adding a whitespace or even `_` (considered as a whitespace) after `é` is also cleaned by Parsoid when using source mode.
**What should have happened instead?**:
Autoscroll to the HTML identifiant.