I seem to regularly have problems adding code to my answers so that they're formatted properly, and I don't know if it's a bug, me, a combination of the two, or something else altogether.

By way of example, today I posted this answer. Now, in case I get it to appear properly, below is a screenshot of the portion as it currently displays:

enter image description here

As you can see it's not really displaying properly. I've tried following everything in How to improve this source code quoting?, but often the result is the same.

I've also tested this using different hardware, software and operating systems.

What am I doing wrong?

This is happening all too often, but I'm not flagging it as a bug yet because I figure it must be working okay for others.

  • 2
    Multiline code formatting works better if you use four or eight space characters instead of `` ;-) – nohillside Apr 21 '18 at 5:33
  • Anyway, what do you mean by "display properly"? – nohillside Apr 21 '18 at 6:48
  • @patrix Thanks for editing the answer I posted earlier - that's exactly what I meant by display properly. :) – Monomeeth Apr 21 '18 at 11:11
  1. This is the proper way to include blocks of code within a numbered or bulleted list: use eight spaces instead of four:

       <div>This is a test.</div>

See Code blocks inside lists and/or list items? on Meta Stack Exchange.

Applied to your answer above you get

enter image description here

  • Thank you! :) Hopefully I'll never have this problem again! LOL – Monomeeth Apr 21 '18 at 11:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .