Resolve "User-generated permalink IDs collide with GitLab interface"
What does this MR do?
Prevents ID values automatically generated by headers in GitLab Flavored Markdown from colliding with IDs used elsewhere in the GitLab interface. This can cause confusion when, for instance, a selector looks for a merge request tab with id="pipelines"
and there is a header with the same ID earlier in the DOM.
How this works:
- All header IDs generated with GitLab Flavored Markdown are namespaced with
id="user-content_foo"
- All anchor links which point to these IDs continue to use the non-namespaced hash
<a href="#foo">...</a>
- When a page is loaded or when the
hashchange
event is triggered, javascript will automatically search for#user-content_foo
if#foo
cannot be found, and scroll to that position instead.
Before
After:
Does this MR meet the acceptance criteria?
-
Changelog entry added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #22781 (closed)
See also prior attempts to address this issue: #3908 (closed), !2023 (merged), !2024 (merged)