How to apply code formatting, in a Numbered/Bulleted list?

I’ve always had trouble formatting my code, after I use a Numbered/Bulleted list - It just never formats for some reason. Like:

  1. ONE.
  2. TWO
  3. COPY/PASTE CODE HERE AND FORMAT IT.

Or

  • Point.
  • Another point.
  • public ILogger Logger { get; set; }
    public LoggingManager(ILogger logger)
    {
    Logger = logger;
    }

Ahhh, in a perfect world where I could format ^

I want it so that, I could put my code, after the number/bullet, like:

N-
   CODE HERE

If I do that, I either get out of the list’s sync, or it just won’t get formatted.

Is this how this thing works in the first place, or I just don’t know how? Of course, I didn’t see anything about this in the “Unity answers tutorial video”

Thanks.

  1. One
  2. Two
  3. for (int i=0; i < 42; i++)

This uses the backtick character to format the code, it only works for one line.

  1. One
  2. Two
  3. //This is multiple //lines of code //but it's a pita to enter

This uses the code html tag and the br html tag at the end of lines. It requires quite a bit of manual work, since the markdown editor assumes every line you enter whilst in list mode is a new entry in the list. Which means cutting-and-pasting code is non-trivial.

I too have problems code in relation to lists. That is, if I attempt to format code directly after a list, the formatting does not work correctly. The solution I’ve found is to put a line of ‘normal’ text or a dotted line followed by an empty line between the list and the code .

  • One
  • Two
  • Three

   #pragma strict
    
    function Start() {
    
    }

Without the line, the code would not format correctly.