|
1 | 1 | /** |
2 | 2 | * marked - a markdown parser |
3 | | - * Copyright (c) 2011-2019, Christopher Jeffrey. (MIT Licensed) |
| 3 | + * Copyright (c) 2011-2020, Christopher Jeffrey. (MIT Licensed) |
4 | 4 | * https://github.com/markedjs/marked |
5 | 5 | */ |
6 | 6 |
|
|
352 | 352 | var block = { |
353 | 353 | newline: /^\n+/, |
354 | 354 | code: /^( {4}[^\n]+\n*)+/, |
355 | | - fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/, |
| 355 | + fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/, |
356 | 356 | hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, |
357 | 357 | heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/, |
358 | 358 | blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, |
|
387 | 387 | block._comment = /<!--(?!-?>)[\s\S]*?-->/; |
388 | 388 | block.html = edit$1(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); |
389 | 389 | block.paragraph = edit$1(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} +').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs |
390 | | - .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt |
| 390 | + .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt |
391 | 391 | .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks |
392 | 392 | .getRegex(); |
393 | 393 | block.blockquote = edit$1(block.blockquote).replace('paragraph', block.paragraph).getRegex(); |
|
0 commit comments