Markup: nested lists not working in markdown

Created on 9 Jul 2013  Â·  28Comments  Â·  Source: github/markup

Hi there,

nesting numbered and unnumbered lists doesn’t seem to work in markdonw.

Here you have a sample:

  1. first item

    • item

  2. second item

    • item

  3. third item

    • item

The nested items are displayed as code, which is wrong in that case.

Many thanks for your help.

bug markdown

Most helpful comment

What about nested _ordered lists_?

  1. Something
    1.1. Something
    1.2. Something
  2. Something

It doesn't work.

All 28 comments

It might be helpful if you put the example inside of fenced code blocks so that we can see the actually source, not how it's rendered on GitHub.

I think your example looks like this:

1. one

    * nested

2. two

    * nested

3. three

    * nested

If that's the case, you need to remove the blank line between the parent and child item.

1. one
   * nested

2. two
   * nested

3. three
   * nested

As you can see in this preview:

  1. one

    • nested

  2. two

    • nested

  3. three

    • nested

Thanks for the reply.

Everything is clear to me know.

Thanks again.

I found a situation in which the solution above doesn’t help.

markdown allows “loose” list items:

  1. list item.
  2. list item.
  3. list item.
  4. list item.

As different from “tight” list items:

  1. list item.
  2. list item.
  3. list item.

But in nested lists it is impossible to have “loose” list items:

  1. one

    • nested

    • nested

    • nested

  2. two

    • nested

    • nested

    • nested

  3. three

    • nested

    • nested

    • nested

How about allowing the blank line between parent and child to be understood as a “loose” list item?

I mean the following: in nested lists, if the child item has a blank line _before_, this item is “loose’; if it doesn’t have the blank line, the item is “thight”.

/cc @github/markdown thoughts?

Thanks for the report. This is not something that can be fixed by a commit to this repository, so I'm going to close the issue, but our markdown team knows about it.

What about nested _ordered lists_?

  1. Something
    1.1. Something
    1.2. Something
  2. Something

It doesn't work.

To nest ordered lists, you have to indent the sub-items. Like this:

1. Something
  1. Something
  2. Something
2. Something
  1. Something

    1. Something

    2. Something

  2. Something

:+1:

And what I need to do to make ordered subitems? Like this:

1. Item1
  1.1, SubItemA
  1.2. SubItemB
2. Item2 
  2.1. SubItem 
  2.2. SubItem 
1. Item1
  1.1. SubItemA
  1.2. SubItemB
    - wat
      - inception noise
  1. Item1
    1.1. SubItemA
    1.2. SubItemB

    • wat



      • inception noise



I can't get the third level of nesting to work. Any pointers? I would expect wat to be a sub item of 1.2

@keenahn An extra space between the first and second level of nesting is required; 1.1 and 1.2 are just text, not actual subitems in this example. In general in CommonMark, you should indent content of a list to the same level as the text of the first item, i.e.:

1. Item1
   1. SubItemA
   2. SubItemB
      - wat
        - hi
  1. Item1

    1. SubItemA

    2. SubItemB



      • wat


      • hi



Note how the - in - wat aligns with the S in SubItemB above it.

How is this not working?

  1. List item 1.
  2. List item 2.
    1. Sublist item 1.
    2. Sublist item 2.
    3. Sublist item 3.
  3. List item 3.
  1. List item 1.
  2. List item 2.

    1. Sublist item 1.

    2. Sublist item 2.

    3. Sublist item 3.

  3. List item 3.

Weird. Apparently you have to have _3_ indent spaces to indent a sublist. New to me.

  1. List item 1.
  2. List item 2.
     1. Sublist item 1.
     2. Sublist item 2.
     3. Sublist item 3.
  3. List item 3.
  1. List item 1.
  2. List item 2.

    1. Sublist item 1.

    2. Sublist item 2.

    3. Sublist item 3.

  3. List item 3.

Your ``` examples and the examples beneath them aren't the same. Your last example has three spaces before the sublist items.

Doesn't seem to work for me. Can someone explain what I am doing wrong? Thanks

  1. For this
    a. do this
    i. then this
    ii. then this
    b. do this too

i. and ii. are indented to be under the "d" in "do".

This is a nearly five-year old issue; please direct your support request to the support team.

Still, try this:


1. For this
   1. do this
      1. then this
      2. then this
   2. do this too
  1. For this

    1. do this



      1. then this


      2. then this



    2. do this too

CSS styles the sublists accordingly.

ok thanks @kivikakk - I've emailed support team in the past about stuff. Never got a response

@avnermiz in the last six months you've contacted us twice and received a response both times! If our responses aren't coming through, please let me know and I'll start an investigation.

edit: I should say, we've _sent_ a response both times, but it could well be that our reply emails aren't making it through for some reason.

I apologize. It is my fault @kivikakk - and sorry to blame you / Github support. I get so many notifications from github that I filter out any that don't mention @avnermiz. My bad. I'll fix that. I did get your replies. Thanks, and again sorry about that

@avnermiz no problems at all, I'm glad we could get it sorted out! :heart:

If anyone is still confused:
Use 2 tab spaces for sublist

Did my own experimenting here... as @geerlingguy mentioned, 3 spaces will get you proper indentation:

1. So here
   - like this
      - and deeper
2. Or
   1. ordered lists
  1. So here

    • like this



      • and deeper



  2. Or

    1. ordered lists

but as @JGallardo mentioned, tabs also work (but you only need one per level of depth):

1. So here
    - like this
        - and deeper
2. Or
    1. ordered lists
  1. So here

    • like this



      • and deeper



  2. Or

    1. ordered lists

(this is documented... although the tab method doesn't seem to be)

What's the proper way to do a continued list inside of a list?

Goal:

1. One
   1. one
   2. two
2. Two
   3. three
   4. four

EDIT: Solved on StackOverflow

1. Item1
  1.1. SubItemA
  1.2. SubItemB
    - wat
      - inception noise

That works in comments, but doesn't seem to work in README.md files :(

In issue comment:

  1. Item1
    1.1. SubItemA
    1.2. SubItemB

    • wat



      • inception noise



In README.md file on github:
screen shot 2019-02-06 at 2 26 28 pm

1. Item1
  1.1. SubItemA
  1.2. SubItemB
    - wat
      - inception noise

That works in comments, but doesn't seem to work in README.md files :(

In issue comment:

  1. Item1
    1.1. SubItemA
    1.2. SubItemB

    • wat

      • inception noise

In README.md file on github:
screen shot 2019-02-06 at 2 26 28 pm

yeah im having the same problem

Hi. Is there a way for OL inside UL?

I'm having problems putting up this type of notation.

`

  1. SuperHeader
    1.1 SubHeader
    1.2 SubHeader
    1.3 SubHeader
  2. SuperHeader
    2.1 SubHeader
    2.2 SubHeader
    2.3 SubHeader
    `

P.S. - Though the below works fine I would appreciate it if someone came for the markdown counterpart of the above!

  1. SuperHeader

    1. SubHeader

    2. SubHeader

    3. SubHeader

  2. SuperHeader

    1. SubHeader

    2. SubHeader

    3. SubHeader

Was this page helpful?
0 / 5 - 0 ratings

Related issues

doggy8088 picture doggy8088  Â·  4Comments

schmidtw picture schmidtw  Â·  4Comments

ghost picture ghost  Â·  7Comments

danieljabailey picture danieljabailey  Â·  4Comments

petrdvorak picture petrdvorak  Â·  6Comments