mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: do not allow a blank line inside a link reference definition label (#4165)
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
1d4d8fe6f5
commit
f3d21af070
+1
-1
@@ -148,7 +148,7 @@ const lheadingGfm = edit(lheadingCore)
|
||||
.getRegex();
|
||||
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
|
||||
const blockText = /^[^\n]+/;
|
||||
const _blockLabel = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
||||
const _blockLabel = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/;
|
||||
const def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/)
|
||||
.replace('label', _blockLabel)
|
||||
// An escaped delimiter is part of the title, so a backslash must consume the
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<p>[foo</p>
|
||||
|
||||
<p>bar]: /url</p>
|
||||
|
||||
<p>[foo</p>
|
||||
|
||||
<p>bar]</p>
|
||||
|
||||
<p><a href="/url">baz
|
||||
qux</a></p>
|
||||
@@ -0,0 +1,13 @@
|
||||
[foo
|
||||
|
||||
bar]: /url
|
||||
|
||||
[foo
|
||||
|
||||
bar]
|
||||
|
||||
[baz
|
||||
qux]: /url
|
||||
|
||||
[baz
|
||||
qux]
|
||||
Reference in New Issue
Block a user