Skip to content

Commit b0928cb

Browse files
author
MarkedJS bot
committed
build [skip ci]
1 parent 8d51037 commit b0928cb

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

lib/marked.esm.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,22 +388,34 @@ block.normal = merge$1({}, block);
388388
*/
389389

390390
block.gfm = merge$1({}, block.normal, {
391-
nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
391+
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
392+
+ ' *([-:]+ *\\|[-| :]*)' // Align
393+
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)', // Cells
392394
table: '^ *\\|(.+)\\n' // Header
393395
+ ' *\\|?( *[-:]+[-| :]*)' // Align
394-
+ '(?:\\n((?:(?!^|>|\\n| |hr|heading|lheading|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
396+
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
395397
});
396398

399+
block.gfm.nptable = edit$1(block.gfm.nptable)
400+
.replace('hr', block.hr)
401+
.replace('heading', ' {0,3}#{1,6} ')
402+
.replace('blockquote', ' {0,3}>')
403+
.replace('code', ' {4}[^\\n]')
404+
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
405+
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
406+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
407+
.replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
408+
.getRegex();
409+
397410
block.gfm.table = edit$1(block.gfm.table)
398411
.replace('hr', block.hr)
399412
.replace('heading', ' {0,3}#{1,6} ')
400-
.replace('lheading', '([^\\n]+)\\n {0,3}(=+|-+) *(?:\\n+|$)')
401413
.replace('blockquote', ' {0,3}>')
402414
.replace('code', ' {4}[^\\n]')
403415
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
404416
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
405417
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
406-
.replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
418+
.replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
407419
.getRegex();
408420

409421
/**

lib/marked.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,20 @@
401401
*/
402402

403403
block.gfm = merge$1({}, block.normal, {
404-
nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
404+
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
405+
+ ' *([-:]+ *\\|[-| :]*)' // Align
406+
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)',
407+
// Cells
405408
table: '^ *\\|(.+)\\n' // Header
406409
+ ' *\\|?( *[-:]+[-| :]*)' // Align
407-
+ '(?:\\n((?:(?!^|>|\\n| |hr|heading|lheading|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
410+
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
408411

409412
});
410-
block.gfm.table = edit$1(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('lheading', '([^\\n]+)\\n {0,3}(=+|-+) *(?:\\n+|$)').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
411-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
413+
block.gfm.nptable = edit$1(block.gfm.nptable).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
414+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
415+
.getRegex();
416+
block.gfm.table = edit$1(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
417+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
412418
.getRegex();
413419
/**
414420
* Pedantic grammar (original John Gruber's loose markdown specification)

0 commit comments

Comments
 (0)