marked 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/marked.cjs +5 -4
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.esm.js +5 -4
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +5 -4
- package/lib/marked.umd.js.map +1 -1
- package/marked.min.js +2 -2
- package/package.json +4 -3
package/lib/marked.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v7.0.
|
|
2
|
+
* marked v7.0.3 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -838,7 +838,8 @@ class _Tokenizer {
|
|
|
838
838
|
return;
|
|
839
839
|
const nextChar = match[1] || match[2] || '';
|
|
840
840
|
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
|
841
|
-
|
|
841
|
+
// unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
|
|
842
|
+
const lLength = [...match[0]].length - 1;
|
|
842
843
|
let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
|
843
844
|
const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
|
844
845
|
endReg.lastIndex = 0;
|
|
@@ -848,7 +849,7 @@ class _Tokenizer {
|
|
|
848
849
|
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
849
850
|
if (!rDelim)
|
|
850
851
|
continue; // skip single * in __abc*abc__
|
|
851
|
-
rLength = rDelim.length;
|
|
852
|
+
rLength = [...rDelim].length;
|
|
852
853
|
if (match[3] || match[4]) { // found another Left Delim
|
|
853
854
|
delimTotal += rLength;
|
|
854
855
|
continue;
|
|
@@ -864,7 +865,7 @@ class _Tokenizer {
|
|
|
864
865
|
continue; // Haven't found enough closing delimiters
|
|
865
866
|
// Remove extra characters. *a*** -> *a*
|
|
866
867
|
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
867
|
-
const raw = src.slice(0, lLength + match.index + rLength + 1);
|
|
868
|
+
const raw = [...src].slice(0, lLength + match.index + rLength + 1).join('');
|
|
868
869
|
// Create `em` if smallest delimiter has odd char count. *a***
|
|
869
870
|
if (Math.min(lLength, rLength) % 2) {
|
|
870
871
|
const text = raw.slice(1, -1);
|