Fix markdown rendering for label references
What does this MR do?
Fixes #14424 (closed)
Fixes #19753 (closed)
Fixes #19760 (closed)
Are there points in the code the reviewer needs to double check?
The changes in the pattern used to extract label references from text.
Screenshots (if relevant)
Before:
After:
/cc @DouweM @rspeicher @axil