-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
This issue possibly duplicates #3679 and #5019.
Prettier 2.5.1
Playground link
--parser markdownInput:
- i like list
- with
- sub
- items
1. i like list
1. with
1. sub
1. items
Output:
- i like list
- with
- sub
- items
1. i like list
1. with
1. sub
1. items
Expected behavior:
- i like list
- with
- sub
- items
1. i like list
1. with
1. sub
1. items
I'm working on some documentation, which is built with MkDocs, which uses the python-markdown library, which requires list item bodies to be indented by 4 spaces, per the spec. They point to this part of the spec:
List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab
Prettiers default auto-formatting in this scenario breaks nested lists, as they are only indented with 2 spaces. I would argue, that the configured tab width in Prettier should not have an impact here, as the 4 space (or 1 tab) indentation is explicit in the spec.
To correct this behavior, I first tried to just use --tab-width=4, which fixes the MkDocs rendering of the list.
But now the output is very confusing to me. Why is there indentation added to the list item itself, but only for the unordered list? (Likely discussed in #5019) Is this a bug? Is this even the right way to resolve this?