I had a couple of issues posting a code snippet earlier. First it interpreted colon-P as a smiley, which it probably should not do in a code snippet; I added a space to stop it doing so. Second the first line of the snippet is not using the code font. In fact the first two lines weren’t, until I inserted a blank line between them. But nothing I tried fixed the first line. Perhaps related the backwards quotes used to mark the section of code seem to be visible after it’s posted; they should be converted to markup I think.
I posted a second code snippet, and this time have not tried doing anything to fix it so it shows the problems.
OK, I think I’ve worked it out. The backticks that are inserted by clicking on the </> icon don’t work. Maybe they are for inline code samples. What does work is simply indenting everything, or at least that seems to be what finally fixed it, both the font issue and the smileys. And removing the backticks which might have been disrupting the first lines.