Skip to content

Commit

Permalink
🗜️ build [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkedJS bot committed Jan 26, 2021
1 parent 53c79ee commit 608ba7c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
14 changes: 9 additions & 5 deletions lib/marked.esm.js
Expand Up @@ -403,7 +403,7 @@ var Tokenizer_1 = class Tokenizer {
};
}

const text = cap[0].replace(/^ {4}/gm, '');
const text = cap[0].replace(/^ {1,4}/gm, '');
return {
type: 'code',
raw: cap[0],
Expand Down Expand Up @@ -1031,8 +1031,8 @@ const {
* Block-Level Grammar
*/
const block = {
newline: /^\n+/,
code: /^( {4}[^\n]+\n*)+/,
newline: /^(?: *(?:\n|$))+/,
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
Expand All @@ -1054,7 +1054,7 @@ const block = {
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
// regex template, placeholders will be replaced according to different paragraph
// interruption rules of commonmark and the original markdown spec:
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,
text: /^[^\n]+/
};

Expand Down Expand Up @@ -1486,7 +1486,9 @@ var Lexer_1 = class Lexer {
* Lexing
*/
blockTokens(src, tokens = [], top = true) {
src = src.replace(/^ +$/gm, '');
if (this.options.pedantic) {
src = src.replace(/^ +$/gm, '');
}
let token, i, l, lastToken;

while (src) {
Expand Down Expand Up @@ -1856,6 +1858,8 @@ var Renderer_1 = class Renderer {
}
}

code = code.replace(/\n$/, '') + '\n';

if (!lang) {
return '<pre><code>'
+ (escaped ? code : escape$2(code, true))
Expand Down
15 changes: 10 additions & 5 deletions lib/marked.js
Expand Up @@ -501,7 +501,7 @@
};
}

var text = cap[0].replace(/^ {4}/gm, '');
var text = cap[0].replace(/^ {1,4}/gm, '');
return {
type: 'code',
raw: cap[0],
Expand Down Expand Up @@ -1153,8 +1153,8 @@
*/

var block = {
newline: /^\n+/,
code: /^( {4}[^\n]+\n*)+/,
newline: /^(?: *(?:\n|$))+/,
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
Expand All @@ -1176,7 +1176,7 @@
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
// regex template, placeholders will be replaced according to different paragraph
// interruption rules of commonmark and the original markdown spec:
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,
text: /^[^\n]+/
};
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
Expand Down Expand Up @@ -1478,7 +1478,10 @@
top = true;
}

src = src.replace(/^ +$/gm, '');
if (this.options.pedantic) {
src = src.replace(/^ +$/gm, '');
}

var token, i, l, lastToken;

while (src) {
Expand Down Expand Up @@ -1899,6 +1902,8 @@
}
}

_code = _code.replace(/\n$/, '') + '\n';

if (!lang) {
return '<pre><code>' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n';
}
Expand Down

0 comments on commit 608ba7c

Please sign in to comment.