Skip to content

Disable reference generation in preformatted/code blocks

Summary

If a user adds text in code or preformatted text via Markdown or HTML that contains #XXX, the system adds a note that issue XXX was mentioned. This is particularly annoying because we often list gdb backtrace dumps into our issues, and many issues get mentioned as a result. For example:

(gdb) bt
#0  0x00000000004004c4 in second () at main.cc:6
#1  0x00000000004004d2 in first () at main.cc:11
#2  0x00000000004004dd in main () at main.cc:17
(gdb) 

Steps to reproduce

  1. In an issue, write the above text using Markdown or HTML tags (e.g. <code>, <pre>).
  2. Observe that issue 1 and issue 2 have a note that says they were mentioned.

Expected behavior

Everything enclosed in the code blocks should be ignored as references.

Observed behavior

Issues get referenced unnecessarily.

Fix

I've made reference_extractor.rb strip out HTML and Markdown blocks before processing. I considered running the raw text through the entire Markdown processor, but this seems overkill and perhaps could lead to some unintended side effects.

Merge request reports