XF 2.2 BBCode is being parsed inside of code blocks


I'm not sure when this changed, but in the past, code blocks would disable parsing. This would allow me to provide raw bbcode as a sample.

I would expect the same behavior we see with icode to be present in code blocks, but in reality what happens is icode disables parsing and code does not. The samples below both have the same content, but you'll see the code block still parses the internal bbcode. I have had to add spaces to closing icode blocks since it seems to close the outer-most one first.

[icode][i]Don't italicize me bro[/i][/ icode]
[i]Don't italicize me bro[/i]

[CODE=rich][I]Don't italicize me bro[/I][/CODE]
Rich (BB code):
Don't italicize me bro

code with internal icode (sloppy workaround but works for single-line code):
[CODE=rich][icode][i]Don't italicize me bro[/i][/ icode][/CODE]
Rich (BB code):
[i]Don't italicize me bro[/i]

code with internal icode wrapping multi-line content:
[CODE=rich][icode][b][u]Title[/u][/b] [i]Subtitle[/i] Some [b]bold[/b] and [i]italicized[/i] text. [/ icode][/CODE]
Rich (BB code):
Some [b]bold[/b] and [i]italicized[/i] text.

I see the following difference in the rendered code:
<code class="bbCodeInline">[i]Don't italicize me bro[/i]</code>
<div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code">
    <div class="bbCodeBlock-title">
        Rich (BB code):
    <div class="bbCodeBlock-content" dir="ltr">
        <pre class="bbCodeCode" dir="ltr" data-xf-init="code-block" data-lang="">
                <i>Don't italicize me bro</i>
<!-- Remaining blocks omitted -->

There is a missing bbCodeInline class in the <code /> element within the [code] block, which may be a contributing factor.

Is there a way to make it so code blocks will not parse code?
You're setting the rich option on the code block, which will enable BBCode.

[I]There is no italicization here.[/I]
Top Bottom