Skip to main content
Post Made Community Wiki
Source Link
Cody Gray
  • 64.5k
  • 23
  • 197
  • 313

A couple of different ways to do this in markdown that will work on any browser:


Ordered list:

  1. test

Unordered list:

  • test

As second paragraph, it's fine:

  • first paragraph

    second paragraph
    

First Approach: You use backticks to indicate that the first two lines are inline code snippets. You don't get syntax highlighting this way, but you don't get that with <pre> and <code> tags anyway.


Ordered list:

  1.  

    test
    

Unordered list:

  •  

    test        
    

As second paragraph, it's fine:

  • first paragraph

    second paragraph
    

Second Approach: You use either a string of regular (non-code) text, or a literal space character (&nbsp;) or equivalent, to make the list item show up, then you indent the code block using 8 spaces starting on the next line.

The advantage here is that you get syntax highlighting for the code block and it is a lot easier to read. The obvious disadvantage is that it will not be displayed on the same line as the number/bullet. It's still just below the number/bullet, though, and obviously associated with it, so this achieves very much the same general effect as the first approach.