Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix indented markdown in html #2052

Merged
merged 5 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

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

No REDOS issues in this change.

+ ')',
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>
krassowski marked this conversation as resolved.
Show resolved Hide resolved

<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>
krassowski marked this conversation as resolved.
Show resolved Hide resolved

## Heading
<custom-tag>

## Heading
</custom-tag>

## Heading
<details>

## Heading
</details>

## Heading
<custom-tag>

## Heading
</custom-tag>

## Heading