Skip to content

Commit

Permalink
🗜️ build [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis-CI committed Dec 5, 2019
1 parent edf87e3 commit ed18cd5
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 145 deletions.
122 changes: 65 additions & 57 deletions lib/marked.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
* The code in this file is generated from files in ./src/
*/

let defaults = getDefaults();
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}

var defaults = createCommonjsModule(function (module) {
function getDefaults() {
return {
baseUrl: null,
Expand All @@ -33,47 +36,53 @@ function getDefaults() {
}

function changeDefaults(newDefaults) {
defaults = newDefaults;
module.exports.defaults = newDefaults;
}

var defaults_1 = {
defaults,
module.exports = {
defaults: getDefaults(),
getDefaults,
changeDefaults
};
});
var defaults_1 = defaults.defaults;
var defaults_2 = defaults.getDefaults;
var defaults_3 = defaults.changeDefaults;

/**
* Helpers
*/
const escapeTest = /[&<>"']/;
const escapeReplace = /[&<>"']/g;
const escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
const escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
const escapeReplacements = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
};
const getEscapeReplacement = (ch) => escapeReplacements[ch];
function escape(html, encode) {
if (encode) {
if (escape.escapeTest.test(html)) {
return html.replace(escape.escapeReplace, escape.getReplacement);
if (escapeTest.test(html)) {
return html.replace(escapeReplace, getEscapeReplacement);
}
} else {
if (escape.escapeTestNoEncode.test(html)) {
return html.replace(escape.escapeReplaceNoEncode, escape.getReplacement);
if (escapeTestNoEncode.test(html)) {
return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
}
}

return html;
}
escape.escapeTest = /[&<>"']/;
escape.escapeReplace = /[&<>"']/g;
escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
escape.replacements = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
};
escape.getReplacement = (ch) => escape.replacements[ch];

const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;

function unescape(html) {
// explicitly match decimal, hex, and named HTML entities
return html.replace(unescape.unescapeTest, (_, n) => {
return html.replace(unescapeTest, (_, n) => {
n = n.toLowerCase();
if (n === 'colon') return ':';
if (n.charAt(0) === '#') {
Expand All @@ -84,15 +93,15 @@ function unescape(html) {
return '';
});
}
unescape.unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;

const caret = /(^|[^\[])\^/g;
function edit(regex, opt) {
regex = regex.source || regex;
opt = opt || '';
const obj = {
replace: (name, val) => {
val = val.source || val;
val = val.replace(edit.caret, '$1');
val = val.replace(caret, '$1');
regex = regex.replace(name, val);
return obj;
},
Expand All @@ -102,14 +111,15 @@ function edit(regex, opt) {
};
return obj;
}
edit.caret = /(^|[^\[])\^/g;

const nonWordAndColonTest = /[^\w:]/g;
const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
function cleanUrl(sanitize, base, href) {
if (sanitize) {
let prot;
try {
prot = decodeURIComponent(unescape(href))
.replace(cleanUrl.protocol, '')
.replace(nonWordAndColonTest, '')
.toLowerCase();
} catch (e) {
return null;
Expand All @@ -118,7 +128,7 @@ function cleanUrl(sanitize, base, href) {
return null;
}
}
if (base && !cleanUrl.originIndependentUrl.test(href)) {
if (base && !originIndependentUrl.test(href)) {
href = resolveUrl(base, href);
}
try {
Expand All @@ -128,44 +138,42 @@ function cleanUrl(sanitize, base, href) {
}
return href;
}
cleanUrl.protocol = /[^\w:]/g;
cleanUrl.originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;

const baseUrls = {};
const justDomain = /^[^:]+:\/*[^/]*$/;
const protocol = /^([^:]+:)[\s\S]*$/;
const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;

function resolveUrl(base, href) {
if (!resolveUrl.baseUrls[' ' + base]) {
if (!baseUrls[' ' + base]) {
// we can ignore everything in base after the last slash of its path component,
// but we might need to add _that_
// https://tools.ietf.org/html/rfc3986#section-3
if (resolveUrl.justDomain.test(base)) {
resolveUrl.baseUrls[' ' + base] = base + '/';
if (justDomain.test(base)) {
baseUrls[' ' + base] = base + '/';
} else {
resolveUrl.baseUrls[' ' + base] = rtrim(base, '/', true);
baseUrls[' ' + base] = rtrim(base, '/', true);
}
}
base = resolveUrl.baseUrls[' ' + base];
base = baseUrls[' ' + base];
const relativeBase = base.indexOf(':') === -1;

if (href.substring(0, 2) === '//') {
if (relativeBase) {
return href;
}
return base.replace(resolveUrl.protocol, '$1') + href;
return base.replace(protocol, '$1') + href;
} else if (href.charAt(0) === '/') {
if (relativeBase) {
return href;
}
return base.replace(resolveUrl.domain, '$1') + href;
return base.replace(domain, '$1') + href;
} else {
return base + href;
}
}
resolveUrl.baseUrls = {};
resolveUrl.justDomain = /^[^:]+:\/*[^/]*$/;
resolveUrl.protocol = /^([^:]+:)[\s\S]*$/;
resolveUrl.domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;

function noop() {}
noop.exec = noop;
const noopTest = { exec: function noopTest() {} };

function merge(obj) {
let i = 1,
Expand Down Expand Up @@ -277,7 +285,7 @@ var helpers = {
edit,
cleanUrl,
resolveUrl,
noop,
noopTest,
merge,
splitCells,
rtrim,
Expand All @@ -286,7 +294,7 @@ var helpers = {
};

const {
noop: noop$1,
noopTest: noopTest$1,
edit: edit$1,
merge: merge$1
} = helpers;
Expand All @@ -313,8 +321,8 @@ const block = {
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
+ ')',
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
nptable: noop$1,
table: noop$1,
nptable: noopTest$1,
table: noopTest$1,
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:
Expand Down Expand Up @@ -401,7 +409,7 @@ block.pedantic = merge$1({}, block.normal, {
.getRegex(),
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
fences: noop$1, // fences not supported
fences: noopTest$1, // fences not supported
paragraph: edit$1(block.normal._paragraph)
.replace('hr', block.hr)
.replace('heading', ' *#{1,6} *[^\n]')
Expand All @@ -419,7 +427,7 @@ block.pedantic = merge$1({}, block.normal, {
const inline = {
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
url: noop$1,
url: noopTest$1,
tag: '^comment'
+ '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
Expand All @@ -433,7 +441,7 @@ const inline = {
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: noop$1,
del: noopTest$1,
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/
};

Expand Down Expand Up @@ -526,7 +534,7 @@ var rules = {
inline
};

const { defaults: defaults$1 } = defaults_1;
const { defaults: defaults$1 } = defaults;
const { block: block$1 } = rules;
const {
rtrim: rtrim$1,
Expand Down Expand Up @@ -929,7 +937,7 @@ var Lexer_1 = class Lexer {
};
};

const { defaults: defaults$2 } = defaults_1;
const { defaults: defaults$2 } = defaults;
const {
cleanUrl: cleanUrl$1,
escape: escape$2
Expand Down Expand Up @@ -1125,7 +1133,7 @@ var Slugger_1 = class Slugger {
};
};

const { defaults: defaults$3 } = defaults_1;
const { defaults: defaults$3 } = defaults;
const { inline: inline$1 } = rules;
const {
findClosingBracket: findClosingBracket$1,
Expand Down Expand Up @@ -1457,7 +1465,7 @@ var TextRenderer_1 = class TextRenderer {
}
};

const { defaults: defaults$4 } = defaults_1;
const { defaults: defaults$4 } = defaults;
const {
merge: merge$2,
unescape: unescape$1
Expand Down Expand Up @@ -1666,10 +1674,10 @@ const {
escape: escape$4
} = helpers;
const {
getDefaults: getDefaults$1,
changeDefaults: changeDefaults$1,
getDefaults,
changeDefaults,
defaults: defaults$5
} = defaults_1;
} = defaults;

/**
* Marked
Expand Down Expand Up @@ -1775,11 +1783,11 @@ function marked(src, opt, callback) {
marked.options =
marked.setOptions = function(opt) {
merge$3(marked.defaults, opt);
changeDefaults$1(marked.defaults);
changeDefaults(marked.defaults);
return marked;
};

marked.getDefaults = getDefaults$1;
marked.getDefaults = getDefaults;

marked.defaults = defaults$5;

Expand Down
Loading

1 comment on commit ed18cd5

@vercel
Copy link

@vercel vercel bot commented on ed18cd5 Dec 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.