marked 9.0.0 → 9.0.1
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 +9 -5
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.esm.js +9 -5
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +9 -5
- 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.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v9.0.
|
|
2
|
+
* marked v9.0.1 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -535,13 +535,17 @@ class _Tokenizer {
|
|
|
535
535
|
table(src) {
|
|
536
536
|
const cap = this.rules.block.table.exec(src);
|
|
537
537
|
if (cap) {
|
|
538
|
+
if (!/[:|]/.test(cap[2])) {
|
|
539
|
+
// delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
538
542
|
const item = {
|
|
539
543
|
type: 'table',
|
|
540
544
|
raw: cap[0],
|
|
541
545
|
header: splitCells(cap[1]).map(c => {
|
|
542
546
|
return { text: c, tokens: [] };
|
|
543
547
|
}),
|
|
544
|
-
align: cap[2].replace(
|
|
548
|
+
align: cap[2].replace(/^\||\| *$/g, '').split('|'),
|
|
545
549
|
rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
|
|
546
550
|
};
|
|
547
551
|
if (item.header.length === item.align.length) {
|
|
@@ -936,7 +940,7 @@ const block = {
|
|
|
936
940
|
+ ')',
|
|
937
941
|
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
|
938
942
|
table: noopTest,
|
|
939
|
-
lheading: /^(
|
|
943
|
+
lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
940
944
|
// regex template, placeholders will be replaced according to different paragraph
|
|
941
945
|
// interruption rules of commonmark and the original markdown spec:
|
|
942
946
|
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
@@ -995,8 +999,8 @@ block.normal = { ...block };
|
|
|
995
999
|
*/
|
|
996
1000
|
block.gfm = {
|
|
997
1001
|
...block.normal,
|
|
998
|
-
table: '^ *([^\\n ]
|
|
999
|
-
+ ' {0,3}(?:\\| *)
|
|
1002
|
+
table: '^ *([^\\n ].*)\\n' // Header
|
|
1003
|
+
+ ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
|
|
1000
1004
|
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
1001
1005
|
};
|
|
1002
1006
|
block.gfm.table = edit(block.gfm.table)
|