mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: let emphasis open after the other delimiter character (#4169)
This commit is contained in:
+4
-2
@@ -915,12 +915,14 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
|
||||
runStart--;
|
||||
}
|
||||
const runPrevChar = [...maskedSrc.slice(Math.max(0, runStart - 2), runStart)].at(-1) ?? '';
|
||||
// The other delimiter character counts as punctuation here (`_**a*`)
|
||||
// The other delimiter character counts as punctuation here (`_**a*`, `*_#_`)
|
||||
const runPrevPunct = runPrevChar === '*' || runPrevChar === '_' || !!this.rules.inline.punctuation.exec(runPrevChar);
|
||||
if (runStart < srcStart) {
|
||||
prevChar = runPrevChar;
|
||||
}
|
||||
const prevPunct = runStart < srcStart ? runPrevPunct : !!this.rules.inline.punctuation.exec(prevChar);
|
||||
const prevPunct = runStart < srcStart
|
||||
? runPrevPunct
|
||||
: prevChar === '*' || prevChar === '_' || !!this.rules.inline.punctuation.exec(prevChar);
|
||||
|
||||
// _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
|
||||
if (match[4] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<p>*<em>#a</em></p>
|
||||
<p>**<em>(a)</em></p>
|
||||
<p>see *<em>[link]</em></p>
|
||||
<p>*<strong>#</strong></p>
|
||||
<p>_<em>#</em></p>
|
||||
@@ -0,0 +1,9 @@
|
||||
*_#a_
|
||||
|
||||
**_(a)_
|
||||
|
||||
see *_[link]_
|
||||
|
||||
*__#__
|
||||
|
||||
_*#*
|
||||
Reference in New Issue
Block a user