@@ -93,22 +93,34 @@ block.normal = merge({}, block);
9393 */
9494
9595block . gfm = merge ( { } , block . normal , {
96- nptable : / ^ * ( [ ^ | \n ] .* \| .* ) \n * ( [ - : ] + * \| [ - | : ] * ) (?: \n ( (?: .* [ ^ > \n ] .* (?: \n | $ ) ) * ) \n * | $ ) / ,
96+ nptable : '^ *([^|\\n ].*\\|.*)\\n' // Header
97+ + ' *([-:]+ *\\|[-| :]*)' // Align
98+ + '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' , // Cells
9799 table : '^ *\\|(.+)\\n' // Header
98100 + ' *\\|?( *[-:]+[-| :]*)' // Align
99- + '(?:\\n((?:(?!^|>| \\n| | hr|heading|lheading |code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
101+ + '(?:\\n * ((?:(?!\\n|hr|heading|blockquote |code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
100102} ) ;
101103
104+ block . gfm . nptable = edit ( block . gfm . nptable )
105+ . replace ( 'hr' , block . hr )
106+ . replace ( 'heading' , ' {0,3}#{1,6} ' )
107+ . replace ( 'blockquote' , ' {0,3}>' )
108+ . replace ( 'code' , ' {4}[^\\n]' )
109+ . replace ( 'fences' , ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n' )
110+ . replace ( 'list' , ' {0,3}(?:[*+-]|1[.)]) ' ) // only lists starting from 1 can interrupt
111+ . replace ( 'html' , '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)' )
112+ . replace ( 'tag' , block . _tag ) // tables can be interrupted by type (6) html blocks
113+ . getRegex ( ) ;
114+
102115block . gfm . table = edit ( block . gfm . table )
103116 . replace ( 'hr' , block . hr )
104117 . replace ( 'heading' , ' {0,3}#{1,6} ' )
105- . replace ( 'lheading' , '([^\\n]+)\\n {0,3}(=+|-+) *(?:\\n+|$)' )
106118 . replace ( 'blockquote' , ' {0,3}>' )
107119 . replace ( 'code' , ' {4}[^\\n]' )
108120 . replace ( 'fences' , ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n' )
109121 . replace ( 'list' , ' {0,3}(?:[*+-]|1[.)]) ' ) // only lists starting from 1 can interrupt
110122 . replace ( 'html' , '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)' )
111- . replace ( 'tag' , block . _tag ) // pars can be interrupted by type (6) html blocks
123+ . replace ( 'tag' , block . _tag ) // tables can be interrupted by type (6) html blocks
112124 . getRegex ( ) ;
113125
114126/**
0 commit comments