Repository: prettier/prettier (JavaScript)

Issue:
Whitespace is removed from between footnotes
**Prettier 2.0.5**
[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBtAegRgLpIAQCyAhmACbREA2pANHgBIB0BjdATAAyYDMjeAwtBgAnAJYAjAK4xR0AM54IAMzxzJUSqIDmACxh4iUUnlKi4+mBDwA3UTCIBbUVDwARVfZiS5fflTCiSnwAKqJyanB4AJKwrHgAnGwAFGwAlHQADhmMmABs3AC0mADsuYwAOlCVGGy4hETCMlBwRJJ0AIKMAEpxAFIQlJpKSnB0royddPQQEBlwwnQ9ADJxAOLCcAji81p0Kx2UEKJEdL2MAGJxAEI7DoZ0AApxrpLiUBDWBV1EAF50q3EAKJyDIQOR2CB0ADKa0MdxObjWzlIozwnU6BiMeFWM1IVEodEBjH4cU4JT4ADU7I5nG5VJIspQ4A4EJ5ZC5LHgMhtrKyDGBpJENiDRMIiJZhABPPAiEj6ZwjMAyeT4OSSuTwO4yMB4HlmADumOMLPsBUMVHVYUUKmRolspEkVC5DW1ogyhn0ePsfCuBF6dG4AFZcplGKJcoGABy8SrVdDcOpXBobGAwU5xJYkADWez4hmMBAgwjEcjoLDomHi8V4eGCOkiciZcAyBTg1ggWbgxhRYA2RDkkWUeHEEFI0s1czFXg2fChTYyFdyKXSXOy1YKVcYIBoIFmyqgcmQoGTEH1DwaCEPKCo+qI6u3IHEYrAnZgUPdASgWmQIkkoxAegOJQADqOh2HAIIkHAUKXnYdp2JKyDgOED7OAOjQPGKWh3MgShUAOO4AFZyAAHlcz6vlCjhwEszhwLh+H-sRJFQs4WhMgAipIEDwAxlAESA7rCOhSF3MIWbkPqUAPtyzgwMBoikDAOjIJGHA7tyYJwMBYoZEh3IQfMvIPgAjtx8CYbMV4gP2BTNF2XYPhsZminAmFENhRB8QJA5OD+wh-ju4Jfpx5n0UgeH8f+9jiApSkqUgbA7rKoiaF+ggODhKAQYGD7eHAwREOIV6RQJ1h-jEKKwFCvZujA7RGFCMCSky3lwAAvu1QA)
```sh
--parser markdown
```

**Input:**
```markdown
[^1]: Macdonald, H.M., 2013. Contributions of sunlight and diet to vitamin D status. Calcif. Tissue Int., 92(2), pp.163-176.

[^2]: Martineau, A.R., Jolliffe, D.A., Hooper, R.L., Greenberg, L., Aloia, J.F., Bergman, P., Dubnov-Raz, G., Esposito, S., Ganmaa, D., Ginde, A.A. and Goodall, E.C., 2017. Vitamin D supplementation to prevent acute respiratory tract infections: systematic review and meta-analysis of individual participant data. BMJ, 356, p.i6583.

[^3]: Barrett, J., Lack, L. and Morris, M., 1993. The sleep-evoked decrease of body temperature. Sleep, 16(2), pp.93-99.
```

**Output:**
```markdown
[^1]: Macdonald, H.M., 2013. Contributions of sunlight and diet to vitamin D status. Calcif. Tissue Int., 92(2), pp.163-176.
[^2]: Martineau, A.R., Jolliffe, D.A., Hooper, R.L., Greenberg, L., Aloia, J.F., Bergman, P., Dubnov-Raz, G., Esposito, S., Ganmaa, D., Ginde, A.A. and Goodall, E.C., 2017. Vitamin D supplementation to prevent acute respiratory tract infections: systematic review and meta-analysis of individual participant data. BMJ, 356, p.i6583.
[^3]: Barrett, J., Lack, L. and Morris, M., 1993. The sleep-evoked decrease of body temperature. Sleep, 16(2), pp.93-99.

```

**Expected behavior:**
Blocks should be respected.



Hints:
Indeed, seems to be a bug.

From https://pandoc.org/MANUAL.html#footnotes:

> Each footnote should be separated from surrounding content (including other footnotes) by blank lines.
@Undistraction Work is currently underway to update the Markdown parser that Prettier uses. See #8140. Could you probably help with testing that PR against your Markdown documents? I'm particularly interested in testing footnotes-related issues.
This behavior hasn't changed. I guess it may be intentional? Re: Pandoc, fortunately, I've found that it's tolerant of the absence of a blank line between footnotes.
I still experience this bug.

Patch:
diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js
--- a/src/language-markdown/printer-markdown.js
+++ b/src/language-markdown/printer-markdown.js
@@ -41,11 +41,7 @@ import {
  * @typedef {import("../document/builders.js").Doc} Doc
  */
 
-const SIBLING_NODE_TYPES = new Set([
-  "listItem",
-  "definition",
-  "footnoteDefinition",
-]);
+const SIBLING_NODE_TYPES = new Set(["listItem", "definition"]);
 
 function genericPrint(path, options, print) {
   const { node } = path;
@@ -405,7 +401,6 @@ function genericPrint(path, options, print) {
                     isFirst ? group([softline, print()]) : print(),
                 }),
               ),
-              path.next?.type === "footnoteDefinition" ? softline : "",
             ]),
       ];
     }


Test patch:
diff --git a/tests/format/markdown/footnoteDefinition/__snapshots__/format.test.js.snap b/tests/format/markdown/footnoteDefinition/__snapshots__/format.test.js.snap
--- a/tests/format/markdown/footnoteDefinition/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/footnoteDefinition/__snapshots__/format.test.js.snap
@@ -37,6 +37,7 @@ proseWrap: "never"
 
 =====================================output=====================================
 [^hello]: this is a long long long long long long long long long long long long long paragraph.
+
 [^world]: this is a long long long long long long long long long long long long long paragraph. this is a long long long long long long long long long long long long long paragraph.
 
 ================================================================================
@@ -55,6 +56,7 @@ proseWrap: "preserve"
 
 =====================================output=====================================
 [^hello]: this is a long long long long long long long long long long long long long paragraph.
+
 [^world]:
     this is a long long long long long long long long long long long long long paragraph.
     this is a long long long long long long long long long long long long long paragraph.
@@ -75,6 +77,7 @@ tabWidth: 3
 
 =====================================output=====================================
 [^hello]: this is a long long long long long long long long long long long long long paragraph.
+
 [^world]:
     this is a long long long long long long long long long long long long long paragraph.
     this is a long long long long long long long long long long long long long paragraph.
@@ -352,31 +355,45 @@ proseWrap: "always"
 
 =====================================output=====================================
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ---
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ================================================================================
@@ -415,31 +432,45 @@ proseWrap: "never"
 
 =====================================output=====================================
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ---
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ================================================================================
@@ -478,31 +509,45 @@ proseWrap: "preserve"
 
 =====================================output=====================================
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ---
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ================================================================================
@@ -541,31 +586,45 @@ tabWidth: 3
 
 =====================================output=====================================
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: > 123
+
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ---
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]:
     > 123\\
     > 456
 
 [^a]: a
+
 [^a]: a
+
 [^a]: a
 
 ================================================================================