Problem with Code Tags

I’m finding the code tags a little problematic. I’ve recently just attempted to reply to a thread and needed to highlight the following (purposely not in code tags):

echo ‘<pre>’, print_r($polls) ,‘</pre>’;

The above won’t work in code tags, and when trying to encode a less than (<) sign into its entity equivalent (<), I can put it into the code tags but it obviously shows the encoding and not the actual character:

echo '&lt;pre>',  print_r($polls) ,'</pre>';

Any suggestions on how to get round this? My solution was to put in a space (post here)

Thanks,
tpunt

Code Tag Test using ```php as the start line and ``` as the last line:

echo '<pre>', print_r($polls) ,'</pre>';

Code Tag Test using the code toolbar button:

echo '<pre>', print_r($polls) ,'</pre>';

Hmm… @system?

1 Like

Oh, I didn’t realise that the triple grave accent notation did that! Thanks for the workaround at least.

For my own testing purposes:

echo '<pre>', print_r($polls) ,'</pre>';

Edit: nope, not sure what I’m doing wrong… I really need to become more savvy with markdown.
Edit2: triple grave accents have to be on new lines…

Yes, sorry, I forgot to state that specifically. :smile:

1 Like

Its a bug, reported here:

https://meta.discourse.org/t/preformatted-text-not-working-quite-right/19830

Thanks @sam, I wasn’t sure if it were a bug or just weirdness with the markdown parser :smile: