Skip to content

Commit 44f917c

Browse files
committed
Without tagName check
1 parent 61824fa commit 44f917c

4 files changed

Lines changed: 112 additions & 9 deletions

File tree

src/language-markdown/print/children.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { htmlBlockNames, htmlRawNames } from "micromark-util-html-tag-name";
21
import { hardline } from "../../document/index.js";
32
import {
43
INLINE_NODE_TYPES,
@@ -122,13 +121,7 @@ function shouldPrePrintDoubleHardline(path, options) {
122121
node.type === "html" &&
123122
previous.type === "paragraph"
124123
) {
125-
const tagName = node.value
126-
.match(/^\s*<\/?([a-z0-9-]+)/iu)?.[1]
127-
.toLowerCase();
128-
const isInlineTag =
129-
tagName && ![...htmlBlockNames, ...htmlRawNames].includes(tagName);
130124
isInlineHtmlInterruptingParagraph =
131-
isInlineTag &&
132125
previous.position.end.line + 1 === node.position.start.line;
133126
}
134127

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
@@ -2663,7 +2663,6 @@ _world_.
26632663
**Hello**,
26642664
26652665
_world_. </pre>
2666-
26672666
</td></tr></table>
26682667
26692668
================================================================================
@@ -3435,7 +3434,6 @@ bar
34353434
34363435
=====================================output=====================================
34373436
Foo
3438-
34393437
<div>
34403438
bar
34413439
</div>

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

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,22 @@ text
230230
![image](https://example.com)
231231
<img src="image.png" />
232232
233+
Foo
234+
<div>
235+
bar
236+
</div>
237+
238+
Foo
239+
240+
<div>
241+
bar
242+
</div>
243+
244+
Foo
245+
<div>
246+
bar
247+
</div>
248+
233249
=====================================output=====================================
234250
text
235251
<em>text</em>
@@ -244,6 +260,22 @@ text
244260
![image](https://example.com)
245261
<img src="image.png" />
246262
263+
Foo
264+
<div>
265+
bar
266+
</div>
267+
268+
Foo
269+
270+
<div>
271+
bar
272+
</div>
273+
274+
Foo
275+
<div>
276+
bar
277+
</div>
278+
247279
================================================================================
248280
`;
249281
@@ -267,6 +299,22 @@ text
267299
![image](https://example.com)
268300
<img src="image.png" />
269301
302+
Foo
303+
<div>
304+
bar
305+
</div>
306+
307+
Foo
308+
309+
<div>
310+
bar
311+
</div>
312+
313+
Foo
314+
<div>
315+
bar
316+
</div>
317+
270318
=====================================output=====================================
271319
text
272320
<em>text</em>
@@ -281,6 +329,22 @@ text
281329
![image](https://example.com)
282330
<img src="image.png" />
283331
332+
Foo
333+
<div>
334+
bar
335+
</div>
336+
337+
Foo
338+
339+
<div>
340+
bar
341+
</div>
342+
343+
Foo
344+
<div>
345+
bar
346+
</div>
347+
284348
================================================================================
285349
`;
286350
@@ -304,6 +368,22 @@ text
304368
![image](https://example.com)
305369
<img src="image.png" />
306370
371+
Foo
372+
<div>
373+
bar
374+
</div>
375+
376+
Foo
377+
378+
<div>
379+
bar
380+
</div>
381+
382+
Foo
383+
<div>
384+
bar
385+
</div>
386+
307387
=====================================output=====================================
308388
text
309389
<em>text</em>
@@ -318,6 +398,22 @@ text
318398
![image](https://example.com)
319399
<img src="image.png" />
320400
401+
Foo
402+
<div>
403+
bar
404+
</div>
405+
406+
Foo
407+
408+
<div>
409+
bar
410+
</div>
411+
412+
Foo
413+
<div>
414+
bar
415+
</div>
416+
321417
================================================================================
322418
`;
323419

tests/format/markdown/html/inline-html.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,19 @@ text
1010

1111
![image](https://example.com)
1212
<img src="image.png" />
13+
14+
Foo
15+
<div>
16+
bar
17+
</div>
18+
19+
Foo
20+
21+
<div>
22+
bar
23+
</div>
24+
25+
Foo
26+
<div>
27+
bar
28+
</div>

0 commit comments

Comments
 (0)