marked 9.0.0 → 9.0.2
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 +10 -6
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.esm.js +10 -6
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +10 -6
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +6 -1
- package/package.json +6 -6
package/lib/marked.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v9.0.
|
|
2
|
+
* marked v9.0.2 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -533,13 +533,17 @@ class _Tokenizer {
|
|
|
533
533
|
table(src) {
|
|
534
534
|
const cap = this.rules.block.table.exec(src);
|
|
535
535
|
if (cap) {
|
|
536
|
+
if (!/[:|]/.test(cap[2])) {
|
|
537
|
+
// delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
536
540
|
const item = {
|
|
537
541
|
type: 'table',
|
|
538
542
|
raw: cap[0],
|
|
539
543
|
header: splitCells(cap[1]).map(c => {
|
|
540
544
|
return { text: c, tokens: [] };
|
|
541
545
|
}),
|
|
542
|
-
align: cap[2].replace(
|
|
546
|
+
align: cap[2].replace(/^\||\| *$/g, '').split('|'),
|
|
543
547
|
rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
|
|
544
548
|
};
|
|
545
549
|
if (item.header.length === item.align.length) {
|
|
@@ -745,7 +749,7 @@ class _Tokenizer {
|
|
|
745
749
|
const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
|
746
750
|
endReg.lastIndex = 0;
|
|
747
751
|
// Clip maskedSrc to same section of string as src (move to lexer?)
|
|
748
|
-
maskedSrc = maskedSrc.slice(-1 * src.length +
|
|
752
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + match[0].length - 1);
|
|
749
753
|
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
750
754
|
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
751
755
|
if (!rDelim)
|
|
@@ -934,7 +938,7 @@ const block = {
|
|
|
934
938
|
+ ')',
|
|
935
939
|
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
|
936
940
|
table: noopTest,
|
|
937
|
-
lheading: /^(
|
|
941
|
+
lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
938
942
|
// regex template, placeholders will be replaced according to different paragraph
|
|
939
943
|
// interruption rules of commonmark and the original markdown spec:
|
|
940
944
|
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
@@ -993,8 +997,8 @@ block.normal = { ...block };
|
|
|
993
997
|
*/
|
|
994
998
|
block.gfm = {
|
|
995
999
|
...block.normal,
|
|
996
|
-
table: '^ *([^\\n ]
|
|
997
|
-
+ ' {0,3}(?:\\| *)
|
|
1000
|
+
table: '^ *([^\\n ].*)\\n' // Header
|
|
1001
|
+
+ ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
|
|
998
1002
|
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
999
1003
|
};
|
|
1000
1004
|
block.gfm.table = edit(block.gfm.table)
|