fix: allow trailing tabs after closing code fences (#4241)

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* fix: allow trailing tabs after closing code fences

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: remove duplicate CommonMark fence output

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

* test: remove duplicate CommonMark fence input

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>

---------

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
This commit is contained in:
generaltony007
2026-11-19 00:06:06 -07:00
committed by GitHub
co-authored by GeneralTony007
parent 04f1c6e518
commit 1e1190241b
3 changed files with 100 additions and 1 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ export const other = {
const newline = /^(?:[ \t]*(?:\n|$))+/;
const blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/;
const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*)[ \t]*(?=\n|$)|$)/;
const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
const bullet = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
@@ -0,0 +1,39 @@
<pre><code>a
</code></pre>
<p>b</p>
<pre><code>a
</code></pre>
<p>b</p>
<pre><code class="language-js">a
</code></pre>
<p>b</p>
<pre><code></code></pre>
<p>b</p>
<pre><code>a
</code></pre>
<pre><code>a
</code></pre>
<p>b</p>
<blockquote>
<pre><code>a
</code></pre>
<p>b</p>
</blockquote>
<ul>
<li><pre><code>a
</code></pre>
<p>b</p>
</li>
</ul>
<pre><code>a
``` x
b
</code></pre>
<pre><code>a
~~~
b
</code></pre>
<pre><code>a
~~~
b
</code></pre>
@@ -0,0 +1,60 @@
---
renderExact: true
gfm: true
---
```
a
```
b
~~~
a
~~~
b
````js
a
`````
b
```
```
b
```
a
```
~~~
a
~~~
b
> ```
> a
> ```
> b
- ```
a
```
b
```
a
``` x
b
```
```
a
~~~
b
```
~~~~
a
~~~
b
~~~~