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 Apr 11, 2022
1 parent 7d19665 commit 268dff2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
16 changes: 10 additions & 6 deletions lib/marked.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ var Tokenizer = /*#__PURE__*/function () {
var cap = this.rules.block.blockquote.exec(src);

if (cap) {
var text = cap[0].replace(/^ *> ?/gm, '');
var text = cap[0].replace(/^ *>[ \t]?/gm, '');
return {
type: 'blockquote',
raw: cap[0],
Expand Down Expand Up @@ -579,7 +579,7 @@ var Tokenizer = /*#__PURE__*/function () {
} // Get next list item


var itemRegex = new RegExp("^( {0,3}" + bull + ")((?: [^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item
var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item

while (src) {
endEarly = false;
Expand Down Expand Up @@ -1216,10 +1216,10 @@ var block = {
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+|$)/,
hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
list: /^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,
list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
html: '^ {0,3}(?:' // optional indentation
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
+ '|comment[^\\n]*(\\n+|$)' // (2)
Expand Down Expand Up @@ -1499,7 +1499,7 @@ var Lexer = /*#__PURE__*/function () {
var _proto = Lexer.prototype;

_proto.lex = function lex(src) {
src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
src = src.replace(/\r\n|\r/g, '\n');
this.blockTokens(src, this.tokens);
var next;

Expand All @@ -1522,7 +1522,11 @@ var Lexer = /*#__PURE__*/function () {
}

if (this.options.pedantic) {
src = src.replace(/^ +$/gm, '');
src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
} else {
src = src.replace(/^( *)(\t+)/gm, function (_, leading, tabs) {
return leading + ' '.repeat(tabs.length);
});
}

var token, lastToken, cutSrc, lastParagraphClipped;
Expand Down
18 changes: 11 additions & 7 deletions lib/marked.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ class Tokenizer {
blockquote(src) {
const cap = this.rules.block.blockquote.exec(src);
if (cap) {
const text = cap[0].replace(/^ *> ?/gm, '');
const text = cap[0].replace(/^ *>[ \t]?/gm, '');

return {
type: 'blockquote',
Expand Down Expand Up @@ -497,7 +497,7 @@ class Tokenizer {
}

// Get next list item
const itemRegex = new RegExp(`^( {0,3}${bull})((?: [^\\n]*)?(?:\\n|$))`);
const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);

// Check if current bullet point can start a new List Item
while (src) {
Expand Down Expand Up @@ -1084,10 +1084,10 @@ const block = {
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+|$)/,
hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
list: /^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,
list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
html: '^ {0,3}(?:' // optional indentation
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
+ '|comment[^\\n]*(\\n+|$)' // (2)
Expand Down Expand Up @@ -1486,8 +1486,7 @@ class Lexer {
*/
lex(src) {
src = src
.replace(/\r\n|\r/g, '\n')
.replace(/\t/g, ' ');
.replace(/\r\n|\r/g, '\n');

this.blockTokens(src, this.tokens);

Expand All @@ -1504,8 +1503,13 @@ class Lexer {
*/
blockTokens(src, tokens = []) {
if (this.options.pedantic) {
src = src.replace(/^ +$/gm, '');
src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
} else {
src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
return leading + ' '.repeat(tabs.length);
});
}

let token, lastToken, cutSrc, lastParagraphClipped;

while (src) {
Expand Down
16 changes: 10 additions & 6 deletions lib/marked.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@
var cap = this.rules.block.blockquote.exec(src);

if (cap) {
var text = cap[0].replace(/^ *> ?/gm, '');
var text = cap[0].replace(/^ *>[ \t]?/gm, '');
return {
type: 'blockquote',
raw: cap[0],
Expand Down Expand Up @@ -581,7 +581,7 @@
} // Get next list item


var itemRegex = new RegExp("^( {0,3}" + bull + ")((?: [^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item
var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item

while (src) {
endEarly = false;
Expand Down Expand Up @@ -1218,10 +1218,10 @@
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+|$)/,
hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
list: /^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,
list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
html: '^ {0,3}(?:' // optional indentation
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
+ '|comment[^\\n]*(\\n+|$)' // (2)
Expand Down Expand Up @@ -1501,7 +1501,7 @@
var _proto = Lexer.prototype;

_proto.lex = function lex(src) {
src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
src = src.replace(/\r\n|\r/g, '\n');
this.blockTokens(src, this.tokens);
var next;

Expand All @@ -1524,7 +1524,11 @@
}

if (this.options.pedantic) {
src = src.replace(/^ +$/gm, '');
src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
} else {
src = src.replace(/^( *)(\t+)/gm, function (_, leading, tabs) {
return leading + ' '.repeat(tabs.length);
});
}

var token, lastToken, cutSrc, lastParagraphClipped;
Expand Down
2 changes: 1 addition & 1 deletion marked.min.js

Large diffs are not rendered by default.

0 comments on commit 268dff2

Please sign in to comment.