Skip to content

[CommonMark] false positive for list.loose caused by trailing newline with whitespaces #350

Closed
@ikatyang

Description

Subject of the issue

commonmark: true

- 123
  

(Note that there're two whitespaces in the last line.)

Steps to reproduce

astexplorer

Expected behaviour

Same as CommonMark playground:

{
  "type": "root",
  "children": [
    {
      "type": "list",
      "ordered": false,
      "start": null,
      "loose": false,
      "children": [
        {
          "type": "listItem",
          "loose": false,
          "checked": null,
          "children": [
            {
              "type": "paragraph",
              "children": [{ "type": "text", "value": "123" }]
            }
          ]
        }
      ]
    }
  ]
}

Actual behaviour

 {
   "type": "root",
   "children": [
     {
       "type": "list",
       "ordered": false,
       "start": null,
-      "loose": false,
+      "loose": true,
       "children": [
         {
           "type": "listItem",
-          "loose": false,
+          "loose": true,
           "checked": null,
           "children": [
             {
               "type": "paragraph",
               "children": [{ "type": "text", "value": "123" }]
             }
           ]
         }
       ]
     }
   ]
 }

Original post: prettier/prettier#5021

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions