Fix cross-references that contain underscores
What does this MR do?
Cross-references that contain underscores confuse the Markdown renderer and don't work properly. For example:
- In
myacct/project_one#456
, add a comment that includes a reference tomyacct/project_two#123
. - The comment in
myacct/project_one#456
links correctly. - The system note in
myacct/project_two#123
is incorrectly linked as:
mentioned in issue myacct/projectone#456_
This MR removes the use of the _
character in the system notes to prevent Markdown confusion.
See a full discussion in #1160 (closed).
Are there points in the code the reviewer needs to double check?
To preserve backwards compatibility with existing system notes, there is a SQL wildcard match for notes having underscores. This seemed safer than migrating all notes.
Why was this MR needed?
In an ideal world, the Markdown parser would be able to handle references containing underscores with or without escape sequences. However, there are a number of issues:
- RedCarpet's parser for emphasis block is pretty dumb: it treats
#
as a word break and thus even theintra_word_emphasis
flag has no effect. - The parser is in C and can't be changed easily.
- There is no way to insert an escape sequence for emphasis blocks.
The only way around this is to switch to something like CommonMark, which does support escape sequences.
Feature requests?
What are the relevant issue numbers /Issue #1160 (closed)
Screenshots
Before:
After: