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