Skip to content

Tab-indented nested lists get collapsed and escaped #3223

@sampi

Description

@sampi

Prettier 1.8.2
Playground link

--parser markdown
--use-tabs

Input:

# List with 2 space indentation and `-` (correct)
- Top level list item 1 
- Top level list item 2
  - Nested List item 1
  - Nested List item 2
    - Sub-Nested List item 1
    - Sub-Nested List item 2

# List with 2 space indentation and `*` (correct)
* Top level list item 1
* Top level list item 2
  * Nested List item 1
  * Nested List item 2
    * Sub-Nested List item 1
    * Sub-Nested List item 2

# List with 2 space indentation and `-` (correct)
- Top level list item 1 
- Top level list item 2
    - Nested List item 1
    - Nested List item 2
      - Sub-Nested List item 1
      - Sub-Nested List item 2

# List with 2 space indentation and `*` (correct)
* Top level list item 1
* Top level list item 2
    * Nested List item 1
    * Nested List item 2
      * Sub-Nested List item 1
      * Sub-Nested List item 2

# List with 1 tab indentation and `-` (incorrect)
- Top level list item 1 
- Top level list item 2
	- Nested List item 1
	- Nested List item 2
		- Sub-Nested List item 1
		- Sub-Nested List item 2

# List with 1 tab indentation and `*` (incorrect)
* Top level list item 1
* Top level list item 2
	* Nested List item 1
	* Nested List item 2
    	* Sub-Nested List item 1
    	* Sub-Nested List item 2

Output:

# List with 2 space indentation and `-` (correct)

* Top level list item 1
* Top level list item 2
	* Nested List item 1
	* Nested List item 2
		* Sub-Nested List item 1
		* Sub-Nested List item 2

# List with 2 space indentation and `*` (correct)

* Top level list item 1
* Top level list item 2
	* Nested List item 1
	* Nested List item 2
		* Sub-Nested List item 1
		* Sub-Nested List item 2

# List with 2 space indentation and `-` (correct)

* Top level list item 1
* Top level list item 2
	* Nested List item 1
	* Nested List item 2
		* Sub-Nested List item 1
		* Sub-Nested List item 2

# List with 2 space indentation and `*` (correct)

* Top level list item 1
* Top level list item 2
	* Nested List item 1
	* Nested List item 2
		* Sub-Nested List item 1
		* Sub-Nested List item 2

# List with 1 tab indentation and `-` (incorrect)

* Top level list item 1
* Top level list item 2 - Nested List item 1 - Nested List item 2 - Sub-Nested
	List item 1 - Sub-Nested List item 2

# List with 1 tab indentation and `*` (incorrect)

* Top level list item 1
* Top level list item 2 _ Nested List item 1 _ Nested List item 2 _ Sub-Nested
	List item 1 _ Sub-Nested List item 2

Second Output:

# List with 2 space indentation and `-` (correct)

* Top level list item 1
* Top level list item 2 _ Nested List item 1 _ Nested List item 2 _ Sub-Nested
	List item 1 _ Sub-Nested List item 2

# List with 2 space indentation and `*` (correct)

* Top level list item 1
* Top level list item 2 _ Nested List item 1 _ Nested List item 2 _ Sub-Nested
	List item 1 _ Sub-Nested List item 2

# List with 2 space indentation and `-` (correct)

* Top level list item 1
* Top level list item 2 _ Nested List item 1 _ Nested List item 2 _ Sub-Nested
	List item 1 _ Sub-Nested List item 2

# List with 2 space indentation and `*` (correct)

* Top level list item 1
* Top level list item 2 _ Nested List item 1 _ Nested List item 2 _ Sub-Nested
	List item 1 _ Sub-Nested List item 2

# List with 1 tab indentation and `-` (incorrect)

* Top level list item 1
* Top level list item 2 - Nested List item 1 - Nested List item 2 - Sub-Nested
	List item 1 - Sub-Nested List item 2

# List with 1 tab indentation and `*` (incorrect)

* Top level list item 1
* Top level list item 2 _ Nested List item 1 _ Nested List item 2 _ Sub-Nested
	List item 1 _ Sub-Nested List item 2

Expected behavior:
Tab-indented nested lists should work the same as space-indented, especially if --use-tabs is on.
This also makes using tabs for indentation indeterministic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:markdownIssues affecting Markdownlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!scope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions