Ajedi32 reports a bug where Discourse fails to correctly render HTML <pre> tags inside code spans when followed by preformatted text, contrary to the CommonMark spec example 257. Examples show that code spans containing <pre> break rendering if subsequent content includes <pre> blocks Ajedi32, though the issue doesn’t occur if preformatted text appears before the code span or is absent entirely Ajedi32. eviltrout notes Discourse isn’t yet fully CommonMark-compliant but acknowledges it may still be a non-CM-specific bug. Ajedi32 clarifies that even without CommonMark, the behavior is suboptimal. sam confirms the issue is now resolved as part of ongoing CommonMark testing and notes that code block hoisting has been disabled, preventing this behavior entirely. See CommonMark Testing Started Here for details.
Code spans, HTML tags, and autolinks have the same precedence. Thus, this is code:
Input:
`<a href="`">`
Render:
<p><code><a href="</code>">`</p>
The problem is that this doesn’t work for <pre> tags when any part of the input markdown following the code span contains preformatted text. (Example shown in my reply to this post.)
This issue does not occur when the document contains pre-formatted text before the code span containing <pre>, or when the document does not contain pre-formatted text at all.