Skip to content

Instantly share code, notes, and snippets.

@jakebellacera
Last active April 25, 2022 15:58
Show Gist options
  • Save jakebellacera/e6cf642872206d9ce0e9747ff8d80b41 to your computer and use it in GitHub Desktop.
Save jakebellacera/e6cf642872206d9ce0e9747ff8d80b41 to your computer and use it in GitHub Desktop.
How to write multi-line lists in Markdown

Perhaps you're writing an ordered list in markdown and you need to add a list item or two with multiple lines. You try to write it, but your numbers keep resetting! What gives?

What you need to do is add a space after each additional line in a list item.

Quick example

1. Item number one

 Second line in item number one.

2. Item number two!

Results in...

  1. Item number one

Second line in item number one.

  1. Item number two!

Writing multi-line lists with code snippets, blockquotes, and other elements

The same rules apply for these elements. In all cases, you would add a space before each line of the block element. View the raw source of this document to see what I mean.

Full Example

  1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi magna, sagittis sit amet tortor sit amet, euismod porttitor velit. Donec eget finibus metus.

Aenean tincidunt ante tempor arcu semper, ut euismod magna maximus. Mauris scelerisque urna et lorem imperdiet viverra. Nam egestas libero quis venenatis fermentum. Suspendisse sit amet consectetur enim, at posuere tortor.

Note: Cras faucibus nisl a lacinia porttitor!

var lorem = ipsum(dolor, sit, amet);
  1. Curabitur sit amet tortor a sem ultricies pretium sed eget neque. Duis non vehicula arcu, ac pulvinar enim. Pellentesque at ex ac purus imperdiet elementum. Maecenas condimentum diam at diam consectetur lacinia.

Vivamus fringilla pellentesque tellus, fermentum venenatis est ornare a. Fusce ullamcorper orci sed porta cursus. Integer tincidunt facilisis orci a semper.

  1. urabitur fringilla accumsan nibh, non volutpat mauris commodo id. In commodo quam eu purus tempor, eget pretium purus gravida.
@lxw0109
Copy link

lxw0109 commented Aug 27, 2018

I do have the exactly same question.

@nk9
Copy link

nk9 commented Apr 3, 2022

This doesn't seem to be working in GitHub markdown. Instead, use three spaces before lines you want to indent to match the preceding list item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment