Skip to content

Commit

Permalink
fix: Fix indented markdown in html (#2052)
Browse files Browse the repository at this point in the history
Co-authored-by: Tony Brix <[email protected]>
  • Loading branch information
krassowski and UziTech authored May 20, 2021
1 parent f79f678 commit 6435ac9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const block = {
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
+ ')',
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
nptable: noopTest,
Expand Down
24 changes: 24 additions & 0 deletions test/specs/new/indented_details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<details>

<h2 id="heading">Heading</h2>
</details>

<h2 id="heading-1">Heading</h2>
<custom-tag>

<h2 id="heading-2">Heading</h2>
</custom-tag>

<h2 id="heading-3">Heading</h2>
<details>

<pre><code>## Heading</code></pre>
</details>

<pre><code>## Heading</code></pre>
<custom-tag>

<pre><code>## Heading</code></pre>
</custom-tag>

<pre><code>## Heading</code></pre>
24 changes: 24 additions & 0 deletions test/specs/new/indented_details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<details>

## Heading
</details>

## Heading
<custom-tag>

## Heading
</custom-tag>

## Heading
<details>

## Heading
</details>

## Heading
<custom-tag>

## Heading
</custom-tag>

## Heading

1 comment on commit 6435ac9

@vercel
Copy link

@vercel vercel bot commented on 6435ac9 May 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.