Refactor anchor link handling for badges
What does this MR do and why?
Refactors how we drop badge content from anchor links on headers.
The previous approach was to match specific words in the badges, like "premium self" and drop known pairs. This no longer works well as we've introduced badges that are more likely to appear in regular header text, or outside of known pairs that we can more confidently match.
In this MR, we change the logic to instead find text in markdown strong tags **(like this)**
within headers, and we match against that when truncating the anchors, rather than the list of badge words. We can be more certain that text formatted **(like this)**
is a badge than we can by looking for strings like "all" or "beta."
This will fix the "Experiment" and "Beta" anchor links on this page: https://docs.gitlab.com/ee/policy/experiment-beta-support.html
Closes #1700 (closed)
Screenshots, screen recordings, or links to review app
On the review app, or locally, check some anchors that are broken on production:
-
Broken: https://docs.gitlab.com/ee/policy/experiment-beta-support.html#experiment
-
Working: http://localhost:3000/ee/policy/experiment-beta-support.html#experiment
-
Broken: https://docs.gitlab.com/ee/user/application_security/#ultimate
-
Working http://localhost:3000/ee/user/application_security/#ultimate
-
Broken: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html#ultimate
-
Working: http://localhost:3000/ee/development/documentation/styleguide/word_list.html#ultimate
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.
Closes #1700 (closed)