Skip to content

Commit 4956bd3

Browse files
authored
Merge branch 'master' into render-inline-html
2 parents 11656f8 + a20e2f7 commit 4956bd3

File tree

11 files changed

+58
-20
lines changed

11 files changed

+58
-20
lines changed

.nowignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!docs
3+
!docs/**

bin/marked

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ function help() {
2323
stdio: 'inherit'
2424
};
2525

26-
spawn('man', [path.resolve(__dirname, '/../man/marked.1')], options)
26+
spawn('man', [path.resolve(__dirname, '../man/marked.1')], options)
2727
.on('error', function() {
28-
fs.readFile(path.resolve(__dirname, '/../man/marked.1.txt'), 'utf8', function(err, data) {
28+
fs.readFile(path.resolve(__dirname, '../man/marked.1.txt'), 'utf8', function(err, data) {
2929
if (err) throw err;
3030
console.log(data);
3131
});

lib/marked.esm.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* marked - a markdown parser
3-
* Copyright (c) 2011-2019, Christopher Jeffrey. (MIT Licensed)
3+
* Copyright (c) 2011-2020, Christopher Jeffrey. (MIT Licensed)
44
* https://github.com/markedjs/marked
55
*/
66

@@ -305,7 +305,7 @@ const {
305305
const block = {
306306
newline: /^\n+/,
307307
code: /^( {4}[^\n]+\n*)+/,
308-
fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
308+
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
309309
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
310310
heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
311311
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
@@ -367,7 +367,7 @@ block.paragraph = edit$1(block._paragraph)
367367
.replace('heading', ' {0,3}#{1,6} +')
368368
.replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
369369
.replace('blockquote', ' {0,3}>')
370-
.replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n')
370+
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
371371
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
372372
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
373373
.replace('tag', block._tag) // pars can be interrupted by type (6) html blocks

lib/marked.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* marked - a markdown parser
3-
* Copyright (c) 2011-2019, Christopher Jeffrey. (MIT Licensed)
3+
* Copyright (c) 2011-2020, Christopher Jeffrey. (MIT Licensed)
44
* https://github.com/markedjs/marked
55
*/
66

@@ -352,7 +352,7 @@
352352
var block = {
353353
newline: /^\n+/,
354354
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+|$)|$)/,
356356
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
357357
heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
358358
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
@@ -387,7 +387,7 @@
387387
block._comment = /<!--(?!-?>)[\s\S]*?-->/;
388388
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();
389389
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
391391
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
392392
.getRegex();
393393
block.blockquote = edit$1(block.blockquote).replace('paragraph', block.paragraph).getRegex();

marked.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

now.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
22
"name": "markedjs",
3-
"scope": "markedjs",
4-
"alias": "markedjs.now.sh",
5-
"version": 2,
6-
"regions": ["all"],
73
"builds": [
84
{ "src": "docs/**", "use": "@now/static" }
95
],

src/rules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const {
1010
const block = {
1111
newline: /^\n+/,
1212
code: /^( {4}[^\n]+\n*)+/,
13-
fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
13+
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
1414
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
1515
heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
1616
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
@@ -72,7 +72,7 @@ block.paragraph = edit(block._paragraph)
7272
.replace('heading', ' {0,3}#{1,6} +')
7373
.replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
7474
.replace('blockquote', ' {0,3}>')
75-
.replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n')
75+
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
7676
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
7777
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
7878
.replace('tag', block._tag) // pars can be interrupted by type (6) html blocks

test/specs/commonmark/commonmark.0.29.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,7 @@
930930
"example": 116,
931931
"start_line": 1996,
932932
"end_line": 2003,
933-
"section": "Fenced code blocks",
934-
"shouldFail": true
933+
"section": "Fenced code blocks"
935934
},
936935
{
937936
"markdown": "```\n``` aaa\n```\n",

test/specs/gfm/commonmark.0.29.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,7 @@
930930
"example": 116,
931931
"start_line": 1996,
932932
"end_line": 2003,
933-
"section": "Fenced code blocks",
934-
"shouldFail": true
933+
"section": "Fenced code blocks"
935934
},
936935
{
937936
"markdown": "```\n``` aaa\n```\n",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<p>A paragraph</p>
2+
<pre><code class="language-A">Here is code in
3+
backtick fences</code></pre>
4+
<p>B paragraph</p>
5+
<pre><code class="language-B">Here is code in
6+
tilde fences</code></pre>
7+
<p>C paragraph</p>
8+
<pre><code class="language-`C~">Alternative
9+
tilde fences</code></pre>
10+
<p>D paragraph ```~D` Invalid use of backtick fences</p>
11+
<pre><code>
12+
This will be read as
13+
part of a codeblock
14+
that ends with the file</code></pre>

0 commit comments

Comments
 (0)