zhuochun / md-writer

✒️ Make Atom a better Markdown/AsciiDoc editor for writers and bloggers
https://atom.io/packages/markdown-writer
MIT License
341 stars 46 forks source link

List indentation is incorrect for OL #274

Closed zhuochun closed 5 years ago

zhuochun commented 5 years ago

https://spec.commonmark.org/0.28/#list-items

The most important thing to notice is that the position of the text after the list marker determines how much indentation is needed in subsequent blocks in the list item. If the list marker takes up two spaces, and there are three spaces between the list marker and the next non-whitespace character, then blocks must be indented five spaces in order to fall under the list item.


Eg 1:

1. abc
  - abc // 2 spaces indent
2. askldjf

Render 1:

  1. abc
    • abc // 2 spaces indent
  2. askldjf

Eg 2:

1. abc
   - abc // 3 spaces indent
     - efg // 5 spaces indent
2. askldjf

Render 2:

  1. abc
    • abc // 3 spaces indent
      • efg // 5 spaces indent
  2. askldjf

Eg 3:

- abc
  1. abc // 2spaces indent
- askldjf

Render 2: