Why there are discontinuation with indented lists all 4 characters?

I am working on a markdown implementation. I try to understand why there are this discontinuation all 4 characters. Which rule produce this result? The follow code:

+ one
 + two
  + three
   + four
    + five
     + six
      + seven
       + eight
        + nine
         + ten
          + 11
           + 12
            + 13
             + 14
              + 15
               + 16
                + 17
                 + 18
                  + 19
                   + 20

Produce the follow result here:

  • one
  • two
  • three
  • four
    + five
    • six
    • seven
    • eight
    • nine
      + ten
      • 11
      • 12
      • 13
      • 14
        + 15
        • 16
        • 17
        • 18
        • 19
          + 20

The reference implementation commonmark.js demo has litte different behavior. But has also this discontinuation.

Per CommonMark rules:

The rules for sublists follow from the general rules above. A sublist must be indented the same number of spaces a paragraph would need to be in order to be included in the list item.

That text is just above Example 264 and Example 265 which specifically address why your text is interpreted the way it is.

The difference is not a flaw. Both renderings are treating + five as a paragraph continuation rather than a list item. This is per the rules (it’s esoteric, don’t have time to find it). The difference is that Discourse (the hosting software of this forum) renders newline chars has line breaks and the Demo renders them as spaces. This variation is allowed by the spec.

Woops, I missed the significance of these words. You aren’t questioning why the each indentation isn’t interpreted as nesting, but why the sudden change at four spaces.

That’s the esoteric rule that I mentioned earlier without realizing it was the rule you were looking for. See Example 282 and the explanation just above it:

Note, however, that list items may not be indented more than three spaces. Here - e is treated as a paragraph continuation line, because it is indented more than three spaces:

2 Likes

Thanks, this help me to understand it.