diff --git a/lib/marked.js b/lib/marked.js
index 2181f3c9e2..d9d99ad1cc 100644
--- a/lib/marked.js
+++ b/lib/marked.js
@@ -15,26 +15,6 @@
(global = global || self, global.marked = factory());
}(this, (function () { 'use strict';
- function _typeof(obj) {
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- _typeof = function (obj) {
- return typeof obj;
- };
- } else {
- _typeof = function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- }
-
- return _typeof(obj);
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
@@ -523,8 +503,6 @@
/*#__PURE__*/
function () {
function Lexer(options) {
- _classCallCheck(this, Lexer);
-
this.tokens = [];
this.tokens.links = Object.create(null);
this.options = options || defaults$1;
@@ -541,344 +519,340 @@
*/
- _createClass(Lexer, [{
- key: "lex",
+ /**
+ * Static Lex Method
+ */
+ Lexer.lex = function lex(src, options) {
+ var lexer = new Lexer(options);
+ return lexer.lex(src);
+ };
- /**
- * Preprocessing
- */
- value: function lex(src) {
- src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
- return this.token(src, true);
- }
- }, {
- key: "token",
-
- /**
- * Lexing
- */
- value: function token(src, top) {
- src = src.replace(/^ +$/gm, '');
- var next, loose, cap, bull, b, item, listStart, listItems, t, space, i, tag, l, isordered, istask, ischecked;
-
- while (src) {
- // newline
- if (cap = this.rules.newline.exec(src)) {
- src = src.substring(cap[0].length);
+ var _proto = Lexer.prototype;
- if (cap[0].length > 1) {
- this.tokens.push({
- type: 'space'
- });
- }
- } // code
+ /**
+ * Preprocessing
+ */
+ _proto.lex = function lex(src) {
+ src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
+ return this.token(src, true);
+ };
+ /**
+ * Lexing
+ */
+ _proto.token = function token(src, top) {
+ src = src.replace(/^ +$/gm, '');
+ var next, loose, cap, bull, b, item, listStart, listItems, t, space, i, tag, l, isordered, istask, ischecked;
- if (cap = this.rules.code.exec(src)) {
- var lastToken = this.tokens[this.tokens.length - 1];
- src = src.substring(cap[0].length); // An indented code block cannot interrupt a paragraph.
+ while (src) {
+ // newline
+ if (cap = this.rules.newline.exec(src)) {
+ src = src.substring(cap[0].length);
- if (lastToken && lastToken.type === 'paragraph') {
- lastToken.text += '\n' + cap[0].trimRight();
- } else {
- cap = cap[0].replace(/^ {4}/gm, '');
- this.tokens.push({
- type: 'code',
- codeBlockStyle: 'indented',
- text: !this.options.pedantic ? rtrim$1(cap, '\n') : cap
- });
- }
+ if (cap[0].length > 1) {
+ this.tokens.push({
+ type: 'space'
+ });
+ }
+ } // code
- continue;
- } // fences
+ if (cap = this.rules.code.exec(src)) {
+ var lastToken = this.tokens[this.tokens.length - 1];
+ src = src.substring(cap[0].length); // An indented code block cannot interrupt a paragraph.
- if (cap = this.rules.fences.exec(src)) {
- src = src.substring(cap[0].length);
+ if (lastToken && lastToken.type === 'paragraph') {
+ lastToken.text += '\n' + cap[0].trimRight();
+ } else {
+ cap = cap[0].replace(/^ {4}/gm, '');
this.tokens.push({
type: 'code',
- lang: cap[2] ? cap[2].trim() : cap[2],
- text: cap[3] || ''
+ codeBlockStyle: 'indented',
+ text: !this.options.pedantic ? rtrim$1(cap, '\n') : cap
});
- continue;
- } // heading
+ }
+ continue;
+ } // fences
+
+
+ if (cap = this.rules.fences.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'code',
+ lang: cap[2] ? cap[2].trim() : cap[2],
+ text: cap[3] || ''
+ });
+ continue;
+ } // heading
+
+
+ if (cap = this.rules.heading.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'heading',
+ depth: cap[1].length,
+ text: cap[2]
+ });
+ continue;
+ } // table no leading pipe (gfm)
+
+
+ if (cap = this.rules.nptable.exec(src)) {
+ item = {
+ type: 'table',
+ header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
+ align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
+ cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
+ };
- if (cap = this.rules.heading.exec(src)) {
+ if (item.header.length === item.align.length) {
src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'heading',
- depth: cap[1].length,
- text: cap[2]
- });
- continue;
- } // table no leading pipe (gfm)
-
- if (cap = this.rules.nptable.exec(src)) {
- item = {
- type: 'table',
- header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
- };
-
- if (item.header.length === item.align.length) {
- src = src.substring(cap[0].length);
-
- for (i = 0; i < item.align.length; i++) {
- if (/^ *-+: *$/.test(item.align[i])) {
- item.align[i] = 'right';
- } else if (/^ *:-+: *$/.test(item.align[i])) {
- item.align[i] = 'center';
- } else if (/^ *:-+ *$/.test(item.align[i])) {
- item.align[i] = 'left';
- } else {
- item.align[i] = null;
- }
- }
-
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = splitCells$1(item.cells[i], item.header.length);
+ for (i = 0; i < item.align.length; i++) {
+ if (/^ *-+: *$/.test(item.align[i])) {
+ item.align[i] = 'right';
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
+ item.align[i] = 'center';
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
+ item.align[i] = 'left';
+ } else {
+ item.align[i] = null;
}
-
- this.tokens.push(item);
- continue;
}
- } // hr
-
-
- if (cap = this.rules.hr.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'hr'
- });
- continue;
- } // blockquote
+ for (i = 0; i < item.cells.length; i++) {
+ item.cells[i] = splitCells$1(item.cells[i], item.header.length);
+ }
- if (cap = this.rules.blockquote.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'blockquote_start'
- });
- cap = cap[0].replace(/^ *> ?/gm, ''); // Pass `top` to keep the current
- // "toplevel" state. This is exactly
- // how markdown.pl works.
-
- this.token(cap, top);
- this.tokens.push({
- type: 'blockquote_end'
- });
+ this.tokens.push(item);
continue;
- } // list
-
-
- if (cap = this.rules.list.exec(src)) {
- src = src.substring(cap[0].length);
- bull = cap[2];
- isordered = bull.length > 1;
- listStart = {
- type: 'list_start',
- ordered: isordered,
- start: isordered ? +bull : '',
- loose: false
- };
- this.tokens.push(listStart); // Get each top-level item.
-
- cap = cap[0].match(this.rules.item);
- listItems = [];
- next = false;
- l = cap.length;
- i = 0;
-
- for (; i < l; i++) {
- item = cap[i]; // Remove the list item's bullet
- // so it is seen as the next token.
-
- space = item.length;
- item = item.replace(/^ *([*+-]|\d+\.) */, ''); // Outdent whatever the
- // list item contains. Hacky.
+ }
+ } // hr
+
+
+ if (cap = this.rules.hr.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'hr'
+ });
+ continue;
+ } // blockquote
+
+
+ if (cap = this.rules.blockquote.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'blockquote_start'
+ });
+ cap = cap[0].replace(/^ *> ?/gm, ''); // Pass `top` to keep the current
+ // "toplevel" state. This is exactly
+ // how markdown.pl works.
+
+ this.token(cap, top);
+ this.tokens.push({
+ type: 'blockquote_end'
+ });
+ continue;
+ } // list
+
+
+ if (cap = this.rules.list.exec(src)) {
+ src = src.substring(cap[0].length);
+ bull = cap[2];
+ isordered = bull.length > 1;
+ listStart = {
+ type: 'list_start',
+ ordered: isordered,
+ start: isordered ? +bull : '',
+ loose: false
+ };
+ this.tokens.push(listStart); // Get each top-level item.
- if (~item.indexOf('\n ')) {
- space -= item.length;
- item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
- } // Determine whether the next list item belongs here.
- // Backpedal if it does not belong in this list.
+ cap = cap[0].match(this.rules.item);
+ listItems = [];
+ next = false;
+ l = cap.length;
+ i = 0;
+ for (; i < l; i++) {
+ item = cap[i]; // Remove the list item's bullet
+ // so it is seen as the next token.
- if (i !== l - 1) {
- b = block$1.bullet.exec(cap[i + 1])[0];
+ space = item.length;
+ item = item.replace(/^ *([*+-]|\d+\.) */, ''); // Outdent whatever the
+ // list item contains. Hacky.
- if (bull.length > 1 ? b.length === 1 : b.length > 1 || this.options.smartLists && b !== bull) {
- src = cap.slice(i + 1).join('\n') + src;
- i = l - 1;
- }
- } // Determine whether item is loose or not.
- // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
- // for discount behavior.
+ if (~item.indexOf('\n ')) {
+ space -= item.length;
+ item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
+ } // Determine whether the next list item belongs here.
+ // Backpedal if it does not belong in this list.
- loose = next || /\n\n(?!\s*$)/.test(item);
+ if (i !== l - 1) {
+ b = block$1.bullet.exec(cap[i + 1])[0];
- if (i !== l - 1) {
- next = item.charAt(item.length - 1) === '\n';
- if (!loose) loose = next;
+ if (bull.length > 1 ? b.length === 1 : b.length > 1 || this.options.smartLists && b !== bull) {
+ src = cap.slice(i + 1).join('\n') + src;
+ i = l - 1;
}
+ } // Determine whether item is loose or not.
+ // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
+ // for discount behavior.
- if (loose) {
- listStart.loose = true;
- } // Check for task list items
+ loose = next || /\n\n(?!\s*$)/.test(item);
- istask = /^\[[ xX]\] /.test(item);
- ischecked = undefined;
+ if (i !== l - 1) {
+ next = item.charAt(item.length - 1) === '\n';
+ if (!loose) loose = next;
+ }
- if (istask) {
- ischecked = item[1] !== ' ';
- item = item.replace(/^\[[ xX]\] +/, '');
- }
+ if (loose) {
+ listStart.loose = true;
+ } // Check for task list items
- t = {
- type: 'list_item_start',
- task: istask,
- checked: ischecked,
- loose: loose
- };
- listItems.push(t);
- this.tokens.push(t); // Recurse.
-
- this.token(item, false);
- this.tokens.push({
- type: 'list_item_end'
- });
- }
- if (listStart.loose) {
- l = listItems.length;
- i = 0;
+ istask = /^\[[ xX]\] /.test(item);
+ ischecked = undefined;
- for (; i < l; i++) {
- listItems[i].loose = true;
- }
+ if (istask) {
+ ischecked = item[1] !== ' ';
+ item = item.replace(/^\[[ xX]\] +/, '');
}
- this.tokens.push({
- type: 'list_end'
- });
- continue;
- } // html
-
+ t = {
+ type: 'list_item_start',
+ task: istask,
+ checked: ischecked,
+ loose: loose
+ };
+ listItems.push(t);
+ this.tokens.push(t); // Recurse.
- if (cap = this.rules.html.exec(src)) {
- src = src.substring(cap[0].length);
+ this.token(item, false);
this.tokens.push({
- type: this.options.sanitize ? 'paragraph' : 'html',
- pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
- text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$1(cap[0]) : cap[0]
+ type: 'list_item_end'
});
- continue;
- } // def
+ }
+ if (listStart.loose) {
+ l = listItems.length;
+ i = 0;
- if (top && (cap = this.rules.def.exec(src))) {
- src = src.substring(cap[0].length);
- if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
- tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
-
- if (!this.tokens.links[tag]) {
- this.tokens.links[tag] = {
- href: cap[2],
- title: cap[3]
- };
+ for (; i < l; i++) {
+ listItems[i].loose = true;
}
+ }
- continue;
- } // table (gfm)
-
-
- if (cap = this.rules.table.exec(src)) {
- item = {
- type: 'table',
- header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
+ this.tokens.push({
+ type: 'list_end'
+ });
+ continue;
+ } // html
+
+
+ if (cap = this.rules.html.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: this.options.sanitize ? 'paragraph' : 'html',
+ pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
+ text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$1(cap[0]) : cap[0]
+ });
+ continue;
+ } // def
+
+
+ if (top && (cap = this.rules.def.exec(src))) {
+ src = src.substring(cap[0].length);
+ if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
+ tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
+
+ if (!this.tokens.links[tag]) {
+ this.tokens.links[tag] = {
+ href: cap[2],
+ title: cap[3]
};
+ }
- if (item.header.length === item.align.length) {
- src = src.substring(cap[0].length);
-
- for (i = 0; i < item.align.length; i++) {
- if (/^ *-+: *$/.test(item.align[i])) {
- item.align[i] = 'right';
- } else if (/^ *:-+: *$/.test(item.align[i])) {
- item.align[i] = 'center';
- } else if (/^ *:-+ *$/.test(item.align[i])) {
- item.align[i] = 'left';
- } else {
- item.align[i] = null;
- }
- }
-
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = splitCells$1(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
- }
+ continue;
+ } // table (gfm)
- this.tokens.push(item);
- continue;
- }
- } // lheading
+ if (cap = this.rules.table.exec(src)) {
+ item = {
+ type: 'table',
+ header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
+ align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
+ cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
+ };
- if (cap = this.rules.lheading.exec(src)) {
+ if (item.header.length === item.align.length) {
src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'heading',
- depth: cap[2].charAt(0) === '=' ? 1 : 2,
- text: cap[1]
- });
- continue;
- } // top-level paragraph
-
- if (top && (cap = this.rules.paragraph.exec(src))) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'paragraph',
- text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
- });
- continue;
- } // text
+ for (i = 0; i < item.align.length; i++) {
+ if (/^ *-+: *$/.test(item.align[i])) {
+ item.align[i] = 'right';
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
+ item.align[i] = 'center';
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
+ item.align[i] = 'left';
+ } else {
+ item.align[i] = null;
+ }
+ }
+ for (i = 0; i < item.cells.length; i++) {
+ item.cells[i] = splitCells$1(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
+ }
- if (cap = this.rules.text.exec(src)) {
- // Top-level should never reach here.
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'text',
- text: cap[0]
- });
+ this.tokens.push(item);
continue;
}
-
- if (src) {
- throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
- }
+ } // lheading
+
+
+ if (cap = this.rules.lheading.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'heading',
+ depth: cap[2].charAt(0) === '=' ? 1 : 2,
+ text: cap[1]
+ });
+ continue;
+ } // top-level paragraph
+
+
+ if (top && (cap = this.rules.paragraph.exec(src))) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'paragraph',
+ text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
+ });
+ continue;
+ } // text
+
+
+ if (cap = this.rules.text.exec(src)) {
+ // Top-level should never reach here.
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'text',
+ text: cap[0]
+ });
+ continue;
}
- return this.tokens;
- }
- }], [{
- key: "lex",
-
- /**
- * Static Lex Method
- */
- value: function lex(src, options) {
- var lexer = new Lexer(options);
- return lexer.lex(src);
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
}
- }, {
+
+ return this.tokens;
+ };
+
+ _createClass(Lexer, null, [{
key: "rules",
get: function get() {
return block$1;
@@ -899,164 +873,142 @@
/*#__PURE__*/
function () {
function Renderer(options) {
- _classCallCheck(this, Renderer);
-
this.options = options || defaults$2;
}
- _createClass(Renderer, [{
- key: "code",
- value: function code(_code, infostring, escaped) {
- var lang = (infostring || '').match(/\S*/)[0];
+ var _proto = Renderer.prototype;
- if (this.options.highlight) {
- var out = this.options.highlight(_code, lang);
+ _proto.code = function code(_code, infostring, escaped) {
+ var lang = (infostring || '').match(/\S*/)[0];
- if (out != null && out !== _code) {
- escaped = true;
- _code = out;
- }
- }
+ if (this.options.highlight) {
+ var out = this.options.highlight(_code, lang);
- if (!lang) {
- return '
' + (escaped ? _code : escape$2(_code, true)) + '
';
+ if (out != null && out !== _code) {
+ escaped = true;
+ _code = out;
}
-
- return '' + (escaped ? _code : escape$2(_code, true)) + '
\n';
}
- }, {
- key: "blockquote",
- value: function blockquote(quote) {
- return '\n' + quote + '
\n';
- }
- }, {
- key: "html",
- value: function html(_html) {
- return _html;
+
+ if (!lang) {
+ return '' + (escaped ? _code : escape$2(_code, true)) + '
';
}
- }, {
- key: "heading",
- value: function heading(text, level, raw, slugger) {
- if (this.options.headerIds) {
- return '\n';
- } // ignore IDs
+ return '' + (escaped ? _code : escape$2(_code, true)) + '
\n';
+ };
- return '' + text + '\n';
- }
- }, {
- key: "hr",
- value: function hr() {
- return this.options.xhtml ? '
\n' : '
\n';
- }
- }, {
- key: "list",
- value: function list(body, ordered, start) {
- var type = ordered ? 'ol' : 'ul',
- startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
- return '<' + type + startatt + '>\n' + body + '' + type + '>\n';
- }
- }, {
- key: "listitem",
- value: function listitem(text) {
- return '' + text + '\n';
- }
- }, {
- key: "checkbox",
- value: function checkbox(checked) {
- return ' ';
- }
- }, {
- key: "paragraph",
- value: function paragraph(text) {
- return '' + text + '
\n';
- }
- }, {
- key: "table",
- value: function table(header, body) {
- if (body) body = '' + body + '';
- return '\n' + '\n' + header + '\n' + body + '
\n';
- }
- }, {
- key: "tablerow",
- value: function tablerow(content) {
- return '\n' + content + '
\n';
- }
- }, {
- key: "tablecell",
- value: function tablecell(content, flags) {
- var type = flags.header ? 'th' : 'td';
- var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
- return tag + content + '' + type + '>\n';
- }
- }, {
- key: "strong",
- // span level renderer
- value: function strong(text) {
- return '' + text + '';
- }
- }, {
- key: "em",
- value: function em(text) {
- return '' + text + '';
- }
- }, {
- key: "codespan",
- value: function codespan(text) {
- return '' + text + '
';
- }
- }, {
- key: "br",
- value: function br() {
- return this.options.xhtml ? '
' : '
';
- }
- }, {
- key: "del",
- value: function del(text) {
- return '' + text + '';
- }
- }, {
- key: "link",
- value: function link(href, title, text) {
- href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
+ _proto.blockquote = function blockquote(quote) {
+ return '\n' + quote + '
\n';
+ };
- if (href === null) {
- return text;
- }
+ _proto.html = function html(_html) {
+ return _html;
+ };
- var out = '';
- return out;
+ return '' + text + '\n';
+ };
+
+ _proto.hr = function hr() {
+ return this.options.xhtml ? '
\n' : '
\n';
+ };
+
+ _proto.list = function list(body, ordered, start) {
+ var type = ordered ? 'ol' : 'ul',
+ startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
+ return '<' + type + startatt + '>\n' + body + '' + type + '>\n';
+ };
+
+ _proto.listitem = function listitem(text) {
+ return '' + text + '\n';
+ };
+
+ _proto.checkbox = function checkbox(checked) {
+ return ' ';
+ };
+
+ _proto.paragraph = function paragraph(text) {
+ return '' + text + '
\n';
+ };
+
+ _proto.table = function table(header, body) {
+ if (body) body = '' + body + '';
+ return '\n' + '\n' + header + '\n' + body + '
\n';
+ };
+
+ _proto.tablerow = function tablerow(content) {
+ return '\n' + content + '
\n';
+ };
+
+ _proto.tablecell = function tablecell(content, flags) {
+ var type = flags.header ? 'th' : 'td';
+ var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
+ return tag + content + '' + type + '>\n';
+ };
+
+ // span level renderer
+ _proto.strong = function strong(text) {
+ return '' + text + '';
+ };
+
+ _proto.em = function em(text) {
+ return '' + text + '';
+ };
+
+ _proto.codespan = function codespan(text) {
+ return '' + text + '
';
+ };
+
+ _proto.br = function br() {
+ return this.options.xhtml ? '
' : '
';
+ };
+
+ _proto.del = function del(text) {
+ return '' + text + '';
+ };
+
+ _proto.link = function link(href, title, text) {
+ href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
+
+ if (href === null) {
+ return text;
}
- }, {
- key: "image",
- value: function image(href, title, text) {
- href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
- if (href === null) {
- return text;
- }
+ var out = '' + text + '';
+ return out;
+ };
+
+ _proto.image = function image(href, title, text) {
+ href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
- out += this.options.xhtml ? '/>' : '>';
- return out;
+ if (href === null) {
+ return text;
}
- }, {
- key: "text",
- value: function text(_text) {
- return _text;
+
+ var out = '' : '>';
+ return out;
+ };
+
+ _proto.text = function text(_text) {
+ return _text;
+ };
return Renderer;
}();
@@ -1068,8 +1020,6 @@
/*#__PURE__*/
function () {
function Slugger() {
- _classCallCheck(this, Slugger);
-
this.seen = {};
}
/**
@@ -1077,24 +1027,23 @@
*/
- _createClass(Slugger, [{
- key: "slug",
- value: function slug(value) {
- var slug = value.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
+ var _proto = Slugger.prototype;
- if (this.seen.hasOwnProperty(slug)) {
- var originalSlug = slug;
+ _proto.slug = function slug(value) {
+ var slug = value.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
- do {
- this.seen[originalSlug]++;
- slug = originalSlug + '-' + this.seen[originalSlug];
- } while (this.seen.hasOwnProperty(slug));
- }
+ if (this.seen.hasOwnProperty(slug)) {
+ var originalSlug = slug;
- this.seen[slug] = 0;
- return slug;
+ do {
+ this.seen[originalSlug]++;
+ slug = originalSlug + '-' + this.seen[originalSlug];
+ } while (this.seen.hasOwnProperty(slug));
}
- }]);
+
+ this.seen[slug] = 0;
+ return slug;
+ };
return Slugger;
}();
@@ -1111,8 +1060,6 @@
/*#__PURE__*/
function () {
function InlineLexer(links, options) {
- _classCallCheck(this, InlineLexer);
-
this.options = options || defaults$3;
this.links = links;
this.rules = inline$1.normal;
@@ -1139,270 +1086,265 @@
*/
- _createClass(InlineLexer, [{
- key: "output",
-
- /**
- * Lexing/Compiling
- */
- value: function output(src) {
- var out = '',
- link,
- text,
- href,
- title,
- cap,
- prevCapZero;
-
- while (src) {
- // escape
- if (cap = this.rules.escape.exec(src)) {
- src = src.substring(cap[0].length);
- out += escape$3(cap[1]);
- continue;
- } // tag
+ /**
+ * Static Lexing/Compiling Method
+ */
+ InlineLexer.output = function output(src, links, options) {
+ var inline = new InlineLexer(links, options);
+ return inline.output(src);
+ }
+ /**
+ * Lexing/Compiling
+ */
+ ;
+
+ var _proto = InlineLexer.prototype;
+
+ _proto.output = function output(src) {
+ var out = '',
+ link,
+ text,
+ href,
+ title,
+ cap,
+ prevCapZero;
+
+ while (src) {
+ // escape
+ if (cap = this.rules.escape.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += escape$3(cap[1]);
+ continue;
+ } // tag
+
+
+ if (cap = this.rules.tag.exec(src)) {
+ if (!this.inLink && /^/i.test(cap[0])) {
+ this.inLink = false;
+ }
+ if (!this.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
+ this.inRawBlock = true;
+ } else if (this.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
+ this.inRawBlock = false;
+ }
- if (cap = this.rules.tag.exec(src)) {
- if (!this.inLink && /^/i.test(cap[0])) {
- this.inLink = false;
- }
+ src = src.substring(cap[0].length);
+ out += this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$3(cap[0]) : cap[0];
+ continue;
+ } // link
- if (!this.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
- this.inRawBlock = true;
- } else if (this.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
- this.inRawBlock = false;
- }
- src = src.substring(cap[0].length);
- out += this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$3(cap[0]) : cap[0];
- continue;
- } // link
+ if (cap = this.rules.link.exec(src)) {
+ var lastParenIndex = findClosingBracket$1(cap[2], '()');
+
+ if (lastParenIndex > -1) {
+ var start = cap[0].indexOf('!') === 0 ? 5 : 4;
+ var linkLen = start + cap[1].length + lastParenIndex;
+ cap[2] = cap[2].substring(0, lastParenIndex);
+ cap[0] = cap[0].substring(0, linkLen).trim();
+ cap[3] = '';
+ }
+ src = src.substring(cap[0].length);
+ this.inLink = true;
+ href = cap[2];
- if (cap = this.rules.link.exec(src)) {
- var lastParenIndex = findClosingBracket$1(cap[2], '()');
+ if (this.options.pedantic) {
+ link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
- if (lastParenIndex > -1) {
- var start = cap[0].indexOf('!') === 0 ? 5 : 4;
- var linkLen = start + cap[1].length + lastParenIndex;
- cap[2] = cap[2].substring(0, lastParenIndex);
- cap[0] = cap[0].substring(0, linkLen).trim();
- cap[3] = '';
+ if (link) {
+ href = link[1];
+ title = link[3];
+ } else {
+ title = '';
}
+ } else {
+ title = cap[3] ? cap[3].slice(1, -1) : '';
+ }
- src = src.substring(cap[0].length);
- this.inLink = true;
- href = cap[2];
+ href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
+ out += this.outputLink(cap, {
+ href: InlineLexer.escapes(href),
+ title: InlineLexer.escapes(title)
+ });
+ this.inLink = false;
+ continue;
+ } // reflink, nolink
- if (this.options.pedantic) {
- link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
- if (link) {
- href = link[1];
- title = link[3];
- } else {
- title = '';
- }
- } else {
- title = cap[3] ? cap[3].slice(1, -1) : '';
- }
+ if ((cap = this.rules.reflink.exec(src)) || (cap = this.rules.nolink.exec(src))) {
+ src = src.substring(cap[0].length);
+ link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
+ link = this.links[link.toLowerCase()];
- href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
- out += this.outputLink(cap, {
- href: InlineLexer.escapes(href),
- title: InlineLexer.escapes(title)
- });
- this.inLink = false;
+ if (!link || !link.href) {
+ out += cap[0].charAt(0);
+ src = cap[0].substring(1) + src;
continue;
- } // reflink, nolink
+ }
+ this.inLink = true;
+ out += this.outputLink(cap, link);
+ this.inLink = false;
+ continue;
+ } // strong
- if ((cap = this.rules.reflink.exec(src)) || (cap = this.rules.nolink.exec(src))) {
- src = src.substring(cap[0].length);
- link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
- link = this.links[link.toLowerCase()];
- if (!link || !link.href) {
- out += cap[0].charAt(0);
- src = cap[0].substring(1) + src;
- continue;
- }
+ if (cap = this.rules.strong.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.strong(this.output(cap[4] || cap[3] || cap[2] || cap[1]));
+ continue;
+ } // em
- this.inLink = true;
- out += this.outputLink(cap, link);
- this.inLink = false;
- continue;
- } // strong
+ if (cap = this.rules.em.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.em(this.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]));
+ continue;
+ } // code
- if (cap = this.rules.strong.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.strong(this.output(cap[4] || cap[3] || cap[2] || cap[1]));
- continue;
- } // em
+ if (cap = this.rules.code.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.codespan(escape$3(cap[2].trim(), true));
+ continue;
+ } // br
- if (cap = this.rules.em.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.em(this.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]));
- continue;
- } // code
+ if (cap = this.rules.br.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.br();
+ continue;
+ } // del (gfm)
- if (cap = this.rules.code.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.codespan(escape$3(cap[2].trim(), true));
- continue;
- } // br
+ if (cap = this.rules.del.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.del(this.output(cap[1]));
+ continue;
+ } // autolink
- if (cap = this.rules.br.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.br();
- continue;
- } // del (gfm)
+ if (cap = this.rules.autolink.exec(src)) {
+ src = src.substring(cap[0].length);
- if (cap = this.rules.del.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.del(this.output(cap[1]));
- continue;
- } // autolink
+ if (cap[2] === '@') {
+ text = escape$3(this.mangle(cap[1]));
+ href = 'mailto:' + text;
+ } else {
+ text = escape$3(cap[1]);
+ href = text;
+ }
+ out += this.renderer.link(href, null, text);
+ continue;
+ } // url (gfm)
- if (cap = this.rules.autolink.exec(src)) {
- src = src.substring(cap[0].length);
- if (cap[2] === '@') {
- text = escape$3(this.mangle(cap[1]));
- href = 'mailto:' + text;
+ if (!this.inLink && (cap = this.rules.url.exec(src))) {
+ if (cap[2] === '@') {
+ text = escape$3(cap[0]);
+ href = 'mailto:' + text;
+ } else {
+ // do extended autolink path validation
+ do {
+ prevCapZero = cap[0];
+ cap[0] = this.rules._backpedal.exec(cap[0])[0];
+ } while (prevCapZero !== cap[0]);
+
+ text = escape$3(cap[0]);
+
+ if (cap[1] === 'www.') {
+ href = 'http://' + text;
} else {
- text = escape$3(cap[1]);
href = text;
}
+ }
- out += this.renderer.link(href, null, text);
- continue;
- } // url (gfm)
+ src = src.substring(cap[0].length);
+ out += this.renderer.link(href, null, text);
+ continue;
+ } // text
- if (!this.inLink && (cap = this.rules.url.exec(src))) {
- if (cap[2] === '@') {
- text = escape$3(cap[0]);
- href = 'mailto:' + text;
- } else {
- // do extended autolink path validation
- do {
- prevCapZero = cap[0];
- cap[0] = this.rules._backpedal.exec(cap[0])[0];
- } while (prevCapZero !== cap[0]);
+ if (cap = this.rules.text.exec(src)) {
+ src = src.substring(cap[0].length);
- text = escape$3(cap[0]);
+ if (this.inRawBlock) {
+ out += this.renderer.text(this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$3(cap[0]) : cap[0]);
+ } else {
+ out += this.renderer.text(escape$3(this.smartypants(cap[0])));
+ }
- if (cap[1] === 'www.') {
- href = 'http://' + text;
- } else {
- href = text;
- }
- }
+ continue;
+ }
- src = src.substring(cap[0].length);
- out += this.renderer.link(href, null, text);
- continue;
- } // text
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
+ return out;
+ };
- if (cap = this.rules.text.exec(src)) {
- src = src.substring(cap[0].length);
+ InlineLexer.escapes = function escapes(text) {
+ return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
+ }
+ /**
+ * Compile Link
+ */
+ ;
- if (this.inRawBlock) {
- out += this.renderer.text(this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$3(cap[0]) : cap[0]);
- } else {
- out += this.renderer.text(escape$3(this.smartypants(cap[0])));
- }
+ _proto.outputLink = function outputLink(cap, link) {
+ var href = link.href,
+ title = link.title ? escape$3(link.title) : null;
+ return cap[0].charAt(0) !== '!' ? this.renderer.link(href, title, this.output(cap[1])) : this.renderer.image(href, title, escape$3(cap[1]));
+ }
+ /**
+ * Smartypants Transformations
+ */
+ ;
+
+ _proto.smartypants = function smartypants(text) {
+ if (!this.options.smartypants) return text;
+ return text // em-dashes
+ .replace(/---/g, "\u2014") // en-dashes
+ .replace(/--/g, "\u2013") // opening singles
+ .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
+ .replace(/'/g, "\u2019") // opening doubles
+ .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
+ .replace(/"/g, "\u201D") // ellipses
+ .replace(/\.{3}/g, "\u2026");
+ }
+ /**
+ * Mangle Links
+ */
+ ;
- continue;
- }
+ _proto.mangle = function mangle(text) {
+ if (!this.options.mangle) return text;
+ var l = text.length;
+ var out = '',
+ i = 0,
+ ch;
- if (src) {
- throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
- }
+ for (; i < l; i++) {
+ ch = text.charCodeAt(i);
+
+ if (Math.random() > 0.5) {
+ ch = 'x' + ch.toString(16);
}
- return out;
+ out += '' + ch + ';';
}
- }, {
- key: "outputLink",
-
- /**
- * Compile Link
- */
- value: function outputLink(cap, link) {
- var href = link.href,
- title = link.title ? escape$3(link.title) : null;
- return cap[0].charAt(0) !== '!' ? this.renderer.link(href, title, this.output(cap[1])) : this.renderer.image(href, title, escape$3(cap[1]));
- }
- /**
- * Smartypants Transformations
- */
-
- }, {
- key: "smartypants",
- value: function smartypants(text) {
- if (!this.options.smartypants) return text;
- return text // em-dashes
- .replace(/---/g, "\u2014") // en-dashes
- .replace(/--/g, "\u2013") // opening singles
- .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
- .replace(/'/g, "\u2019") // opening doubles
- .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
- .replace(/"/g, "\u201D") // ellipses
- .replace(/\.{3}/g, "\u2026");
- }
- /**
- * Mangle Links
- */
-
- }, {
- key: "mangle",
- value: function mangle(text) {
- if (!this.options.mangle) return text;
- var l = text.length;
- var out = '',
- i = 0,
- ch;
-
- for (; i < l; i++) {
- ch = text.charCodeAt(i);
-
- if (Math.random() > 0.5) {
- ch = 'x' + ch.toString(16);
- }
- out += '' + ch + ';';
- }
+ return out;
+ };
- return out;
- }
- }], [{
- key: "output",
-
- /**
- * Static Lexing/Compiling Method
- */
- value: function output(src, links, options) {
- var inline = new InlineLexer(links, options);
- return inline.output(src);
- }
- }, {
- key: "escapes",
- value: function escapes(text) {
- return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
- }
- }, {
+ _createClass(InlineLexer, null, [{
key: "rules",
get: function get() {
return inline$1;
@@ -1419,52 +1361,42 @@
var TextRenderer_1 =
/*#__PURE__*/
function () {
- function TextRenderer() {
- _classCallCheck(this, TextRenderer);
- }
+ function TextRenderer() {}
- _createClass(TextRenderer, [{
- key: "strong",
- // no need for block level renderers
- value: function strong(text) {
- return text;
- }
- }, {
- key: "em",
- value: function em(text) {
- return text;
- }
- }, {
- key: "codespan",
- value: function codespan(text) {
- return text;
- }
- }, {
- key: "del",
- value: function del(text) {
- return text;
- }
- }, {
- key: "text",
- value: function text(_text) {
- return _text;
- }
- }, {
- key: "link",
- value: function link(href, title, text) {
- return '' + text;
- }
- }, {
- key: "image",
- value: function image(href, title, text) {
- return '' + text;
- }
- }, {
- key: "br",
- value: function br() {
- return '';
- }
- }]);
+ var _proto = TextRenderer.prototype;
+
+ // no need for block level renderers
+ _proto.strong = function strong(text) {
+ return text;
+ };
+
+ _proto.em = function em(text) {
+ return text;
+ };
+
+ _proto.codespan = function codespan(text) {
+ return text;
+ };
+
+ _proto.del = function del(text) {
+ return text;
+ };
+
+ _proto.text = function text(_text) {
+ return _text;
+ };
+
+ _proto.link = function link(href, title, text) {
+ return '' + text;
+ };
+
+ _proto.image = function image(href, title, text) {
+ return '' + text;
+ };
+
+ _proto.br = function br() {
+ return '';
+ };
return TextRenderer;
}();
@@ -1480,8 +1412,6 @@
/*#__PURE__*/
function () {
function Parser(options) {
- _classCallCheck(this, Parser);
-
this.tokens = [];
this.token = null;
this.options = options || defaults$4;
@@ -1495,216 +1425,205 @@
*/
- _createClass(Parser, [{
- key: "parse",
+ Parser.parse = function parse(tokens, options) {
+ var parser = new Parser(options);
+ return parser.parse(tokens);
+ };
- /**
- * Parse Loop
- */
- value: function parse(tokens) {
- this.inline = new InlineLexer_1(tokens.links, this.options); // use an InlineLexer with a TextRenderer to extract pure text
+ var _proto = Parser.prototype;
- this.inlineText = new InlineLexer_1(tokens.links, merge$2({}, this.options, {
- renderer: new TextRenderer_1()
- }));
- this.tokens = tokens.reverse();
- var out = '';
+ /**
+ * Parse Loop
+ */
+ _proto.parse = function parse(tokens) {
+ this.inline = new InlineLexer_1(tokens.links, this.options); // use an InlineLexer with a TextRenderer to extract pure text
- while (this.next()) {
- out += this.tok();
- }
+ this.inlineText = new InlineLexer_1(tokens.links, merge$2({}, this.options, {
+ renderer: new TextRenderer_1()
+ }));
+ this.tokens = tokens.reverse();
+ var out = '';
- return out;
+ while (this.next()) {
+ out += this.tok();
}
- }, {
- key: "next",
-
- /**
- * Next Token
- */
- value: function next() {
- this.token = this.tokens.pop();
- return this.token;
- }
- }, {
- key: "peek",
-
- /**
- * Preview Next Token
- */
- value: function peek() {
- return this.tokens[this.tokens.length - 1] || 0;
- }
- }, {
- key: "parseText",
- /**
- * Parse Text Tokens
- */
- value: function parseText() {
- var body = this.token.text;
+ return out;
+ };
- while (this.peek().type === 'text') {
- body += '\n' + this.next().text;
- }
+ /**
+ * Next Token
+ */
+ _proto.next = function next() {
+ this.token = this.tokens.pop();
+ return this.token;
+ };
+
+ /**
+ * Preview Next Token
+ */
+ _proto.peek = function peek() {
+ return this.tokens[this.tokens.length - 1] || 0;
+ };
+
+ /**
+ * Parse Text Tokens
+ */
+ _proto.parseText = function parseText() {
+ var body = this.token.text;
- return this.inline.output(body);
+ while (this.peek().type === 'text') {
+ body += '\n' + this.next().text;
}
- }, {
- key: "tok",
-
- /**
- * Parse Current Token
- */
- value: function tok() {
- var body = '';
-
- switch (this.token.type) {
- case 'space':
- {
- return '';
- }
- case 'hr':
- {
- return this.renderer.hr();
- }
+ return this.inline.output(body);
+ };
- case 'heading':
- {
- return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, unescape$1(this.inlineText.output(this.token.text)), this.slugger);
- }
+ /**
+ * Parse Current Token
+ */
+ _proto.tok = function tok() {
+ var body = '';
- case 'code':
- {
- return this.renderer.code(this.token.text, this.token.lang, this.token.escaped);
- }
+ switch (this.token.type) {
+ case 'space':
+ {
+ return '';
+ }
- case 'table':
- {
- var header = '',
- i,
- row,
- cell,
- j; // header
+ case 'hr':
+ {
+ return this.renderer.hr();
+ }
- cell = '';
+ case 'heading':
+ {
+ return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, unescape$1(this.inlineText.output(this.token.text)), this.slugger);
+ }
- for (i = 0; i < this.token.header.length; i++) {
- cell += this.renderer.tablecell(this.inline.output(this.token.header[i]), {
- header: true,
- align: this.token.align[i]
- });
- }
+ case 'code':
+ {
+ return this.renderer.code(this.token.text, this.token.lang, this.token.escaped);
+ }
- header += this.renderer.tablerow(cell);
+ case 'table':
+ {
+ var header = '',
+ i,
+ row,
+ cell,
+ j; // header
- for (i = 0; i < this.token.cells.length; i++) {
- row = this.token.cells[i];
- cell = '';
+ cell = '';
- for (j = 0; j < row.length; j++) {
- cell += this.renderer.tablecell(this.inline.output(row[j]), {
- header: false,
- align: this.token.align[j]
- });
- }
+ for (i = 0; i < this.token.header.length; i++) {
+ cell += this.renderer.tablecell(this.inline.output(this.token.header[i]), {
+ header: true,
+ align: this.token.align[i]
+ });
+ }
+
+ header += this.renderer.tablerow(cell);
- body += this.renderer.tablerow(cell);
+ for (i = 0; i < this.token.cells.length; i++) {
+ row = this.token.cells[i];
+ cell = '';
+
+ for (j = 0; j < row.length; j++) {
+ cell += this.renderer.tablecell(this.inline.output(row[j]), {
+ header: false,
+ align: this.token.align[j]
+ });
}
- return this.renderer.table(header, body);
+ body += this.renderer.tablerow(cell);
}
- case 'blockquote_start':
- {
- body = '';
+ return this.renderer.table(header, body);
+ }
- while (this.next().type !== 'blockquote_end') {
- body += this.tok();
- }
+ case 'blockquote_start':
+ {
+ body = '';
- return this.renderer.blockquote(body);
+ while (this.next().type !== 'blockquote_end') {
+ body += this.tok();
}
- case 'list_start':
- {
- body = '';
- var ordered = this.token.ordered,
- start = this.token.start;
+ return this.renderer.blockquote(body);
+ }
- while (this.next().type !== 'list_end') {
- body += this.tok();
- }
+ case 'list_start':
+ {
+ body = '';
+ var ordered = this.token.ordered,
+ start = this.token.start;
- return this.renderer.list(body, ordered, start);
+ while (this.next().type !== 'list_end') {
+ body += this.tok();
}
- case 'list_item_start':
- {
- body = '';
- var loose = this.token.loose;
- var checked = this.token.checked;
- var task = this.token.task;
-
- if (this.token.task) {
- if (loose) {
- if (this.peek().type === 'text') {
- var nextToken = this.peek();
- nextToken.text = this.renderer.checkbox(checked) + ' ' + nextToken.text;
- } else {
- this.tokens.push({
- type: 'text',
- text: this.renderer.checkbox(checked)
- });
- }
+ return this.renderer.list(body, ordered, start);
+ }
+
+ case 'list_item_start':
+ {
+ body = '';
+ var loose = this.token.loose;
+ var checked = this.token.checked;
+ var task = this.token.task;
+
+ if (this.token.task) {
+ if (loose) {
+ if (this.peek().type === 'text') {
+ var nextToken = this.peek();
+ nextToken.text = this.renderer.checkbox(checked) + ' ' + nextToken.text;
} else {
- body += this.renderer.checkbox(checked);
+ this.tokens.push({
+ type: 'text',
+ text: this.renderer.checkbox(checked)
+ });
}
+ } else {
+ body += this.renderer.checkbox(checked);
}
-
- while (this.next().type !== 'list_item_end') {
- body += !loose && this.token.type === 'text' ? this.parseText() : this.tok();
- }
-
- return this.renderer.listitem(body, task, checked);
}
- case 'html':
- {
- // TODO parse inline content if parameter markdown=1
- return this.renderer.html(this.token.text);
+ while (this.next().type !== 'list_item_end') {
+ body += !loose && this.token.type === 'text' ? this.parseText() : this.tok();
}
- case 'paragraph':
- {
- return this.renderer.paragraph(this.inline.output(this.token.text));
- }
+ return this.renderer.listitem(body, task, checked);
+ }
- case 'text':
- {
- return this.renderer.paragraph(this.parseText());
- }
+ case 'html':
+ {
+ // TODO parse inline content if parameter markdown=1
+ return this.renderer.html(this.token.text);
+ }
- default:
- {
- var errMsg = 'Token with "' + this.token.type + '" type was not found.';
+ case 'paragraph':
+ {
+ return this.renderer.paragraph(this.inline.output(this.token.text));
+ }
- if (this.options.silent) {
- console.log(errMsg);
- } else {
- throw new Error(errMsg);
- }
+ case 'text':
+ {
+ return this.renderer.paragraph(this.parseText());
+ }
+
+ default:
+ {
+ var errMsg = 'Token with "' + this.token.type + '" type was not found.';
+
+ if (this.options.silent) {
+ console.log(errMsg);
+ } else {
+ throw new Error(errMsg);
}
- }
- }
- }], [{
- key: "parse",
- value: function parse(tokens, options) {
- var parser = new Parser(options);
- return parser.parse(tokens);
+ }
}
- }]);
+ };
return Parser;
}();
@@ -1807,7 +1726,7 @@
};
}();
- if (_typeof(_ret) === "object") return _ret.v;
+ if (typeof _ret === "object") return _ret.v;
}
try {
diff --git a/marked.min.js b/marked.min.js
index 77dc57ef2a..3bf53e072a 100644
--- a/marked.min.js
+++ b/marked.min.js
@@ -3,4 +3,4 @@
* Copyright (c) 2011-2019, Christopher Jeffrey. (MIT Licensed)
* https://github.com/markedjs/marked
*/
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).marked=t()}(this,function(){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n"']/,a.escapeReplace=/[&<>"']/g,a.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,a.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g,a.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},a.getReplacement=function(e){return a.replacements[e]},o.unescapeTest=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,u.caret=/(^|[^\[])\^/g,h.protocol=/[^\w:]/g,h.originIndependentUrl=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,c.baseUrls={},c.justDomain=/^[^:]+:\/*[^/]*$/,c.protocol=/^([^:]+:)[\s\S]*$/,c.domain=/^([^:]+:\/*[^/]*)[\s\S]*$/;var f=a,d=o,k=h,m=function(e){for(var t,n,r=1;rt)n.splice(t);else for(;n.length ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:v,table:v,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};S.def=w(S.def).replace("label",S._label).replace("title",S._title).getRegex(),S.bullet=/(?:[*+-]|\d{1,9}\.)/,S.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,S.item=w(S.item,"gm").replace(/bull/g,S.bullet).getRegex(),S.list=w(S.list).replace(/bull/g,S.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+S.def.source+")").getRegex(),S._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",S._comment=//,S.html=w(S.html,"i").replace("comment",S._comment).replace("tag",S._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),S.paragraph=w(S._paragraph).replace("hr",S.hr).replace("heading"," {0,3}#{1,6} +").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",S._tag).getRegex(),S.blockquote=w(S.blockquote).replace("paragraph",S.paragraph).getRegex(),S.normal=$({},S),S.gfm=$({},S.normal,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),S.pedantic=$({},S.normal,{html:w("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",S._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:v,paragraph:w(S.normal._paragraph).replace("hr",S.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",S.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:v,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\*])\*(?!\*|[^\spunctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:v,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~"};z.em=w(z.em).replace(/punctuation/g,z._punctuation).getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,z.autolink=w(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=w(z.tag).replace("comment",S._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=w(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=w(z.reflink).replace("label",z._label).getRegex(),z.normal=$({},z),z.pedantic=$({},z.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=$({},z.normal,{escape:w(z.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\ ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),o={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(o),n=!(u=[]),f=(s=s[0].match(this.rules.item)).length,p=0;p'+(n?e:U(e,!0))+"
\n":""+(n?e:U(e,!0))+"
"}},{key:"blockquote",value:function(e){return"\n"+e+"
\n"}},{key:"html",value:function(e){return e}},{key:"heading",value:function(e,t,n,r){return this.options.headerIds?"\n":""+e+"\n"}},{key:"hr",value:function(){return this.options.xhtml?"
\n":"
\n"}},{key:"list",value:function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+r+">\n"}},{key:"listitem",value:function(e){return""+e+"\n"}},{key:"checkbox",value:function(e){return" "}},{key:"paragraph",value:function(e){return""+e+"
\n"}},{key:"table",value:function(e,t){return"\n\n"+e+"\n"+(t=t&&""+t+"")+"
\n"}},{key:"tablerow",value:function(e){return"\n"+e+"
\n"}},{key:"tablecell",value:function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"}},{key:"strong",value:function(e){return""+e+""}},{key:"em",value:function(e){return""+e+""}},{key:"codespan",value:function(e){return""+e+"
"}},{key:"br",value:function(){return this.options.xhtml?"
":"
"}},{key:"del",value:function(e){return""+e+""}},{key:"link",value:function(e,t,n){if(null===(e=O(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"+n+""}},{key:"image",value:function(e,t,n){if(null===(e=O(this.options.sanitize,this.options.baseUrl,e)))return n;var r='":">"}},{key:"text",value:function(e){return e}}]),t}(),I=function(){function e(){r(this,e),this.seen={}}return i(e,[{key:"slug",value:function(e){var t=e.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t}}]),e}(),P=l.defaults,D=A.inline,B=y,N=f,F=function(){function h(e,t){if(r(this,h),this.options=t||P,this.links=e,this.rules=D.normal,this.options.renderer=this.options.renderer||new j,this.renderer=this.options.renderer,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.pedantic?this.rules=D.pedantic:this.options.gfm&&(this.options.breaks?this.rules=D.breaks:this.rules=D.gfm)}return i(h,[{key:"output",value:function(e){for(var t,n,r,s,i,l,a="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),a+=N(i[1]);else if(i=this.rules.tag.exec(e))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):N(i[0]):i[0];else if(i=this.rules.link.exec(e)){var o=B(i[2],"()");if(-1$/,"$1"),a+=this.outputLink(i,{href:h.escapes(r),title:h.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){a+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),a+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),a+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),a+=this.renderer.codespan(N(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=N(this.mangle(i[1]))):n=N(i[1]),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?a+=this.renderer.text(this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):N(i[0]):i[0]):a+=this.renderer.text(N(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=N(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=N(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),a+=this.renderer.link(r,null,n)}return a}},{key:"outputLink",value:function(e,t){var n=t.href,r=t.title?N(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,N(e[1]))}},{key:"smartypants",value:function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e}},{key:"mangle",value:function(e){if(!this.options.mangle)return e;for(var t,n=e.length,r="",s=0;sAn error occurred:"+Q(e.message+"",!0)+"
";throw e}}return te.options=te.setOptions=function(e){return J(te.defaults,e),Y(te.defaults),te},te.getDefaults=W,te.defaults=ee,te.Parser=H,te.parser=H.parse,te.Renderer=j,te.TextRenderer=X,te.Lexer=T,te.lexer=T.lex,te.InlineLexer=F,te.inlineLexer=F.output,te.Slugger=I,te.parse=te});
\ No newline at end of file
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).marked=t()}(this,function(){"use strict";function r(e,t){for(var n=0;n"']/,i.escapeReplace=/[&<>"']/g,i.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,i.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g,i.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},i.getReplacement=function(e){return i.replacements[e]},l.unescapeTest=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,a.caret=/(^|[^\[])\^/g,o.protocol=/[^\w:]/g,o.originIndependentUrl=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,h.baseUrls={},h.justDomain=/^[^:]+:\/*[^/]*$/,h.protocol=/^([^:]+:)[\s\S]*$/,h.domain=/^([^:]+:\/*[^/]*)[\s\S]*$/;var p=i,g=l,f=o,d=function(e){for(var t,n,r=1;rt)n.splice(t);else for(;n.length ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:_,table:_,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};v.def=y(v.def).replace("label",v._label).replace("title",v._title).getRegex(),v.bullet=/(?:[*+-]|\d{1,9}\.)/,v.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,v.item=y(v.item,"gm").replace(/bull/g,v.bullet).getRegex(),v.list=y(v.list).replace(/bull/g,v.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+v.def.source+")").getRegex(),v._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",v._comment=//,v.html=y(v.html,"i").replace("comment",v._comment).replace("tag",v._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),v.paragraph=y(v._paragraph).replace("hr",v.hr).replace("heading"," {0,3}#{1,6} +").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",v._tag).getRegex(),v.blockquote=y(v.blockquote).replace("paragraph",v.paragraph).getRegex(),v.normal=w({},v),v.gfm=w({},v.normal,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),v.pedantic=w({},v.normal,{html:y("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",v._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:_,paragraph:y(v.normal._paragraph).replace("hr",v.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",v.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var $={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:_,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\*])\*(?!\*|[^\spunctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:_,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~"};$.em=y($.em).replace(/punctuation/g,$._punctuation).getRegex(),$._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,$._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,$._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,$.autolink=y($.autolink).replace("scheme",$._scheme).replace("email",$._email).getRegex(),$._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,$.tag=y($.tag).replace("comment",v._comment).replace("attribute",$._attribute).getRegex(),$._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,$._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,$.link=y($.link).replace("label",$._label).replace("href",$._href).replace("title",$._title).getRegex(),$.reflink=y($.reflink).replace("label",$._label).getRegex(),$.normal=w({},$),$.pedantic=w({},$.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:y(/^!?\[(label)\]\((.*?)\)/).replace("label",$._label).getRegex(),reflink:y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$._label).getRegex()}),$.gfm=w({},$.normal,{escape:y($.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\ ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),o={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(o),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,p=0;p'+(n?e:E(e,!0))+"
\n":""+(n?e:E(e,!0))+"
"},t.blockquote=function(e){return"\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,n,r){return this.options.headerIds?"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+r+">\n"},t.listitem=function(e){return""+e+"\n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return""+e+"
\n"},t.table=function(e,t){return"\n\n"+e+"\n"+(t=t&&""+t+"")+"
\n"},t.tablerow=function(e){return"\n"+e+"
\n"},t.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+"
"},t.br=function(){return this.options.xhtml?"
":"
"},t.del=function(e){return""+e+""},t.link=function(e,t,n){if(null===(e=T(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"+n+""},t.image=function(e,t,n){if(null===(e=T(this.options.sanitize,this.options.baseUrl,e)))return n;var r='":">"},t.text=function(e){return e},e}(),U=function(){function e(){this.seen={}}return e.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},e}(),j=s.defaults,I=S.inline,P=k,D=p,B=function(){function u(e,t){if(this.options=t||j,this.links=e,this.rules=I.normal,this.options.renderer=this.options.renderer||new O,this.renderer=this.options.renderer,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.pedantic?this.rules=I.pedantic:this.options.gfm&&(this.options.breaks?this.rules=I.breaks:this.rules=I.gfm)}u.output=function(e,t,n){return new u(t,n).output(e)};var e=u.prototype;return e.output=function(e){for(var t,n,r,s,i,l,a="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),a+=D(i[1]);else if(i=this.rules.tag.exec(e))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):D(i[0]):i[0];else if(i=this.rules.link.exec(e)){var o=P(i[2],"()");if(-1$/,"$1"),a+=this.outputLink(i,{href:u.escapes(r),title:u.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){a+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),a+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),a+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),a+=this.renderer.codespan(D(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=D(this.mangle(i[1]))):n=D(i[1]),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?a+=this.renderer.text(this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):D(i[0]):i[0]):a+=this.renderer.text(D(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=D(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=D(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),a+=this.renderer.link(r,null,n)}return a},u.escapes=function(e){return e?e.replace(u.rules._escapes,"$1"):e},e.outputLink=function(e,t){var n=t.href,r=t.title?D(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,D(e[1]))},e.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},e.mangle=function(e){if(!this.options.mangle)return e;for(var t,n=e.length,r="",s=0;sAn error occurred:"+J(e.message+"",!0)+"
";throw e}}return Y.options=Y.setOptions=function(e){return V(Y.defaults,e),Q(Y.defaults),Y},Y.getDefaults=K,Y.defaults=W,Y.Parser=M,Y.parser=M.parse,Y.Renderer=O,Y.TextRenderer=N,Y.Lexer=q,Y.lexer=q.lex,Y.InlineLexer=B,Y.inlineLexer=B.output,Y.Slugger=U,Y.parse=Y});
\ No newline at end of file
diff --git a/rollup.config.js b/rollup.config.js
index 8a685e2c57..79b3c65ace 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -25,7 +25,7 @@ https://github.com/markedjs/marked
}),
commonjs(),
babel({
- presets: ['@babel/preset-env']
+ presets: [['@babel/preset-env', { loose: true }]]
})
]
};