marked 15.0.2 → 15.0.4
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 +27 -17
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.esm.js +27 -17
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +27 -17
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +2 -2
- package/package.json +6 -6
package/lib/marked.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v15.0.
|
|
2
|
+
* marked v15.0.4 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -253,35 +253,41 @@ const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
|
253
253
|
const br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
254
254
|
const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
255
255
|
// list of unicode punctuation marks, plus any missing characters from CommonMark spec
|
|
256
|
-
const _punctuation =
|
|
257
|
-
const
|
|
258
|
-
|
|
256
|
+
const _punctuation = /[\p{P}\p{S}]/u;
|
|
257
|
+
const _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
|
|
258
|
+
const _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
|
|
259
|
+
const punctuation = edit(/^((?![*_])punctSpace)/, 'u')
|
|
260
|
+
.replace(/punctSpace/g, _punctuationOrSpace).getRegex();
|
|
259
261
|
// sequences em should skip over [title](link), `code`, <html>
|
|
260
262
|
const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
261
|
-
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)
|
|
263
|
+
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
|
|
262
264
|
.replace(/punct/g, _punctuation)
|
|
263
265
|
.getRegex();
|
|
264
266
|
const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
|
|
265
267
|
+ '|[^*]+(?=[^*])' // Consume to delim
|
|
266
|
-
+ '|(?!\\*)
|
|
267
|
-
+ '|
|
|
268
|
-
+ '|(?!\\*)
|
|
269
|
-
+ '|[\\s](\\*+)(?!\\*)(?=
|
|
270
|
-
+ '|(?!\\*)
|
|
271
|
-
+ '|
|
|
268
|
+
+ '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
|
|
269
|
+
+ '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
|
|
270
|
+
+ '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
|
|
271
|
+
+ '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
|
|
272
|
+
+ '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
|
|
273
|
+
+ '|notPunctSpace(\\*+)(?=notPunctSpace)', 'gu') // (6) a***a can be either Left or Right Delimiter
|
|
274
|
+
.replace(/notPunctSpace/g, _notPunctuationOrSpace)
|
|
275
|
+
.replace(/punctSpace/g, _punctuationOrSpace)
|
|
272
276
|
.replace(/punct/g, _punctuation)
|
|
273
277
|
.getRegex();
|
|
274
278
|
// (6) Not allowed for _
|
|
275
279
|
const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
|
|
276
280
|
+ '|[^_]+(?=[^_])' // Consume to delim
|
|
277
|
-
+ '|(?!_)
|
|
278
|
-
+ '|
|
|
279
|
-
+ '|(?!_)
|
|
280
|
-
+ '|[\\s](_+)(?!_)(?=
|
|
281
|
-
+ '|(?!_)
|
|
281
|
+
+ '|(?!_)punct(_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter
|
|
282
|
+
+ '|notPunctSpace(_+)(?!_)(?=punctSpace|$)' // (2) a___#, a___ can only be a Right Delimiter
|
|
283
|
+
+ '|(?!_)punctSpace(_+)(?=notPunctSpace)' // (3) #___a, ___a can only be Left Delimiter
|
|
284
|
+
+ '|[\\s](_+)(?!_)(?=punct)' // (4) ___# can only be Left Delimiter
|
|
285
|
+
+ '|(?!_)punct(_+)(?!_)(?=punct)', 'gu') // (5) #___# can be either Left or Right Delimiter
|
|
286
|
+
.replace(/notPunctSpace/g, _notPunctuationOrSpace)
|
|
287
|
+
.replace(/punctSpace/g, _punctuationOrSpace)
|
|
282
288
|
.replace(/punct/g, _punctuation)
|
|
283
289
|
.getRegex();
|
|
284
|
-
const anyPunctuation = edit(/\\(
|
|
290
|
+
const anyPunctuation = edit(/\\(punct)/, 'gu')
|
|
285
291
|
.replace(/punct/g, _punctuation)
|
|
286
292
|
.getRegex();
|
|
287
293
|
const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/)
|
|
@@ -879,6 +885,10 @@ class _Tokenizer {
|
|
|
879
885
|
lastItem.raw = lastItem.raw.trimEnd();
|
|
880
886
|
lastItem.text = lastItem.text.trimEnd();
|
|
881
887
|
}
|
|
888
|
+
else {
|
|
889
|
+
// not a list since there were no items
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
882
892
|
list.raw = list.raw.trimEnd();
|
|
883
893
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
884
894
|
for (let i = 0; i < list.items.length; i++) {
|