HTML escaping broken after \_
Summary
The character sequence \_
breaks escaping html-tags afterwards.
Examples:
Source | Actual | Expected (matches GitHub) | Explanation / Notes |
---|---|---|---|
\_\<strong>test</strong> asdf |
_test asdf | _<strong>test asdf | The opening strong-tag is escaped but makes the text bold nevertheless. The text is bold even after the closing strong-tag. |
\_\<strong\>test</strong> asdf |
_test asdf | _<strong>test asdf | Same as above, but the > of the opening strong-tag is also escaped |
aaa\_bbb\<strong>test</strong> asdf |
aaa_bbbtest asdf | aaa_bbb<strong>test asdf | Same as above. Additional text before and after \_ does not change the outcome. |
\_\<strong>test</strong> asdf *ccc* |
_test asdf ccc | _<strong>test asdf ccc | Same as above. The text stops being bold at the next markdown sequence |
\_\<strong>test\</strong> asdf |
_test asdf | _<strong>test</strong> asdf | Now the closing strong-tag stops the bold text even though it is escaped. |
\_<strong>test</strong> asdf |
_test asdf | _test asdf |
|
_\<strong>test</strong> asdf |
_<strong>test asdf | _<strong>test asdf |
\ everything works. |
\*\<strong>test</strong> asdf |
*<strong>test asdf | *<strong>test asdf |
\* instead of \_ everything works. |
Steps to reproduce
Enter the above source snippets into the editor (e.g. the editor for the issue description).
This bug can be reproduced in the new editor on GitLab.com as well as the old editor on our local instance running GitLab Community Edition 15.11.3.
Workaround
One can use the escape sequence _
instead of \_
.
Edited by iTob