Skip to content

Commit d1c5fe8

Browse files
committed
Revive a workaround with appropriate name
1 parent 237cbc7 commit d1c5fe8

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/language-markdown/print/children.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ function shouldPrePrintDoubleHardline(path, options) {
110110
node.type === "html" &&
111111
previous.type === "html" &&
112112
previous.position.end.line + 1 === node.position.start.line;
113+
const isBlockHtmlWithoutBlankLineBetweenPrevParagraph =
114+
options.parser !== "mdx" &&
115+
node.type === "html" &&
116+
previous.type === "paragraph" &&
117+
previous.position.end.line + 1 === node.position.start.line;
113118
const isHtmlDirectAfterListItem =
114119
node.type === "html" &&
115120
parent.type === "listItem" &&
@@ -121,6 +126,7 @@ function shouldPrePrintDoubleHardline(path, options) {
121126
isInTightListItem ||
122127
isPrevNodePrettierIgnore ||
123128
isBlockHtmlWithoutBlankLineBetweenPrevHtml ||
129+
isBlockHtmlWithoutBlankLineBetweenPrevParagraph ||
124130
isHtmlDirectAfterListItem
125131
);
126132
}

tests/format/markdown/commonmark-test-suite/__snapshots__/format.test.js.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,6 @@ _world_.
26642664
**Hello**,
26652665
26662666
_world_. </pre>
2667-
26682667
</td></tr></table>
26692668
26702669
================================================================================
@@ -3436,7 +3435,6 @@ bar
34363435
34373436
=====================================output=====================================
34383437
Foo
3439-
34403438
<div>
34413439
bar
34423440
</div>

tests/format/markdown/html/__snapshots__/format.test.js.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ text <em>text</em>
256256
![image](https://example.com) <img src="image.png" />
257257
258258
Foo
259-
260259
<div>
261260
bar
262261
</div>
@@ -268,7 +267,6 @@ bar
268267
</div>
269268
270269
Foo
271-
272270
<div>
273271
bar
274272
</div>
@@ -322,7 +320,6 @@ text <em>text</em>
322320
![image](https://example.com) <img src="image.png" />
323321
324322
Foo
325-
326323
<div>
327324
bar
328325
</div>
@@ -334,7 +331,6 @@ bar
334331
</div>
335332
336333
Foo
337-
338334
<div>
339335
bar
340336
</div>
@@ -393,7 +389,6 @@ text
393389
<img src="image.png" />
394390
395391
Foo
396-
397392
<div>
398393
bar
399394
</div>
@@ -405,7 +400,6 @@ bar
405400
</div>
406401
407402
Foo
408-
409403
<div>
410404
bar
411405
</div>

0 commit comments

Comments
 (0)