@@ -1199,15 +1199,15 @@ var block = {
1199
1199
+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
1200
1200
+ '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
1201
1201
+ ')' ,
1202
- def : / ^ { 0 , 3 } \[ ( l a b e l ) \] : * \n ? * < ? ( [ ^ \s > ] + ) > ? (?: (?: + \n ? * | * \n * ) ( t i t l e ) ) ? * (?: \n + | $ ) / ,
1202
+ def : / ^ { 0 , 3 } \[ ( l a b e l ) \] : * (?: \n * ) ? < ? ( [ ^ \s > ] + ) > ? (?: (?: + (?: \n * ) ? | * \n * ) ( t i t l e ) ) ? * (?: \n + | $ ) / ,
1203
1203
table : noopTest ,
1204
1204
lheading : / ^ ( [ ^ \n ] + ) \n { 0 , 3 } ( = + | - + ) * (?: \n + | $ ) / ,
1205
1205
// regex template, placeholders will be replaced according to different paragraph
1206
1206
// interruption rules of commonmark and the original markdown spec:
1207
1207
_paragraph : / ^ ( [ ^ \n ] + (?: \n (? ! h r | h e a d i n g | l h e a d i n g | b l o c k q u o t e | f e n c e s | l i s t | h t m l | t a b l e | + \n ) [ ^ \n ] + ) * ) / ,
1208
1208
text : / ^ [ ^ \n ] + /
1209
1209
} ;
1210
- block . _label = / (? ! \s * \] ) (?: \\ [ \[ \] ] | [ ^ \[ \] ] ) + / ;
1210
+ block . _label = / (? ! \s * \] ) (?: \\ . | [ ^ \[ \] \\ ] ) + / ;
1211
1211
block . _title = / (?: " (?: \\ " ? | [ ^ " \\ ] ) * " | ' [ ^ ' \n ] * (?: \n [ ^ ' \n ] + ) * \n ? ' | \( [ ^ ( ) ] * \) ) / ;
1212
1212
block . def = edit ( block . def ) . replace ( 'label' , block . _label ) . replace ( 'title' , block . _title ) . getRegex ( ) ;
1213
1213
block . bullet = / (?: [ * + - ] | \d { 1 , 9 } [ . ) ] ) / ;
@@ -1272,8 +1272,8 @@ var inline = {
1272
1272
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>' ,
1273
1273
// CDATA section
1274
1274
link : / ^ ! ? \[ ( l a b e l ) \] \( \s * ( h r e f ) (?: \s + ( t i t l e ) ) ? \s * \) / ,
1275
- reflink : / ^ ! ? \[ ( l a b e l ) \] \[ (? ! \s * \] ) ( (?: \\ [ \[ \] ] ? | [ ^ \[ \] \\ ] ) + ) \] / ,
1276
- nolink : / ^ ! ? \[ (? ! \s * \] ) ( (?: \[ [ ^ \[ \] ] * \] | \\ [ \[ \] ] | [ ^ \[ \] ] ) * ) \] (?: \[ \] ) ? / ,
1275
+ reflink : / ^ ! ? \[ ( l a b e l ) \] \[ ( r e f ) \] / ,
1276
+ nolink : / ^ ! ? \[ ( r e f ) \] (?: \[ \] ) ? / ,
1277
1277
reflinkSearch : 'reflink|nolink(?!\\()' ,
1278
1278
emStrong : {
1279
1279
lDelim : / ^ (?: \* + (?: ( [ p u n c t _ ] ) | [ ^ \s * ] ) ) | ^ _ + (?: ( [ p u n c t * ] ) | ( [ ^ \s _ ] ) ) / ,
@@ -1310,7 +1310,8 @@ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
1310
1310
inline . _href = / < (?: \\ .| [ ^ \n < > \\ ] ) + > | [ ^ \s \x00 - \x1f ] * / ;
1311
1311
inline . _title = / " (?: \\ " ? | [ ^ " \\ ] ) * " | ' (?: \\ ' ? | [ ^ ' \\ ] ) * ' | \( (?: \\ \) ? | [ ^ ) \\ ] ) * \) / ;
1312
1312
inline . link = edit ( inline . link ) . replace ( 'label' , inline . _label ) . replace ( 'href' , inline . _href ) . replace ( 'title' , inline . _title ) . getRegex ( ) ;
1313
- inline . reflink = edit ( inline . reflink ) . replace ( 'label' , inline . _label ) . getRegex ( ) ;
1313
+ inline . reflink = edit ( inline . reflink ) . replace ( 'label' , inline . _label ) . replace ( 'ref' , block . _label ) . getRegex ( ) ;
1314
+ inline . nolink = edit ( inline . nolink ) . replace ( 'ref' , block . _label ) . getRegex ( ) ;
1314
1315
inline . reflinkSearch = edit ( inline . reflinkSearch , 'g' ) . replace ( 'reflink' , inline . reflink ) . replace ( 'nolink' , inline . nolink ) . getRegex ( ) ;
1315
1316
/**
1316
1317
* Normal Inline Grammar
0 commit comments