mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: only close a code fence with the opening fence character (#4164)
Co-authored-by: aman <aman@pronnel.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
aman
Claude Opus 5.5
parent
64a299def9
commit
1d4d8fe6f5
+1
-1
@@ -118,7 +118,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[~`]* *(?=\n|$)|$)/;
|
||||
const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\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,14 @@
|
||||
<pre><code>code
|
||||
```~~~
|
||||
still code
|
||||
</code></pre>
|
||||
|
||||
<pre><code>code
|
||||
~~~```
|
||||
still code
|
||||
</code></pre>
|
||||
|
||||
<pre><code>code
|
||||
</code></pre>
|
||||
|
||||
<p>after</p>
|
||||
@@ -0,0 +1,17 @@
|
||||
```
|
||||
code
|
||||
```~~~
|
||||
still code
|
||||
```
|
||||
|
||||
~~~
|
||||
code
|
||||
~~~```
|
||||
still code
|
||||
~~~
|
||||
|
||||
```
|
||||
code
|
||||
`````
|
||||
|
||||
after
|
||||
Reference in New Issue
Block a user