XF 2.2 BBCode is being parsed inside of code blocks

Foxtrek_64

Active member
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:
[icode][i]Don't italicize me bro[/i][/ icode]
[i]Don't italicize me bro[/i]

code:
[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):
[b][u]Title[/u][/b]
[i]Subtitle[/i]
Some [b]bold[/b] and [i]italicized[/i] text.

I see the following difference in the rendered code:
HTML:
<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>
    <div class="bbCodeBlock-content" dir="ltr">
        <pre class="bbCodeCode" dir="ltr" data-xf-init="code-block" data-lang="">
            <code>
                <i>Don't italicize me bro</i>
            </code>
        </pre>
    </div>
</div>
<!-- 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?
 
Back
Top Bottom