diff --git a/.eslintignore b/.eslintignore
index 121531af84..f09ec93e09 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1 +1,2 @@
+lib
*.min.js
diff --git a/.eslintrc.json b/.eslintrc.json
index 4285bbc7d8..7915ab9bd9 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -3,10 +3,6 @@
"plugins": [
"standard"
],
- "parserOptions": {
- "ecmaVersion": 5,
- "sourceType": "script"
- },
"rules": {
"semi": ["error", "always"],
"indent": ["error", 2, {
@@ -20,11 +16,12 @@
"no-useless-escape": "off",
"one-var": "off",
"no-control-regex": "off",
- "no-prototype-builtins": "off"
+ "no-prototype-builtins": "off",
+
+ "prefer-const": "error",
+ "no-var": "error"
},
"env": {
- "node": true,
- "browser": true,
- "amd": true
+ "node": true
}
}
diff --git a/.travis.yml b/.travis.yml
index 1c17ffab2b..b041475fca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@ jobs:
script: npm run test:lint
node_js: lts/*
- - stage: minify 🗜️
+ - stage: build 🗜️
script: |
npm run build
if ! git diff --quiet; then
@@ -27,15 +27,15 @@ jobs:
git config --global user.name "Travis-CI"
git config credential.helper "store --file=.git/credentials"
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials
- git commit -am '🗜️ minify [skip ci]'
+ git commit -am '🗜️ build [skip ci]'
git push origin HEAD:${TRAVIS_BRANCH}
fi
node_js: lts/*
if: branch = master AND type = push
- - stage: security scan 🔐
- script: npm run test:redos
- node_js: lts/*
+ # - stage: security scan 🔐
+ # script: npm run test:redos
+ # node_js: lts/*
cache:
directories:
diff --git a/bin/marked b/bin/marked
index 307db173b0..4612fedf23 100755
--- a/bin/marked
+++ b/bin/marked
@@ -5,18 +5,18 @@
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
*/
-var fs = require('fs'),
- path = require('path'),
- marked = require('../');
+const fs = require('fs'),
+ path = require('path'),
+ marked = require('../');
/**
* Man Page
*/
function help() {
- var spawn = require('child_process').spawn;
+ const spawn = require('child_process').spawn;
- var options = {
+ const options = {
cwd: process.cwd(),
env: process.env,
setsid: false,
@@ -33,7 +33,7 @@ function help() {
}
function version() {
- var pkg = require('../package.json');
+ const pkg = require('../package.json');
console.log(pkg.version);
}
@@ -42,17 +42,17 @@ function version() {
*/
function main(argv, callback) {
- var files = [],
- options = {},
- input,
- output,
- string,
- arg,
- tokens,
- opt;
+ const files = [],
+ options = {};
+ let input,
+ output,
+ string,
+ arg,
+ tokens,
+ opt;
function getarg() {
- var arg = argv.shift();
+ let arg = argv.shift();
if (arg.indexOf('--') === 0) {
// e.g. --opt
@@ -162,8 +162,8 @@ function main(argv, callback) {
*/
function getStdin(callback) {
- var stdin = process.stdin,
- buff = '';
+ const stdin = process.stdin;
+ let buff = '';
stdin.setEncoding('utf8');
diff --git a/docs/.eslintrc.json b/docs/.eslintrc.json
new file mode 100644
index 0000000000..6ee10878c6
--- /dev/null
+++ b/docs/.eslintrc.json
@@ -0,0 +1,33 @@
+{
+ "extends": "standard",
+ "plugins": [
+ "standard"
+ ],
+ "parserOptions": {
+ "ecmaVersion": 5,
+ "sourceType": "script"
+ },
+ "rules": {
+ "semi": ["error", "always"],
+ "indent": ["error", 2, {
+ "SwitchCase": 1,
+ "VariableDeclarator": { "var": 2 },
+ "outerIIFEBody": 0
+ }],
+ "operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
+ "space-before-function-paren": ["error", "never"],
+ "no-cond-assign": "off",
+ "no-useless-escape": "off",
+ "one-var": "off",
+ "no-control-regex": "off",
+ "no-prototype-builtins": "off",
+
+ "prefer-const": "off",
+ "no-var": "off"
+ },
+ "env": {
+ "node": true,
+ "browser": true,
+ "amd": true
+ }
+}
diff --git a/docs/AUTHORS.md b/docs/AUTHORS.md
index dd91409568..87ab522f98 100644
--- a/docs/AUTHORS.md
+++ b/docs/AUTHORS.md
@@ -1,6 +1,6 @@
# Authors
-Marked takes an encompassing approach to its community. As such, you can think of these as [concentric circles](https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951), where each group encompases the following groups.
+Marked takes an encompassing approach to its community. As such, you can think of these as [concentric circles](https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951), where each group encompasses the following groups.
@@ -170,7 +170,7 @@ To be removed: You can remove yourself through the [GitHub UI](https://help.gith
A note on volunteering:
1. Please do not volunteer unless you believe you can demonstrate to your peers you can do the work required.
-2. Please do not overcommit yourself; we count on those committed to the project to be responsive. Really consider, with all you have going on, wehther you able to really commit to it.
+2. Please do not overcommit yourself; we count on those committed to the project to be responsive. Really consider, with all you have going on, whether you able to really commit to it.
3. Don't let the previous frighten you away, it can always be changed later by you or your peers.
[Details on badges](#badges)
@@ -227,7 +227,7 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and…dr
Dr. Docs
- Someone who has contributed a great deal to the creation and maintainance of the non-code areas of marked.
+ Someone who has contributed a great deal to the creation and maintenance of the non-code areas of marked.
Eye for the CLI
At this point? Pretty much anyone who can update that `man` file to the current Marked version without regression in the CLI tool itself.
GitHub Guru
@@ -259,9 +259,9 @@ Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and…dr
Defibrillator
- A contributor who stepped up to help bring Marked back to life by contriuting solutions to help Marked pass when compared against the CommonMark and GitHub Flavored Markdown specifications.
+ A contributor who stepped up to help bring Marked back to life by contributing solutions to help Marked pass when compared against the CommonMark and GitHub Flavored Markdown specifications.
Maker of the Marked mark
- This badge is given to the person or oganization credited with creating the logo (or logotype) used in Marked communications for a given period of time. **Maker of the Marked mark from 2017 to present**, for example.
+ This badge is given to the person or organization credited with creating the logo (or logotype) used in Marked communications for a given period of time. **Maker of the Marked mark from 2017 to present**, for example.
Release Wrangler
This is a badge given to all Publishers.
Snyk's Security Saint
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index f5a356804a..f5ec82b6a9 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -5,9 +5,10 @@
- [ ] Make sure you are on the `master` branch.
- [ ] Be sure to run `npm install` or `npm update`.
- [ ] Create a branch.
-- [ ] Make as small a change as possible.
-- [ ] Run `npm test`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
-- [ ] Submit a PR.
+- [ ] Update code in `src` folder. (`lib` folder is for auto compiled code)
+- [ ] Run `npm run test:all`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
+- [ ] Run `npm run build:reset` to remove changes to compiled files.
+- [ ] Submit a Pull Request.
## Design principles
@@ -30,6 +31,7 @@ The following table lists the ticket type labels we use when there is work to be
|RR - refactor and re-engineer |Results in an improvement to developers using Marked (improved readability) or end-users (faster performance) or both. |
|NFS - new feature (spec related) |A capability Marked does not currently provide but is in one of the [supported specifications](#/README.md#specifications) |
|NFU - new feature (user requested) |A capability Marked does not currently provide but has been requested by users of Marked. |
+|NFE - new feature (should be an extension) |A capability Marked does not currently provide and is not part of a spec. |
## Test early, often, and everything
@@ -86,9 +88,8 @@ To check for (and fix) standardized syntax (lint):
npm run lint
```
-To build your own minified version of Marked:
+To build your own es5, esm, and minified versions of Marked:
```bash
npm run build
```
-
diff --git a/docs/PUBLISHING.md b/docs/PUBLISHING.md
index 27937c2f2f..739726674a 100644
--- a/docs/PUBLISHING.md
+++ b/docs/PUBLISHING.md
@@ -7,7 +7,7 @@
## Overall strategy
-**Master is always shippable:** We try to merge PRs in such a way that `master` is the only branch to really be concerned about *and* `master` can always be released. This allows smoother flow between new fetures, bug fixes, and so on. (Almost a continuous deployment setup, without automation.)
+**Master is always shippable:** We try to merge PRs in such a way that `master` is the only branch to really be concerned about *and* `master` can always be released. This allows smoother flow between new features, bug fixes, and so on. (Almost a continuous deployment setup, without automation.)
## Versioning
@@ -20,5 +20,5 @@ We follow [semantic versioning](https://semver.org) where the following sequence
What to expect while Marked is a zero-major (0.x.y):
1. The major will remain at zero; thereby, alerting consumers to the potentially volatile nature of the package.
-2. The minor will tend to be more analagous to a `major` release.
-3. The patch will tend to be more analagous to a `minor` release or a collection of bug fixes (patches).
+2. The minor will tend to be more analogous to a `major` release.
+3. The patch will tend to be more analogous to a `minor` release or a collection of bug fixes (patches).
diff --git a/docs/USING_ADVANCED.md b/docs/USING_ADVANCED.md
index 94e1eb007e..ee8b3126da 100644
--- a/docs/USING_ADVANCED.md
+++ b/docs/USING_ADVANCED.md
@@ -40,7 +40,7 @@ console.log(marked(markdownString));
|Member |Type |Default |Since |Notes |
|:-----------|:---------|:--------|:--------|:-------------|
-|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
+|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
|breaks |`boolean` |`false` |v0.2.7 |If true, add ` ` on a single line break (copies GitHub). Requires `gfm` be `true`.|
|gfm |`boolean` |`true` |v0.2.1 |If true, use approved [GitHub Flavored Markdown (GFM) specification](https://github.github.com/gfm/).|
|headerIds |`boolean` |`true` |v0.4.0 |If true, include an `id` attribute when emitting headings (h1, h2, h3, etc).|
diff --git a/docs/USING_PRO.md b/docs/USING_PRO.md
index d0dd0ee2e9..5e9451bee1 100644
--- a/docs/USING_PRO.md
+++ b/docs/USING_PRO.md
@@ -106,7 +106,7 @@ You also have direct access to the lexer and parser if you so desire.
``` js
const tokens = marked.lexer(text, options);
-console.log(marked.parser(tokens));
+console.log(marked.parser(tokens, options));
```
``` js
diff --git a/lib/marked.esm.js b/lib/marked.esm.js
new file mode 100644
index 0000000000..9d9d14b9c8
--- /dev/null
+++ b/lib/marked.esm.js
@@ -0,0 +1,1808 @@
+/**
+ * marked - a markdown parser
+ * Copyright (c) 2011-2019, Christopher Jeffrey. (MIT Licensed)
+ * https://github.com/markedjs/marked
+ */
+
+/**
+ * DO NOT EDIT THIS FILE
+ * The code in this file is generated from files in ./src/
+ */
+
+let defaults = getDefaults();
+
+function getDefaults() {
+ return {
+ baseUrl: null,
+ breaks: false,
+ gfm: true,
+ headerIds: true,
+ headerPrefix: '',
+ highlight: null,
+ langPrefix: 'language-',
+ mangle: true,
+ pedantic: false,
+ renderer: null,
+ sanitize: false,
+ sanitizer: null,
+ silent: false,
+ smartLists: false,
+ smartypants: false,
+ xhtml: false
+ };
+}
+
+function changeDefaults(newDefaults) {
+ defaults = newDefaults;
+}
+
+var defaults_1 = {
+ defaults,
+ getDefaults,
+ changeDefaults
+};
+
+/**
+ * Helpers
+ */
+function escape(html, encode) {
+ if (encode) {
+ if (escape.escapeTest.test(html)) {
+ return html.replace(escape.escapeReplace, escape.getReplacement);
+ }
+ } else {
+ if (escape.escapeTestNoEncode.test(html)) {
+ return html.replace(escape.escapeReplaceNoEncode, escape.getReplacement);
+ }
+ }
+
+ return html;
+}
+escape.escapeTest = /[&<>"']/;
+escape.escapeReplace = /[&<>"']/g;
+escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
+escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
+escape.replacements = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+};
+escape.getReplacement = (ch) => escape.replacements[ch];
+
+function unescape(html) {
+ // explicitly match decimal, hex, and named HTML entities
+ return html.replace(unescape.unescapeTest, (_, n) => {
+ n = n.toLowerCase();
+ if (n === 'colon') return ':';
+ if (n.charAt(0) === '#') {
+ return n.charAt(1) === 'x'
+ ? String.fromCharCode(parseInt(n.substring(2), 16))
+ : String.fromCharCode(+n.substring(1));
+ }
+ return '';
+ });
+}
+unescape.unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
+
+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');
+ regex = regex.replace(name, val);
+ return obj;
+ },
+ getRegex: () => {
+ return new RegExp(regex, opt);
+ }
+ };
+ return obj;
+}
+edit.caret = /(^|[^\[])\^/g;
+
+function cleanUrl(sanitize, base, href) {
+ if (sanitize) {
+ let prot;
+ try {
+ prot = decodeURIComponent(unescape(href))
+ .replace(cleanUrl.protocol, '')
+ .toLowerCase();
+ } catch (e) {
+ return null;
+ }
+ if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
+ return null;
+ }
+ }
+ if (base && !cleanUrl.originIndependentUrl.test(href)) {
+ href = resolveUrl(base, href);
+ }
+ try {
+ href = encodeURI(href).replace(/%25/g, '%');
+ } catch (e) {
+ return null;
+ }
+ return href;
+}
+cleanUrl.protocol = /[^\w:]/g;
+cleanUrl.originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
+
+function resolveUrl(base, href) {
+ if (!resolveUrl.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 + '/';
+ } else {
+ resolveUrl.baseUrls[' ' + base] = rtrim(base, '/', true);
+ }
+ }
+ base = resolveUrl.baseUrls[' ' + base];
+ const relativeBase = base.indexOf(':') === -1;
+
+ if (href.substring(0, 2) === '//') {
+ if (relativeBase) {
+ return href;
+ }
+ return base.replace(resolveUrl.protocol, '$1') + href;
+ } else if (href.charAt(0) === '/') {
+ if (relativeBase) {
+ return href;
+ }
+ return base.replace(resolveUrl.domain, '$1') + href;
+ } else {
+ return base + href;
+ }
+}
+resolveUrl.baseUrls = {};
+resolveUrl.justDomain = /^[^:]+:\/*[^/]*$/;
+resolveUrl.protocol = /^([^:]+:)[\s\S]*$/;
+resolveUrl.domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
+
+function noop() {}
+noop.exec = noop;
+
+function merge(obj) {
+ let i = 1,
+ target,
+ key;
+
+ for (; i < arguments.length; i++) {
+ target = arguments[i];
+ for (key in target) {
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
+ obj[key] = target[key];
+ }
+ }
+ }
+
+ return obj;
+}
+
+function splitCells(tableRow, count) {
+ // ensure that every cell-delimiting pipe has a space
+ // before it to distinguish it from an escaped pipe
+ const row = tableRow.replace(/\|/g, (match, offset, str) => {
+ let escaped = false,
+ curr = offset;
+ while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
+ if (escaped) {
+ // odd number of slashes means | is escaped
+ // so we leave it alone
+ return '|';
+ } else {
+ // add space before unescaped |
+ return ' |';
+ }
+ }),
+ cells = row.split(/ \|/);
+ let i = 0;
+
+ if (cells.length > count) {
+ cells.splice(count);
+ } else {
+ while (cells.length < count) cells.push('');
+ }
+
+ for (; i < cells.length; i++) {
+ // leading or trailing whitespace is ignored per the gfm spec
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
+ }
+ return cells;
+}
+
+// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
+// /c*$/ is vulnerable to REDOS.
+// invert: Remove suffix of non-c chars instead. Default falsey.
+function rtrim(str, c, invert) {
+ const l = str.length;
+ if (l === 0) {
+ return '';
+ }
+
+ // Length of suffix matching the invert condition.
+ let suffLen = 0;
+
+ // Step left until we fail to match the invert condition.
+ while (suffLen < l) {
+ const currChar = str.charAt(l - suffLen - 1);
+ if (currChar === c && !invert) {
+ suffLen++;
+ } else if (currChar !== c && invert) {
+ suffLen++;
+ } else {
+ break;
+ }
+ }
+
+ return str.substr(0, l - suffLen);
+}
+
+function findClosingBracket(str, b) {
+ if (str.indexOf(b[1]) === -1) {
+ return -1;
+ }
+ const l = str.length;
+ let level = 0,
+ i = 0;
+ for (; i < l; i++) {
+ if (str[i] === '\\') {
+ i++;
+ } else if (str[i] === b[0]) {
+ level++;
+ } else if (str[i] === b[1]) {
+ level--;
+ if (level < 0) {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+function checkSanitizeDeprecation(opt) {
+ if (opt && opt.sanitize && !opt.silent) {
+ console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
+ }
+}
+
+var helpers = {
+ escape,
+ unescape,
+ edit,
+ cleanUrl,
+ resolveUrl,
+ noop,
+ merge,
+ splitCells,
+ rtrim,
+ findClosingBracket,
+ checkSanitizeDeprecation
+};
+
+const {
+ noop: noop$1,
+ edit: edit$1,
+ merge: merge$1
+} = helpers;
+
+/**
+ * Block-Level Grammar
+ */
+const block = {
+ newline: /^\n+/,
+ code: /^( {4}[^\n]+\n*)+/,
+ fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
+ hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
+ heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
+ list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
+ html: '^ {0,3}(?:' // optional indentation
+ + '<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)' // (1)
+ + '|comment[^\\n]*(\\n+|$)' // (2)
+ + '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
+ + '|\\n*' // (4)
+ + '|\\n*' // (5)
+ + '|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ + '|(?!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,
+ 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]+)*)/,
+ text: /^[^\n]+/
+};
+
+block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
+block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
+block.def = edit$1(block.def)
+ .replace('label', block._label)
+ .replace('title', block._title)
+ .getRegex();
+
+block.bullet = /(?:[*+-]|\d{1,9}\.)/;
+block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
+block.item = edit$1(block.item, 'gm')
+ .replace(/bull/g, block.bullet)
+ .getRegex();
+
+block.list = edit$1(block.list)
+ .replace(/bull/g, block.bullet)
+ .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
+ .replace('def', '\\n+(?=' + block.def.source + ')')
+ .getRegex();
+
+block._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';
+block._comment = //;
+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();
+
+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
+ .replace('blockquote', ' {0,3}>')
+ .replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n')
+ .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
+ .replace('html', '?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
+ .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
+ .getRegex();
+
+block.blockquote = edit$1(block.blockquote)
+ .replace('paragraph', block.paragraph)
+ .getRegex();
+
+/**
+ * Normal Block Grammar
+ */
+
+block.normal = merge$1({}, block);
+
+/**
+ * GFM Block Grammar
+ */
+
+block.gfm = merge$1({}, block.normal, {
+ nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
+ table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
+});
+
+/**
+ * Pedantic grammar (original John Gruber's loose markdown specification)
+ */
+
+block.pedantic = merge$1({}, block.normal, {
+ html: edit$1(
+ '^ *(?:comment *(?:\\n|\\s*$)'
+ + '|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)' // closed tag
+ + '| \\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
+ .replace('comment', block._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: noop$1, // fences not supported
+ paragraph: edit$1(block.normal._paragraph)
+ .replace('hr', block.hr)
+ .replace('heading', ' *#{1,6} *[^\n]')
+ .replace('lheading', block.lheading)
+ .replace('blockquote', ' {0,3}>')
+ .replace('|fences', '')
+ .replace('|list', '')
+ .replace('|html', '')
+ .getRegex()
+});
+
+/**
+ * Inline-Level Grammar
+ */
+const inline = {
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
+ url: noop$1,
+ tag: '^comment'
+ + '|^[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g.
+ + '|^' // declaration, e.g.
+ + '|^', // CDATA section
+ 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: noop$1,
+ text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~';
+inline.em = edit$1(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
+
+inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
+
+inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
+inline._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])?)+(?![-_])/;
+inline.autolink = edit$1(inline.autolink)
+ .replace('scheme', inline._scheme)
+ .replace('email', inline._email)
+ .getRegex();
+
+inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
+
+inline.tag = edit$1(inline.tag)
+ .replace('comment', block._comment)
+ .replace('attribute', inline._attribute)
+ .getRegex();
+
+inline._label = /(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
+inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;
+inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
+
+inline.link = edit$1(inline.link)
+ .replace('label', inline._label)
+ .replace('href', inline._href)
+ .replace('title', inline._title)
+ .getRegex();
+
+inline.reflink = edit$1(inline.reflink)
+ .replace('label', inline._label)
+ .getRegex();
+
+/**
+ * Normal Inline Grammar
+ */
+
+inline.normal = merge$1({}, inline);
+
+/**
+ * Pedantic Inline Grammar
+ */
+
+inline.pedantic = merge$1({}, inline.normal, {
+ strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
+ em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
+ link: edit$1(/^!?\[(label)\]\((.*?)\)/)
+ .replace('label', inline._label)
+ .getRegex(),
+ reflink: edit$1(/^!?\[(label)\]\s*\[([^\]]*)\]/)
+ .replace('label', inline._label)
+ .getRegex()
+});
+
+/**
+ * GFM Inline Grammar
+ */
+
+inline.gfm = merge$1({}, inline.normal, {
+ escape: edit$1(inline.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]*?(?:(?=[\\ 1) {
+ this.tokens.push({
+ type: 'space'
+ });
+ }
+ }
+
+ // code
+ if (cap = this.rules.code.exec(src)) {
+ const lastToken = this.tokens[this.tokens.length - 1];
+ src = src.substring(cap[0].length);
+ // An indented code block cannot interrupt a paragraph.
+ 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
+ });
+ }
+ 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 (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);
+ }
+
+ 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
+ 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.
+ 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.
+ 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.
+ if (i !== l - 1) {
+ b = block$1.bullet.exec(cap[i + 1])[0];
+ 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.
+ loose = next || /\n\n(?!\s*$)/.test(item);
+ if (i !== l - 1) {
+ next = item.charAt(item.length - 1) === '\n';
+ if (!loose) loose = next;
+ }
+
+ if (loose) {
+ listStart.loose = true;
+ }
+
+ // Check for task list items
+ istask = /^\[[ xX]\] /.test(item);
+ ischecked = undefined;
+ if (istask) {
+ ischecked = item[1] !== ' ';
+ item = item.replace(/^\[[ xX]\] +/, '');
+ }
+
+ 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;
+ for (; i < l; i++) {
+ listItems[i].loose = true;
+ }
+ }
+
+ 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]
+ };
+ }
+ 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') : []
+ };
+
+ 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);
+ }
+
+ this.tokens.push(item);
+
+ continue;
+ }
+ }
+
+ // 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;
+ }
+
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
+
+ return this.tokens;
+ };
+};
+
+const { defaults: defaults$2 } = defaults_1;
+const {
+ cleanUrl: cleanUrl$1,
+ escape: escape$2
+} = helpers;
+
+/**
+ * Renderer
+ */
+var Renderer_1 = class Renderer {
+ constructor(options) {
+ this.options = options || defaults$2;
+ }
+
+ code(code, infostring, escaped) {
+ const lang = (infostring || '').match(/\S*/)[0];
+ if (this.options.highlight) {
+ const out = this.options.highlight(code, lang);
+ if (out != null && out !== code) {
+ escaped = true;
+ code = out;
+ }
+ }
+
+ if (!lang) {
+ return ''
+ + (escaped ? code : escape$2(code, true))
+ + '
';
+ }
+
+ return ''
+ + (escaped ? code : escape$2(code, true))
+ + '
\n';
+ };
+
+ blockquote(quote) {
+ return '\n' + quote + ' \n';
+ };
+
+ html(html) {
+ return html;
+ };
+
+ heading(text, level, raw, slugger) {
+ if (this.options.headerIds) {
+ return '\n';
+ }
+ // ignore IDs
+ return '' + text + ' \n';
+ };
+
+ hr() {
+ return this.options.xhtml ? ' \n' : ' \n';
+ };
+
+ list(body, ordered, start) {
+ const type = ordered ? 'ol' : 'ul',
+ startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
+ return '<' + type + startatt + '>\n' + body + '' + type + '>\n';
+ };
+
+ listitem(text) {
+ return ' ' + text + ' \n';
+ };
+
+ checkbox(checked) {
+ return ' ';
+ };
+
+ paragraph(text) {
+ return '' + text + '
\n';
+ };
+
+ table(header, body) {
+ if (body) body = ' ' + body + ' ';
+
+ return '\n'
+ + '\n'
+ + header
+ + ' \n'
+ + body
+ + '
\n';
+ };
+
+ tablerow(content) {
+ return '\n' + content + ' \n';
+ };
+
+ tablecell(content, flags) {
+ const type = flags.header ? 'th' : 'td';
+ const tag = flags.align
+ ? '<' + type + ' align="' + flags.align + '">'
+ : '<' + type + '>';
+ return tag + content + '' + type + '>\n';
+ };
+
+ // span level renderer
+ strong(text) {
+ return '' + text + ' ';
+ };
+
+ em(text) {
+ return '' + text + ' ';
+ };
+
+ codespan(text) {
+ return '' + text + '
';
+ };
+
+ br() {
+ return this.options.xhtml ? ' ' : ' ';
+ };
+
+ del(text) {
+ return '' + text + '';
+ };
+
+ link(href, title, text) {
+ href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text;
+ }
+ let out = '' + text + ' ';
+ return out;
+ };
+
+ image(href, title, text) {
+ href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text;
+ }
+
+ let out = ' ' : '>';
+ return out;
+ };
+
+ text(text) {
+ return text;
+ };
+};
+
+/**
+ * Slugger generates header id
+ */
+var Slugger_1 = class Slugger {
+ constructor() {
+ this.seen = {};
+ }
+
+ /**
+ * Convert string to unique id
+ */
+ slug(value) {
+ let slug = value
+ .toLowerCase()
+ .trim()
+ .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
+ .replace(/\s/g, '-');
+
+ if (this.seen.hasOwnProperty(slug)) {
+ const originalSlug = slug;
+ do {
+ this.seen[originalSlug]++;
+ slug = originalSlug + '-' + this.seen[originalSlug];
+ } while (this.seen.hasOwnProperty(slug));
+ }
+ this.seen[slug] = 0;
+
+ return slug;
+ };
+};
+
+const { defaults: defaults$3 } = defaults_1;
+const { inline: inline$1 } = rules;
+const {
+ findClosingBracket: findClosingBracket$1,
+ escape: escape$3
+} = helpers;
+
+/**
+ * Inline Lexer & Compiler
+ */
+var InlineLexer_1 = class InlineLexer {
+ constructor(links, options) {
+ this.options = options || defaults$3;
+ this.links = links;
+ this.rules = inline$1.normal;
+ this.options.renderer = this.options.renderer || new Renderer_1();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+
+ if (!this.links) {
+ throw new Error('Tokens array requires a `links` property.');
+ }
+
+ if (this.options.pedantic) {
+ this.rules = inline$1.pedantic;
+ } else if (this.options.gfm) {
+ if (this.options.breaks) {
+ this.rules = inline$1.breaks;
+ } else {
+ this.rules = inline$1.gfm;
+ }
+ }
+ }
+
+ /**
+ * Expose Inline Rules
+ */
+ static get rules() {
+ return inline$1;
+ }
+
+ /**
+ * Static Lexing/Compiling Method
+ */
+ static output(src, links, options) {
+ const inline = new InlineLexer(links, options);
+ return inline.output(src);
+ }
+
+ /**
+ * Lexing/Compiling
+ */
+ output(src) {
+ let 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;
+ }
+
+ 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)) {
+ const lastParenIndex = findClosingBracket$1(cap[2], '()');
+ if (lastParenIndex > -1) {
+ const start = cap[0].indexOf('!') === 0 ? 5 : 4;
+ const 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 (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) : '';
+ }
+ 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 ((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;
+ }
+ this.inLink = true;
+ out += this.outputLink(cap, link);
+ this.inLink = false;
+ continue;
+ }
+
+ // strong
+ 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.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.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.br.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.br();
+ continue;
+ }
+
+ // del (gfm)
+ 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.autolink.exec(src)) {
+ src = src.substring(cap[0].length);
+ 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 (!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 {
+ href = text;
+ }
+ }
+ src = src.substring(cap[0].length);
+ out += this.renderer.link(href, null, text);
+ continue;
+ }
+
+ // text
+ if (cap = this.rules.text.exec(src)) {
+ src = src.substring(cap[0].length);
+ 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])));
+ }
+ continue;
+ }
+
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
+
+ return out;
+ }
+
+ static escapes(text) {
+ return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
+ }
+
+ /**
+ * Compile Link
+ */
+ outputLink(cap, link) {
+ const 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
+ */
+ 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
+ */
+ mangle(text) {
+ if (!this.options.mangle) return text;
+ const l = text.length;
+ let 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;
+ }
+};
+
+/**
+ * TextRenderer
+ * returns only the textual part of the token
+ */
+var TextRenderer_1 = class TextRenderer {
+ // no need for block level renderers
+ strong(text) {
+ return text;
+ }
+
+ em(text) {
+ return text;
+ }
+
+ codespan(text) {
+ return text;
+ }
+
+ del(text) {
+ return text;
+ }
+
+ text(text) {
+ return text;
+ }
+
+ link(href, title, text) {
+ return '' + text;
+ }
+
+ image(href, title, text) {
+ return '' + text;
+ }
+
+ br() {
+ return '';
+ }
+};
+
+const { defaults: defaults$4 } = defaults_1;
+const {
+ merge: merge$2,
+ unescape: unescape$1
+} = helpers;
+
+/**
+ * Parsing & Compiling
+ */
+var Parser_1 = class Parser {
+ constructor(options) {
+ this.tokens = [];
+ this.token = null;
+ this.options = options || defaults$4;
+ this.options.renderer = this.options.renderer || new Renderer_1();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+ this.slugger = new Slugger_1();
+ }
+
+ /**
+ * Static Parse Method
+ */
+ static parse(tokens, options) {
+ const parser = new Parser(options);
+ return parser.parse(tokens);
+ };
+
+ /**
+ * Parse Loop
+ */
+ parse(tokens) {
+ this.inline = new InlineLexer_1(tokens.links, this.options);
+ // use an InlineLexer with a TextRenderer to extract pure text
+ this.inlineText = new InlineLexer_1(
+ tokens.links,
+ merge$2({}, this.options, { renderer: new TextRenderer_1() })
+ );
+ this.tokens = tokens.reverse();
+
+ let out = '';
+ while (this.next()) {
+ out += this.tok();
+ }
+
+ return out;
+ };
+
+ /**
+ * Next Token
+ */
+ next() {
+ this.token = this.tokens.pop();
+ return this.token;
+ };
+
+ /**
+ * Preview Next Token
+ */
+ peek() {
+ return this.tokens[this.tokens.length - 1] || 0;
+ };
+
+ /**
+ * Parse Text Tokens
+ */
+ parseText() {
+ let body = this.token.text;
+
+ while (this.peek().type === 'text') {
+ body += '\n' + this.next().text;
+ }
+
+ return this.inline.output(body);
+ };
+
+ /**
+ * Parse Current Token
+ */
+ tok() {
+ let body = '';
+ switch (this.token.type) {
+ case 'space': {
+ return '';
+ }
+ case 'hr': {
+ return this.renderer.hr();
+ }
+ 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);
+ }
+ case 'code': {
+ return this.renderer.code(this.token.text,
+ this.token.lang,
+ this.token.escaped);
+ }
+ case 'table': {
+ let header = '',
+ i,
+ row,
+ cell,
+ j;
+
+ // header
+ cell = '';
+ 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);
+
+ 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] }
+ );
+ }
+
+ body += this.renderer.tablerow(cell);
+ }
+ return this.renderer.table(header, body);
+ }
+ case 'blockquote_start': {
+ body = '';
+
+ while (this.next().type !== 'blockquote_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.blockquote(body);
+ }
+ case 'list_start': {
+ body = '';
+ const ordered = this.token.ordered,
+ start = this.token.start;
+
+ while (this.next().type !== 'list_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.list(body, ordered, start);
+ }
+ case 'list_item_start': {
+ body = '';
+ const loose = this.token.loose;
+ const checked = this.token.checked;
+ const task = this.token.task;
+
+ if (this.token.task) {
+ if (loose) {
+ if (this.peek().type === 'text') {
+ const nextToken = this.peek();
+ nextToken.text = this.renderer.checkbox(checked) + ' ' + nextToken.text;
+ } else {
+ 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);
+ }
+ case 'paragraph': {
+ return this.renderer.paragraph(this.inline.output(this.token.text));
+ }
+ case 'text': {
+ return this.renderer.paragraph(this.parseText());
+ }
+ default: {
+ const errMsg = 'Token with "' + this.token.type + '" type was not found.';
+ if (this.options.silent) {
+ console.log(errMsg);
+ } else {
+ throw new Error(errMsg);
+ }
+ }
+ }
+ };
+};
+
+const {
+ merge: merge$3,
+ checkSanitizeDeprecation: checkSanitizeDeprecation$1,
+ escape: escape$4
+} = helpers;
+const {
+ getDefaults: getDefaults$1,
+ changeDefaults: changeDefaults$1,
+ defaults: defaults$5
+} = defaults_1;
+
+/**
+ * Marked
+ */
+function marked(src, opt, callback) {
+ // throw error in case of non string input
+ if (typeof src === 'undefined' || src === null) {
+ throw new Error('marked(): input parameter is undefined or null');
+ }
+ if (typeof src !== 'string') {
+ throw new Error('marked(): input parameter is of type '
+ + Object.prototype.toString.call(src) + ', string expected');
+ }
+
+ if (callback || typeof opt === 'function') {
+ if (!callback) {
+ callback = opt;
+ opt = null;
+ }
+
+ opt = merge$3({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation$1(opt);
+ const highlight = opt.highlight;
+ let tokens,
+ pending,
+ i = 0;
+
+ try {
+ tokens = Lexer_1.lex(src, opt);
+ } catch (e) {
+ return callback(e);
+ }
+
+ pending = tokens.length;
+
+ const done = function(err) {
+ if (err) {
+ opt.highlight = highlight;
+ return callback(err);
+ }
+
+ let out;
+
+ try {
+ out = Parser_1.parse(tokens, opt);
+ } catch (e) {
+ err = e;
+ }
+
+ opt.highlight = highlight;
+
+ return err
+ ? callback(err)
+ : callback(null, out);
+ };
+
+ if (!highlight || highlight.length < 3) {
+ return done();
+ }
+
+ delete opt.highlight;
+
+ if (!pending) return done();
+
+ for (; i < tokens.length; i++) {
+ (function(token) {
+ if (token.type !== 'code') {
+ return --pending || done();
+ }
+ return highlight(token.text, token.lang, function(err, code) {
+ if (err) return done(err);
+ if (code == null || code === token.text) {
+ return --pending || done();
+ }
+ token.text = code;
+ token.escaped = true;
+ --pending || done();
+ });
+ })(tokens[i]);
+ }
+
+ return;
+ }
+ try {
+ opt = merge$3({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation$1(opt);
+ return Parser_1.parse(Lexer_1.lex(src, opt), opt);
+ } catch (e) {
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
+ if ((opt || marked.defaults).silent) {
+ return 'An error occurred:
'
+ + escape$4(e.message + '', true)
+ + ' ';
+ }
+ throw e;
+ }
+}
+
+/**
+ * Options
+ */
+
+marked.options =
+marked.setOptions = function(opt) {
+ merge$3(marked.defaults, opt);
+ changeDefaults$1(marked.defaults);
+ return marked;
+};
+
+marked.getDefaults = getDefaults$1;
+
+marked.defaults = defaults$5;
+
+/**
+ * Expose
+ */
+
+marked.Parser = Parser_1;
+marked.parser = Parser_1.parse;
+
+marked.Renderer = Renderer_1;
+marked.TextRenderer = TextRenderer_1;
+
+marked.Lexer = Lexer_1;
+marked.lexer = Lexer_1.lex;
+
+marked.InlineLexer = InlineLexer_1;
+marked.inlineLexer = InlineLexer_1.output;
+
+marked.Slugger = Slugger_1;
+
+marked.parse = marked;
+
+var marked_1 = marked;
+
+export default marked_1;
diff --git a/lib/marked.js b/lib/marked.js
index 773341f48a..2181f3c9e2 100644
--- a/lib/marked.js
+++ b/lib/marked.js
@@ -1,1722 +1,1858 @@
/**
* marked - a markdown parser
- * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
+ * Copyright (c) 2011-2019, Christopher Jeffrey. (MIT Licensed)
* https://github.com/markedjs/marked
*/
-;(function(root) {
-'use strict';
-
/**
- * Block-Level Grammar
+ * DO NOT EDIT THIS FILE
+ * The code in this file is generated from files in ./src/
*/
-var block = {
- newline: /^\n+/,
- code: /^( {4}[^\n]+\n*)+/,
- fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
- hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
- heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
- blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
- list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
- html: '^ {0,3}(?:' // optional indentation
- + '<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)' // (1)
- + '|comment[^\\n]*(\\n+|$)' // (2)
- + '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
- + '|\\n*' // (4)
- + '|\\n*' // (5)
- + '|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
- + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
- + '|(?!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,
- table: noop,
- 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]+)*)/,
- text: /^[^\n]+/
-};
-
-block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
-block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
-block.def = edit(block.def)
- .replace('label', block._label)
- .replace('title', block._title)
- .getRegex();
-
-block.bullet = /(?:[*+-]|\d{1,9}\.)/;
-block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
-block.item = edit(block.item, 'gm')
- .replace(/bull/g, block.bullet)
- .getRegex();
-
-block.list = edit(block.list)
- .replace(/bull/g, block.bullet)
- .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
- .replace('def', '\\n+(?=' + block.def.source + ')')
- .getRegex();
-
-block._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';
-block._comment = //;
-block.html = edit(block.html, 'i')
- .replace('comment', block._comment)
- .replace('tag', block._tag)
- .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
- .getRegex();
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = global || self, global.marked = factory());
+}(this, (function () { 'use strict';
-block.paragraph = edit(block._paragraph)
- .replace('hr', block.hr)
- .replace('heading', ' {0,3}#{1,6} +')
- .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
- .replace('blockquote', ' {0,3}>')
- .replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n')
- .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
- .replace('html', '?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
- .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
- .getRegex();
-
-block.blockquote = edit(block.blockquote)
- .replace('paragraph', block.paragraph)
- .getRegex();
+ 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;
+ };
+ }
-/**
- * Normal Block Grammar
- */
+ return _typeof(obj);
+ }
-block.normal = merge({}, block);
+ function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+ }
-/**
- * GFM Block Grammar
- */
+ function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
-block.gfm = merge({}, block.normal, {
- nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
- table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
-});
+ function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+ }
-/**
- * Pedantic grammar (original John Gruber's loose markdown specification)
- */
+ var defaults = getDefaults();
+
+ function getDefaults() {
+ return {
+ baseUrl: null,
+ breaks: false,
+ gfm: true,
+ headerIds: true,
+ headerPrefix: '',
+ highlight: null,
+ langPrefix: 'language-',
+ mangle: true,
+ pedantic: false,
+ renderer: null,
+ sanitize: false,
+ sanitizer: null,
+ silent: false,
+ smartLists: false,
+ smartypants: false,
+ xhtml: false
+ };
+ }
-block.pedantic = merge({}, block.normal, {
- html: edit(
- '^ *(?:comment *(?:\\n|\\s*$)'
- + '|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)' // closed tag
- + '| \\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
- .replace('comment', block._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: noop, // fences not supported
- paragraph: edit(block.normal._paragraph)
- .replace('hr', block.hr)
- .replace('heading', ' *#{1,6} *[^\n]')
- .replace('lheading', block.lheading)
- .replace('blockquote', ' {0,3}>')
- .replace('|fences', '')
- .replace('|list', '')
- .replace('|html', '')
- .getRegex()
-});
+ function changeDefaults(newDefaults) {
+ defaults = newDefaults;
+ }
-/**
- * Block Lexer
- */
+ var defaults_1 = {
+ defaults: defaults,
+ getDefaults: getDefaults,
+ changeDefaults: changeDefaults
+ };
-function Lexer(options) {
- this.tokens = [];
- this.tokens.links = Object.create(null);
- this.options = options || marked.defaults;
- this.rules = block.normal;
+ /**
+ * Helpers
+ */
+ function escape(html, encode) {
+ if (encode) {
+ if (escape.escapeTest.test(html)) {
+ return html.replace(escape.escapeReplace, escape.getReplacement);
+ }
+ } else {
+ if (escape.escapeTestNoEncode.test(html)) {
+ return html.replace(escape.escapeReplaceNoEncode, escape.getReplacement);
+ }
+ }
- if (this.options.pedantic) {
- this.rules = block.pedantic;
- } else if (this.options.gfm) {
- this.rules = block.gfm;
+ return html;
}
-}
-/**
- * Expose Block Rules
- */
+ escape.escapeTest = /[&<>"']/;
+ escape.escapeReplace = /[&<>"']/g;
+ escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
+ escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
+ escape.replacements = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ };
-Lexer.rules = block;
+ escape.getReplacement = function (ch) {
+ return escape.replacements[ch];
+ };
-/**
- * Static Lex Method
- */
+ function unescape(html) {
+ // explicitly match decimal, hex, and named HTML entities
+ return html.replace(unescape.unescapeTest, function (_, n) {
+ n = n.toLowerCase();
+ if (n === 'colon') return ':';
-Lexer.lex = function(src, options) {
- var lexer = new Lexer(options);
- return lexer.lex(src);
-};
+ if (n.charAt(0) === '#') {
+ return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
+ }
-/**
- * Preprocessing
- */
+ return '';
+ });
+ }
-Lexer.prototype.lex = function(src) {
- src = src
- .replace(/\r\n|\r/g, '\n')
- .replace(/\t/g, ' ');
+ unescape.unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
+
+ function edit(regex, opt) {
+ regex = regex.source || regex;
+ opt = opt || '';
+ var obj = {
+ replace: function replace(name, val) {
+ val = val.source || val;
+ val = val.replace(edit.caret, '$1');
+ regex = regex.replace(name, val);
+ return obj;
+ },
+ getRegex: function getRegex() {
+ return new RegExp(regex, opt);
+ }
+ };
+ return obj;
+ }
- return this.token(src, true);
-};
+ edit.caret = /(^|[^\[])\^/g;
-/**
- * Lexing
- */
+ function cleanUrl(sanitize, base, href) {
+ if (sanitize) {
+ var prot;
-Lexer.prototype.token = function(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);
- if (cap[0].length > 1) {
- this.tokens.push({
- type: 'space'
- });
+ try {
+ prot = decodeURIComponent(unescape(href)).replace(cleanUrl.protocol, '').toLowerCase();
+ } catch (e) {
+ return null;
}
- }
- // code
- 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 (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(cap, '\n')
- : cap
- });
- }
- continue;
+ if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
+ return null;
+ }
}
- // 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;
+ if (base && !cleanUrl.originIndependentUrl.test(href)) {
+ href = resolveUrl(base, href);
}
- // 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;
+ try {
+ href = encodeURI(href).replace(/%25/g, '%');
+ } catch (e) {
+ return null;
}
- // table no leading pipe (gfm)
- if (cap = this.rules.nptable.exec(src)) {
- item = {
- type: 'table',
- header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
- };
+ return href;
+ }
- 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;
- }
- }
+ cleanUrl.protocol = /[^\w:]/g;
+ cleanUrl.originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = splitCells(item.cells[i], item.header.length);
- }
+ function resolveUrl(base, href) {
+ if (!resolveUrl.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 + '/';
+ } else {
+ resolveUrl.baseUrls[' ' + base] = rtrim(base, '/', true);
+ }
+ }
- this.tokens.push(item);
+ base = resolveUrl.baseUrls[' ' + base];
+ var relativeBase = base.indexOf(':') === -1;
- continue;
+ if (href.substring(0, 2) === '//') {
+ if (relativeBase) {
+ return href;
}
- }
- // hr
- if (cap = this.rules.hr.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'hr'
- });
- continue;
+ return base.replace(resolveUrl.protocol, '$1') + href;
+ } else if (href.charAt(0) === '/') {
+ if (relativeBase) {
+ return href;
+ }
+
+ return base.replace(resolveUrl.domain, '$1') + href;
+ } else {
+ return base + href;
}
+ }
- // blockquote
- if (cap = this.rules.blockquote.exec(src)) {
- src = src.substring(cap[0].length);
+ resolveUrl.baseUrls = {};
+ resolveUrl.justDomain = /^[^:]+:\/*[^/]*$/;
+ resolveUrl.protocol = /^([^:]+:)[\s\S]*$/;
+ resolveUrl.domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
- this.tokens.push({
- type: 'blockquote_start'
- });
+ function noop() {}
- cap = cap[0].replace(/^ *> ?/gm, '');
+ noop.exec = noop;
- // Pass `top` to keep the current
- // "toplevel" state. This is exactly
- // how markdown.pl works.
- this.token(cap, top);
+ function merge(obj) {
+ var i = 1,
+ target,
+ key;
- this.tokens.push({
- type: 'blockquote_end'
- });
+ for (; i < arguments.length; i++) {
+ target = arguments[i];
- continue;
+ for (key in target) {
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
+ obj[key] = target[key];
+ }
+ }
}
- // 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);
+ return obj;
+ }
- listItems = [];
- next = false;
- l = cap.length;
- i = 0;
+ function splitCells(tableRow, count) {
+ // ensure that every cell-delimiting pipe has a space
+ // before it to distinguish it from an escaped pipe
+ var row = tableRow.replace(/\|/g, function (match, offset, str) {
+ var escaped = false,
+ curr = offset;
- for (; i < l; i++) {
- item = cap[i];
+ while (--curr >= 0 && str[curr] === '\\') {
+ escaped = !escaped;
+ }
- // Remove the list item's bullet
- // so it is seen as the next token.
- space = item.length;
- item = item.replace(/^ *([*+-]|\d+\.) */, '');
+ if (escaped) {
+ // odd number of slashes means | is escaped
+ // so we leave it alone
+ return '|';
+ } else {
+ // add space before unescaped |
+ return ' |';
+ }
+ }),
+ cells = row.split(/ \|/);
+ var i = 0;
- // Outdent whatever the
- // list item contains. Hacky.
- if (~item.indexOf('\n ')) {
- space -= item.length;
- item = !this.options.pedantic
- ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
- : item.replace(/^ {1,4}/gm, '');
- }
+ if (cells.length > count) {
+ cells.splice(count);
+ } else {
+ while (cells.length < count) {
+ cells.push('');
+ }
+ }
- // Determine whether the next list item belongs here.
- // Backpedal if it does not belong in this list.
- if (i !== l - 1) {
- b = block.bullet.exec(cap[i + 1])[0];
- 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;
- }
- }
+ for (; i < cells.length; i++) {
+ // leading or trailing whitespace is ignored per the gfm spec
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
+ }
- // Determine whether item is loose or not.
- // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
- // for discount behavior.
- loose = next || /\n\n(?!\s*$)/.test(item);
- if (i !== l - 1) {
- next = item.charAt(item.length - 1) === '\n';
- if (!loose) loose = next;
- }
+ return cells;
+ } // Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
+ // /c*$/ is vulnerable to REDOS.
+ // invert: Remove suffix of non-c chars instead. Default falsey.
- if (loose) {
- listStart.loose = true;
- }
- // Check for task list items
- istask = /^\[[ xX]\] /.test(item);
- ischecked = undefined;
- if (istask) {
- ischecked = item[1] !== ' ';
- item = item.replace(/^\[[ xX]\] +/, '');
- }
+ function rtrim(str, c, invert) {
+ var l = str.length;
- t = {
- type: 'list_item_start',
- task: istask,
- checked: ischecked,
- loose: loose
- };
+ if (l === 0) {
+ return '';
+ } // Length of suffix matching the invert condition.
- listItems.push(t);
- this.tokens.push(t);
- // Recurse.
- this.token(item, false);
+ var suffLen = 0; // Step left until we fail to match the invert condition.
- this.tokens.push({
- type: 'list_item_end'
- });
- }
+ while (suffLen < l) {
+ var currChar = str.charAt(l - suffLen - 1);
- if (listStart.loose) {
- l = listItems.length;
- i = 0;
- for (; i < l; i++) {
- listItems[i].loose = true;
- }
+ if (currChar === c && !invert) {
+ suffLen++;
+ } else if (currChar !== c && invert) {
+ suffLen++;
+ } else {
+ break;
}
-
- 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(cap[0])) : cap[0]
- });
- continue;
- }
+ return str.substr(0, l - suffLen);
+ }
- // 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]
- };
- }
- continue;
+ function findClosingBracket(str, b) {
+ if (str.indexOf(b[1]) === -1) {
+ return -1;
}
- // table (gfm)
- if (cap = this.rules.table.exec(src)) {
- item = {
- type: 'table',
- header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
- };
+ var l = str.length;
+ var level = 0,
+ i = 0;
- 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 < l; i++) {
+ if (str[i] === '\\') {
+ i++;
+ } else if (str[i] === b[0]) {
+ level++;
+ } else if (str[i] === b[1]) {
+ level--;
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = splitCells(
- item.cells[i].replace(/^ *\| *| *\| *$/g, ''),
- item.header.length);
+ if (level < 0) {
+ return i;
}
-
- this.tokens.push(item);
-
- continue;
}
}
- // 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 -1;
+ }
- if (src) {
- throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ function checkSanitizeDeprecation(opt) {
+ if (opt && opt.sanitize && !opt.silent) {
+ console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
}
}
- return this.tokens;
-};
-
-/**
- * Inline-Level Grammar
- */
+ var helpers = {
+ escape: escape,
+ unescape: unescape,
+ edit: edit,
+ cleanUrl: cleanUrl,
+ resolveUrl: resolveUrl,
+ noop: noop,
+ merge: merge,
+ splitCells: splitCells,
+ rtrim: rtrim,
+ findClosingBracket: findClosingBracket,
+ checkSanitizeDeprecation: checkSanitizeDeprecation
+ };
-var inline = {
- escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
- autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
- url: noop,
- tag: '^comment'
- + '|^[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
+ var noop$1 = helpers.noop,
+ edit$1 = helpers.edit,
+ merge$1 = helpers.merge;
+ /**
+ * Block-Level Grammar
+ */
+
+ var block = {
+ newline: /^\n+/,
+ code: /^( {4}[^\n]+\n*)+/,
+ fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
+ hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
+ heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
+ list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
+ html: '^ {0,3}(?:' // optional indentation
+ + '<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)' // (1)
+ + '|comment[^\\n]*(\\n+|$)' // (2)
+ + '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
+ + '|\\n*' // (4)
+ + '|\\n*' // (5)
+ + '|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ + '|(?!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,
+ 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]+)*)/,
+ text: /^[^\n]+/
+ };
+ block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
+ block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
+ block.def = edit$1(block.def).replace('label', block._label).replace('title', block._title).getRegex();
+ block.bullet = /(?:[*+-]|\d{1,9}\.)/;
+ block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
+ block.item = edit$1(block.item, 'gm').replace(/bull/g, block.bullet).getRegex();
+ block.list = edit$1(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
+ block._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';
+ block._comment = //;
+ 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();
+ 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
+ .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
+ .replace('html', '?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
+ .getRegex();
+ block.blockquote = edit$1(block.blockquote).replace('paragraph', block.paragraph).getRegex();
+ /**
+ * Normal Block Grammar
+ */
+
+ block.normal = merge$1({}, block);
+ /**
+ * GFM Block Grammar
+ */
+
+ block.gfm = merge$1({}, block.normal, {
+ nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
+ table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
+ });
+ /**
+ * Pedantic grammar (original John Gruber's loose markdown specification)
+ */
+
+ block.pedantic = merge$1({}, block.normal, {
+ html: edit$1('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)' // closed tag
+ + '| \\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._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: noop$1,
+ // fences not supported
+ paragraph: edit$1(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
+ });
+ /**
+ * Inline-Level Grammar
+ */
+
+ var inline = {
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
+ url: noop$1,
+ tag: '^comment' + '|^[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g.
+ '|^' // declaration, e.g.
- + '|^', // CDATA section
- 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: noop,
- text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~';
-inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
-
-inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
-
-inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
-inline._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])?)+(?![-_])/;
-inline.autolink = edit(inline.autolink)
- .replace('scheme', inline._scheme)
- .replace('email', inline._email)
- .getRegex();
+ + '|^',
+ // CDATA section
+ 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: noop$1,
+ text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~';
+ inline.em = edit$1(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
+ inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
+ inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
+ inline._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])?)+(?![-_])/;
+ inline.autolink = edit$1(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
+ inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
+ inline.tag = edit$1(inline.tag).replace('comment', block._comment).replace('attribute', inline._attribute).getRegex();
+ inline._label = /(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
+ inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;
+ inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
+ inline.link = edit$1(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
+ inline.reflink = edit$1(inline.reflink).replace('label', inline._label).getRegex();
+ /**
+ * Normal Inline Grammar
+ */
+
+ inline.normal = merge$1({}, inline);
+ /**
+ * Pedantic Inline Grammar
+ */
+
+ inline.pedantic = merge$1({}, inline.normal, {
+ strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
+ em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
+ link: edit$1(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
+ reflink: edit$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
+ });
+ /**
+ * GFM Inline Grammar
+ */
+
+ inline.gfm = merge$1({}, inline.normal, {
+ escape: edit$1(inline.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]*?(?:(?=[\\`]+)?/;
+ var defaults$1 = defaults_1.defaults;
+ var block$1 = rules.block;
+ var rtrim$1 = helpers.rtrim,
+ splitCells$1 = helpers.splitCells,
+ escape$1 = helpers.escape;
+ /**
+ * Block Lexer
+ */
+
+ var Lexer_1 =
+ /*#__PURE__*/
+ function () {
+ function Lexer(options) {
+ _classCallCheck(this, Lexer);
+
+ this.tokens = [];
+ this.tokens.links = Object.create(null);
+ this.options = options || defaults$1;
+ this.rules = block$1.normal;
-inline.tag = edit(inline.tag)
- .replace('comment', block._comment)
- .replace('attribute', inline._attribute)
- .getRegex();
+ if (this.options.pedantic) {
+ this.rules = block$1.pedantic;
+ } else if (this.options.gfm) {
+ this.rules = block$1.gfm;
+ }
+ }
+ /**
+ * Expose Block Rules
+ */
-inline._label = /(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
-inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;
-inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
-inline.link = edit(inline.link)
- .replace('label', inline._label)
- .replace('href', inline._href)
- .replace('title', inline._title)
- .getRegex();
+ _createClass(Lexer, [{
+ key: "lex",
-inline.reflink = edit(inline.reflink)
- .replace('label', inline._label)
- .getRegex();
+ /**
+ * 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);
+
+ if (cap[0].length > 1) {
+ this.tokens.push({
+ type: 'space'
+ });
+ }
+ } // code
+
+
+ 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 (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
+ });
+ }
+
+ 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
-/**
- * Normal Inline Grammar
- */
-inline.normal = merge({}, inline);
+ 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 (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);
+ }
+
+ 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
-/**
- * Pedantic Inline Grammar
- */
-inline.pedantic = merge({}, inline.normal, {
- strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
- em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
- link: edit(/^!?\[(label)\]\((.*?)\)/)
- .replace('label', inline._label)
- .getRegex(),
- reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
- .replace('label', inline._label)
- .getRegex()
-});
+ 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.
-/**
- * GFM Inline Grammar
- */
+ 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.
+
+ 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.
+
+ 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.
+
+
+ if (i !== l - 1) {
+ b = block$1.bullet.exec(cap[i + 1])[0];
+
+ 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.
+
+
+ loose = next || /\n\n(?!\s*$)/.test(item);
+
+ if (i !== l - 1) {
+ next = item.charAt(item.length - 1) === '\n';
+ if (!loose) loose = next;
+ }
+
+ if (loose) {
+ listStart.loose = true;
+ } // Check for task list items
+
+
+ istask = /^\[[ xX]\] /.test(item);
+ ischecked = undefined;
+
+ if (istask) {
+ ischecked = item[1] !== ' ';
+ item = item.replace(/^\[[ xX]\] +/, '');
+ }
+
+ 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;
+
+ for (; i < l; i++) {
+ listItems[i].loose = true;
+ }
+ }
-inline.gfm = merge({}, inline.normal, {
- escape: edit(inline.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]*?(?:(?=[\\/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;
- }
-
- src = src.substring(cap[0].length);
- out += this.options.sanitize
- ? this.options.sanitizer
- ? this.options.sanitizer(cap[0])
- : escape(cap[0])
- : cap[0];
- continue;
+ this.options = options || defaults$2;
}
- // link
- if (cap = this.rules.link.exec(src)) {
- var lastParenIndex = findClosingBracket(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 (this.options.pedantic) {
- link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
+ _createClass(Renderer, [{
+ key: "code",
+ value: function code(_code, infostring, escaped) {
+ var lang = (infostring || '').match(/\S*/)[0];
- if (link) {
- href = link[1];
- title = link[3];
- } else {
- title = '';
- }
- } else {
- title = cap[3] ? cap[3].slice(1, -1) : '';
- }
- href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
- out += this.outputLink(cap, {
- href: InlineLexer.escapes(href),
- title: InlineLexer.escapes(title)
- });
- this.inLink = false;
- continue;
- }
+ if (this.options.highlight) {
+ var out = this.options.highlight(_code, lang);
- // reflink, nolink
- 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;
- }
- this.inLink = true;
- out += this.outputLink(cap, link);
- this.inLink = false;
- continue;
- }
+ if (out != null && out !== _code) {
+ escaped = true;
+ _code = out;
+ }
+ }
- // strong
- 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;
- }
+ if (!lang) {
+ return '' + (escaped ? _code : escape$2(_code, true)) + '
';
+ }
- // em
- 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;
- }
+ 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;
+ }
+ }, {
+ key: "heading",
+ value: function heading(text, level, raw, slugger) {
+ if (this.options.headerIds) {
+ return '\n';
+ } // ignore IDs
- // code
- if (cap = this.rules.code.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.codespan(escape(cap[2].trim(), true));
- continue;
- }
- // br
- if (cap = this.rules.br.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.br();
- continue;
- }
+ 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);
- // del (gfm)
- if (cap = this.rules.del.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.renderer.del(this.output(cap[1]));
- continue;
- }
+ if (href === null) {
+ return text;
+ }
- // autolink
- if (cap = this.rules.autolink.exec(src)) {
- src = src.substring(cap[0].length);
- if (cap[2] === '@') {
- text = escape(this.mangle(cap[1]));
- href = 'mailto:' + text;
- } else {
- text = escape(cap[1]);
- href = text;
- }
- out += this.renderer.link(href, null, text);
- continue;
- }
+ var out = '' + text + ' ';
+ return out;
}
- continue;
- }
+ }, {
+ key: "image",
+ value: function image(href, title, text) {
+ href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
- if (src) {
- throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
- }
- }
+ if (href === null) {
+ return text;
+ }
- return out;
-};
+ var out = ' ' : '>';
+ return out;
+ }
+ }, {
+ key: "text",
+ value: function text(_text) {
+ return _text;
+ }
+ }]);
-InlineLexer.prototype.outputLink = function(cap, link) {
- var href = link.href,
- title = link.title ? escape(link.title) : null;
+ return Renderer;
+ }();
- return cap[0].charAt(0) !== '!'
- ? this.renderer.link(href, title, this.output(cap[1]))
- : this.renderer.image(href, title, escape(cap[1]));
-};
+ /**
+ * Slugger generates header id
+ */
+ var Slugger_1 =
+ /*#__PURE__*/
+ function () {
+ function Slugger() {
+ _classCallCheck(this, Slugger);
-/**
- * Smartypants Transformations
- */
+ this.seen = {};
+ }
+ /**
+ * Convert string to unique id
+ */
-InlineLexer.prototype.smartypants = function(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
- */
+ _createClass(Slugger, [{
+ key: "slug",
+ value: function slug(value) {
+ var slug = value.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
-InlineLexer.prototype.mangle = function(text) {
- if (!this.options.mangle) return text;
- var out = '',
- l = text.length,
- i = 0,
- ch;
-
- for (; i < l; i++) {
- ch = text.charCodeAt(i);
- if (Math.random() > 0.5) {
- ch = 'x' + ch.toString(16);
- }
- out += '' + ch + ';';
- }
+ if (this.seen.hasOwnProperty(slug)) {
+ var originalSlug = slug;
- return out;
-};
+ do {
+ this.seen[originalSlug]++;
+ slug = originalSlug + '-' + this.seen[originalSlug];
+ } while (this.seen.hasOwnProperty(slug));
+ }
-/**
- * Renderer
- */
+ this.seen[slug] = 0;
+ return slug;
+ }
+ }]);
+
+ return Slugger;
+ }();
+
+ var defaults$3 = defaults_1.defaults;
+ var inline$1 = rules.inline;
+ var findClosingBracket$1 = helpers.findClosingBracket,
+ escape$3 = helpers.escape;
+ /**
+ * Inline Lexer & Compiler
+ */
+
+ var InlineLexer_1 =
+ /*#__PURE__*/
+ function () {
+ function InlineLexer(links, options) {
+ _classCallCheck(this, InlineLexer);
+
+ this.options = options || defaults$3;
+ this.links = links;
+ this.rules = inline$1.normal;
+ this.options.renderer = this.options.renderer || new Renderer_1();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+
+ if (!this.links) {
+ throw new Error('Tokens array requires a `links` property.');
+ }
-function Renderer(options) {
- this.options = options || marked.defaults;
-}
-
-Renderer.prototype.code = function(code, infostring, escaped) {
- var lang = (infostring || '').match(/\S*/)[0];
- if (this.options.highlight) {
- var out = this.options.highlight(code, lang);
- if (out != null && out !== code) {
- escaped = true;
- code = out;
+ if (this.options.pedantic) {
+ this.rules = inline$1.pedantic;
+ } else if (this.options.gfm) {
+ if (this.options.breaks) {
+ this.rules = inline$1.breaks;
+ } else {
+ this.rules = inline$1.gfm;
+ }
+ }
}
- }
+ /**
+ * Expose Inline Rules
+ */
+
+
+ _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
+
+
+ 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;
+ }
+
+ 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 (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) : '';
+ }
+
+ 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 (!lang) {
- return ''
- + (escaped ? code : escape(code, true))
- + '
';
- }
- return ''
- + (escaped ? code : escape(code, true))
- + '
\n';
-};
-
-Renderer.prototype.blockquote = function(quote) {
- return '\n' + quote + ' \n';
-};
-
-Renderer.prototype.html = function(html) {
- return html;
-};
-
-Renderer.prototype.heading = function(text, level, raw, slugger) {
- if (this.options.headerIds) {
- return '\n';
- }
- // ignore IDs
- return '' + text + ' \n';
-};
-
-Renderer.prototype.hr = function() {
- return this.options.xhtml ? ' \n' : ' \n';
-};
-
-Renderer.prototype.list = function(body, ordered, start) {
- var type = ordered ? 'ol' : 'ul',
- startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
- return '<' + type + startatt + '>\n' + body + '' + type + '>\n';
-};
-
-Renderer.prototype.listitem = function(text) {
- return '' + text + ' \n';
-};
-
-Renderer.prototype.checkbox = function(checked) {
- return ' ';
-};
-
-Renderer.prototype.paragraph = function(text) {
- return '' + text + '
\n';
-};
-
-Renderer.prototype.table = function(header, body) {
- if (body) body = '' + body + ' ';
-
- return ' \n'
- + '\n'
- + header
- + ' \n'
- + body
- + '
\n';
-};
-
-Renderer.prototype.tablerow = function(content) {
- return '\n' + content + ' \n';
-};
-
-Renderer.prototype.tablecell = function(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
-Renderer.prototype.strong = function(text) {
- return '' + text + ' ';
-};
-
-Renderer.prototype.em = function(text) {
- return '' + text + ' ';
-};
-
-Renderer.prototype.codespan = function(text) {
- return '' + text + '
';
-};
-
-Renderer.prototype.br = function() {
- return this.options.xhtml ? ' ' : ' ';
-};
-
-Renderer.prototype.del = function(text) {
- return '' + text + '';
-};
-
-Renderer.prototype.link = function(href, title, text) {
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
- if (href === null) {
- return text;
- }
- var out = '' + text + ' ';
- return out;
-};
-
-Renderer.prototype.image = function(href, title, text) {
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
- if (href === null) {
- return text;
- }
+ 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()];
- var out = ' ' : '>';
- return out;
-};
+ if (!link || !link.href) {
+ out += cap[0].charAt(0);
+ src = cap[0].substring(1) + src;
+ continue;
+ }
-Renderer.prototype.text = function(text) {
- return text;
-};
+ this.inLink = true;
+ out += this.outputLink(cap, link);
+ this.inLink = false;
+ continue;
+ } // strong
-/**
- * TextRenderer
- * returns only the textual part of the token
- */
-function TextRenderer() {}
+ 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
-// no need for block level renderers
-TextRenderer.prototype.strong =
-TextRenderer.prototype.em =
-TextRenderer.prototype.codespan =
-TextRenderer.prototype.del =
-TextRenderer.prototype.text = function(text) {
- return text;
-};
+ 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
-TextRenderer.prototype.link =
-TextRenderer.prototype.image = function(href, title, text) {
- return '' + text;
-};
-TextRenderer.prototype.br = function() {
- return '';
-};
+ 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
-/**
- * Parsing & Compiling
- */
-function Parser(options) {
- this.tokens = [];
- this.token = null;
- this.options = options || marked.defaults;
- this.options.renderer = this.options.renderer || new Renderer();
- this.renderer = this.options.renderer;
- this.renderer.options = this.options;
- this.slugger = new Slugger();
-}
+ if (cap = this.rules.br.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.br();
+ continue;
+ } // del (gfm)
-/**
- * Static Parse Method
- */
-Parser.parse = function(src, options) {
- var parser = new Parser(options);
- return parser.parse(src);
-};
+ if (cap = this.rules.del.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.del(this.output(cap[1]));
+ continue;
+ } // autolink
-/**
- * Parse Loop
- */
-Parser.prototype.parse = function(src) {
- this.inline = new InlineLexer(src.links, this.options);
- // use an InlineLexer with a TextRenderer to extract pure text
- this.inlineText = new InlineLexer(
- src.links,
- merge({}, this.options, { renderer: new TextRenderer() })
- );
- this.tokens = src.reverse();
-
- var out = '';
- while (this.next()) {
- out += this.tok();
- }
+ if (cap = this.rules.autolink.exec(src)) {
+ src = src.substring(cap[0].length);
- return out;
-};
+ if (cap[2] === '@') {
+ text = escape$3(this.mangle(cap[1]));
+ href = 'mailto:' + text;
+ } else {
+ text = escape$3(cap[1]);
+ href = text;
+ }
-/**
- * Next Token
- */
+ out += this.renderer.link(href, null, text);
+ continue;
+ } // url (gfm)
-Parser.prototype.next = function() {
- this.token = this.tokens.pop();
- return this.token;
-};
-/**
- * Preview Next Token
- */
+ 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]);
-Parser.prototype.peek = function() {
- return this.tokens[this.tokens.length - 1] || 0;
-};
+ text = escape$3(cap[0]);
-/**
- * Parse Text Tokens
- */
+ if (cap[1] === 'www.') {
+ href = 'http://' + text;
+ } else {
+ href = text;
+ }
+ }
-Parser.prototype.parseText = function() {
- var body = this.token.text;
+ src = src.substring(cap[0].length);
+ out += this.renderer.link(href, null, text);
+ continue;
+ } // text
- while (this.peek().type === 'text') {
- body += '\n' + this.next().text;
- }
- return this.inline.output(body);
-};
+ if (cap = this.rules.text.exec(src)) {
+ src = src.substring(cap[0].length);
-/**
- * Parse Current Token
- */
+ 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])));
+ }
-Parser.prototype.tok = function() {
- switch (this.token.type) {
- case 'space': {
- return '';
- }
- case 'hr': {
- return this.renderer.hr();
- }
- case 'heading': {
- return this.renderer.heading(
- this.inline.output(this.token.text),
- this.token.depth,
- unescape(this.inlineText.output(this.token.text)),
- this.slugger);
- }
- case 'code': {
- return this.renderer.code(this.token.text,
- this.token.lang,
- this.token.escaped);
- }
- case 'table': {
- var header = '',
- body = '',
- i,
- row,
- cell,
- j;
-
- // header
- cell = '';
- 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);
-
- 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] }
- );
+ continue;
+ }
+
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
}
- body += this.renderer.tablerow(cell);
+ return out;
}
- return this.renderer.table(header, body);
- }
- case 'blockquote_start': {
- body = '';
-
- while (this.next().type !== 'blockquote_end') {
- body += this.tok();
+ }, {
+ 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]));
}
-
- return this.renderer.blockquote(body);
- }
- case 'list_start': {
- body = '';
- var ordered = this.token.ordered,
- start = this.token.start;
-
- while (this.next().type !== 'list_end') {
- body += this.tok();
+ /**
+ * 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;
- 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 {
- this.tokens.push({
- type: 'text',
- text: this.renderer.checkbox(checked)
- });
+ for (; i < l; i++) {
+ ch = text.charCodeAt(i);
+
+ if (Math.random() > 0.5) {
+ ch = 'x' + ch.toString(16);
}
- } else {
- body += this.renderer.checkbox(checked);
+
+ out += '' + ch + ';';
}
- }
- while (this.next().type !== 'list_item_end') {
- body += !loose && this.token.type === 'text'
- ? this.parseText()
- : this.tok();
+ return out;
}
- return this.renderer.listitem(body, task, checked);
- }
- case 'html': {
- // TODO parse inline content if parameter markdown=1
- return this.renderer.html(this.token.text);
- }
- case 'paragraph': {
- return this.renderer.paragraph(this.inline.output(this.token.text));
- }
- case 'text': {
- return this.renderer.paragraph(this.parseText());
+ }], [{
+ 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;
+ }
+ }, {
+ key: "rules",
+ get: function get() {
+ return inline$1;
+ }
+ }]);
+
+ return InlineLexer;
+ }();
+
+ /**
+ * TextRenderer
+ * returns only the textual part of the token
+ */
+ var TextRenderer_1 =
+ /*#__PURE__*/
+ function () {
+ function TextRenderer() {
+ _classCallCheck(this, TextRenderer);
}
- default: {
- var errMsg = 'Token with "' + this.token.type + '" type was not found.';
- if (this.options.silent) {
- console.log(errMsg);
- } else {
- throw new Error(errMsg);
+
+ _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 '';
+ }
+ }]);
+
+ return TextRenderer;
+ }();
+
+ var defaults$4 = defaults_1.defaults;
+ var merge$2 = helpers.merge,
+ unescape$1 = helpers.unescape;
+ /**
+ * Parsing & Compiling
+ */
+
+ var Parser_1 =
+ /*#__PURE__*/
+ function () {
+ function Parser(options) {
+ _classCallCheck(this, Parser);
+
+ this.tokens = [];
+ this.token = null;
+ this.options = options || defaults$4;
+ this.options.renderer = this.options.renderer || new Renderer_1();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+ this.slugger = new Slugger_1();
}
- }
-};
+ /**
+ * Static Parse Method
+ */
-/**
- * Slugger generates header id
- */
-function Slugger() {
- this.seen = {};
-}
+ _createClass(Parser, [{
+ key: "parse",
-/**
- * Convert string to unique id
- */
+ /**
+ * 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
-Slugger.prototype.slug = function(value) {
- var slug = value
- .toLowerCase()
- .trim()
- .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
- .replace(/\s/g, '-');
-
- if (this.seen.hasOwnProperty(slug)) {
- var originalSlug = slug;
- do {
- this.seen[originalSlug]++;
- slug = originalSlug + '-' + this.seen[originalSlug];
- } while (this.seen.hasOwnProperty(slug));
- }
- this.seen[slug] = 0;
+ this.inlineText = new InlineLexer_1(tokens.links, merge$2({}, this.options, {
+ renderer: new TextRenderer_1()
+ }));
+ this.tokens = tokens.reverse();
+ var out = '';
- return slug;
-};
+ while (this.next()) {
+ out += this.tok();
+ }
-/**
- * Helpers
- */
+ return out;
+ }
+ }, {
+ 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",
-function escape(html, encode) {
- if (encode) {
- if (escape.escapeTest.test(html)) {
- return html.replace(escape.escapeReplace, function(ch) { return escape.replacements[ch]; });
- }
- } else {
- if (escape.escapeTestNoEncode.test(html)) {
- return html.replace(escape.escapeReplaceNoEncode, function(ch) { return escape.replacements[ch]; });
- }
- }
+ /**
+ * Parse Text Tokens
+ */
+ value: function parseText() {
+ var body = this.token.text;
- return html;
-}
-
-escape.escapeTest = /[&<>"']/;
-escape.escapeReplace = /[&<>"']/g;
-escape.replacements = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- "'": '''
-};
-
-escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
-escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
-
-function unescape(html) {
- // explicitly match decimal, hex, and named HTML entities
- return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) {
- n = n.toLowerCase();
- if (n === 'colon') return ':';
- if (n.charAt(0) === '#') {
- return n.charAt(1) === 'x'
- ? String.fromCharCode(parseInt(n.substring(2), 16))
- : String.fromCharCode(+n.substring(1));
- }
- return '';
- });
-}
-
-function edit(regex, opt) {
- regex = regex.source || regex;
- opt = opt || '';
- return {
- replace: function(name, val) {
- val = val.source || val;
- val = val.replace(/(^|[^\[])\^/g, '$1');
- regex = regex.replace(name, val);
- return this;
- },
- getRegex: function() {
- return new RegExp(regex, opt);
- }
- };
-}
+ while (this.peek().type === 'text') {
+ body += '\n' + this.next().text;
+ }
-function cleanUrl(sanitize, base, href) {
- if (sanitize) {
- try {
- var prot = decodeURIComponent(unescape(href))
- .replace(/[^\w:]/g, '')
- .toLowerCase();
- } catch (e) {
- return null;
- }
- if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
- return null;
- }
- }
- if (base && !originIndependentUrl.test(href)) {
- href = resolveUrl(base, href);
- }
- try {
- href = encodeURI(href).replace(/%25/g, '%');
- } catch (e) {
- return null;
- }
- return href;
-}
-
-function resolveUrl(base, href) {
- 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 (/^[^:]+:\/*[^/]*$/.test(base)) {
- baseUrls[' ' + base] = base + '/';
- } else {
- baseUrls[' ' + base] = rtrim(base, '/', true);
+ return this.inline.output(body);
+ }
+ }, {
+ key: "tok",
+
+ /**
+ * Parse Current Token
+ */
+ value: function tok() {
+ var body = '';
+
+ switch (this.token.type) {
+ case 'space':
+ {
+ return '';
+ }
+
+ case 'hr':
+ {
+ return this.renderer.hr();
+ }
+
+ 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);
+ }
+
+ case 'code':
+ {
+ return this.renderer.code(this.token.text, this.token.lang, this.token.escaped);
+ }
+
+ case 'table':
+ {
+ var header = '',
+ i,
+ row,
+ cell,
+ j; // header
+
+ cell = '';
+
+ 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);
+
+ 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]
+ });
+ }
+
+ body += this.renderer.tablerow(cell);
+ }
+
+ return this.renderer.table(header, body);
+ }
+
+ case 'blockquote_start':
+ {
+ body = '';
+
+ while (this.next().type !== 'blockquote_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.blockquote(body);
+ }
+
+ case 'list_start':
+ {
+ body = '';
+ var ordered = this.token.ordered,
+ start = this.token.start;
+
+ while (this.next().type !== 'list_end') {
+ body += this.tok();
+ }
+
+ 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 {
+ 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);
+ }
+
+ case 'paragraph':
+ {
+ return this.renderer.paragraph(this.inline.output(this.token.text));
+ }
+
+ 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;
+ }();
+
+ var merge$3 = helpers.merge,
+ checkSanitizeDeprecation$1 = helpers.checkSanitizeDeprecation,
+ escape$4 = helpers.escape;
+ var getDefaults$1 = defaults_1.getDefaults,
+ changeDefaults$1 = defaults_1.changeDefaults,
+ defaults$5 = defaults_1.defaults;
+ /**
+ * Marked
+ */
+
+ function marked(src, opt, callback) {
+ // throw error in case of non string input
+ if (typeof src === 'undefined' || src === null) {
+ throw new Error('marked(): input parameter is undefined or null');
}
- }
- base = baseUrls[' ' + base];
- var relativeBase = base.indexOf(':') === -1;
- if (href.slice(0, 2) === '//') {
- if (relativeBase) {
- return href;
+ if (typeof src !== 'string') {
+ throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
}
- return base.replace(/^([^:]+:)[\s\S]*$/, '$1') + href;
- } else if (href.charAt(0) === '/') {
- if (relativeBase) {
- return href;
- }
- return base.replace(/^([^:]+:\/*[^/]*)[\s\S]*$/, '$1') + href;
- } else {
- return base + href;
- }
-}
-var baseUrls = {};
-var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
-function noop() {}
-noop.exec = noop;
+ if (callback || typeof opt === 'function') {
+ var _ret = function () {
+ if (!callback) {
+ callback = opt;
+ opt = null;
+ }
-function merge(obj) {
- var i = 1,
- target,
- key;
+ opt = merge$3({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation$1(opt);
+ var highlight = opt.highlight;
+ var tokens,
+ pending,
+ i = 0;
+
+ try {
+ tokens = Lexer_1.lex(src, opt);
+ } catch (e) {
+ return {
+ v: callback(e)
+ };
+ }
- for (; i < arguments.length; i++) {
- target = arguments[i];
- for (key in target) {
- if (Object.prototype.hasOwnProperty.call(target, key)) {
- obj[key] = target[key];
- }
- }
- }
+ pending = tokens.length;
- return obj;
-}
-
-function splitCells(tableRow, count) {
- // ensure that every cell-delimiting pipe has a space
- // before it to distinguish it from an escaped pipe
- var row = tableRow.replace(/\|/g, function(match, offset, str) {
- var escaped = false,
- curr = offset;
- while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
- if (escaped) {
- // odd number of slashes means | is escaped
- // so we leave it alone
- return '|';
- } else {
- // add space before unescaped |
- return ' |';
- }
- }),
- cells = row.split(/ \|/),
- i = 0;
-
- if (cells.length > count) {
- cells.splice(count);
- } else {
- while (cells.length < count) cells.push('');
- }
+ var done = function done(err) {
+ if (err) {
+ opt.highlight = highlight;
+ return callback(err);
+ }
- for (; i < cells.length; i++) {
- // leading or trailing whitespace is ignored per the gfm spec
- cells[i] = cells[i].trim().replace(/\\\|/g, '|');
- }
- return cells;
-}
-
-// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
-// /c*$/ is vulnerable to REDOS.
-// invert: Remove suffix of non-c chars instead. Default falsey.
-function rtrim(str, c, invert) {
- if (str.length === 0) {
- return '';
- }
+ var out;
- // Length of suffix matching the invert condition.
- var suffLen = 0;
+ try {
+ out = Parser_1.parse(tokens, opt);
+ } catch (e) {
+ err = e;
+ }
- // Step left until we fail to match the invert condition.
- while (suffLen < str.length) {
- var currChar = str.charAt(str.length - suffLen - 1);
- if (currChar === c && !invert) {
- suffLen++;
- } else if (currChar !== c && invert) {
- suffLen++;
- } else {
- break;
- }
- }
+ opt.highlight = highlight;
+ return err ? callback(err) : callback(null, out);
+ };
- return str.substr(0, str.length - suffLen);
-}
+ if (!highlight || highlight.length < 3) {
+ return {
+ v: done()
+ };
+ }
-function findClosingBracket(str, b) {
- if (str.indexOf(b[1]) === -1) {
- return -1;
- }
- var level = 0;
- for (var i = 0; i < str.length; i++) {
- if (str[i] === '\\') {
- i++;
- } else if (str[i] === b[0]) {
- level++;
- } else if (str[i] === b[1]) {
- level--;
- if (level < 0) {
- return i;
- }
- }
- }
- return -1;
-}
+ delete opt.highlight;
+ if (!pending) return {
+ v: done()
+ };
-function checkSanitizeDeprecation(opt) {
- if (opt && opt.sanitize && !opt.silent) {
- console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
- }
-}
+ for (; i < tokens.length; i++) {
+ (function (token) {
+ if (token.type !== 'code') {
+ return --pending || done();
+ }
-/**
- * Marked
- */
+ return highlight(token.text, token.lang, function (err, code) {
+ if (err) return done(err);
-function marked(src, opt, callback) {
- // throw error in case of non string input
- if (typeof src === 'undefined' || src === null) {
- throw new Error('marked(): input parameter is undefined or null');
- }
- if (typeof src !== 'string') {
- throw new Error('marked(): input parameter is of type '
- + Object.prototype.toString.call(src) + ', string expected');
- }
+ if (code == null || code === token.text) {
+ return --pending || done();
+ }
- if (callback || typeof opt === 'function') {
- if (!callback) {
- callback = opt;
- opt = null;
- }
+ token.text = code;
+ token.escaped = true;
+ --pending || done();
+ });
+ })(tokens[i]);
+ }
- opt = merge({}, marked.defaults, opt || {});
- checkSanitizeDeprecation(opt);
+ return {
+ v: void 0
+ };
+ }();
- var highlight = opt.highlight,
- tokens,
- pending,
- i = 0;
+ if (_typeof(_ret) === "object") return _ret.v;
+ }
try {
- tokens = Lexer.lex(src, opt);
+ opt = merge$3({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation$1(opt);
+ return Parser_1.parse(Lexer_1.lex(src, opt), opt);
} catch (e) {
- return callback(e);
- }
-
- pending = tokens.length;
-
- var done = function(err) {
- if (err) {
- opt.highlight = highlight;
- return callback(err);
- }
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
- var out;
-
- try {
- out = Parser.parse(tokens, opt);
- } catch (e) {
- err = e;
+ if ((opt || marked.defaults).silent) {
+ return 'An error occurred:
' + escape$4(e.message + '', true) + ' ';
}
- opt.highlight = highlight;
-
- return err
- ? callback(err)
- : callback(null, out);
- };
-
- if (!highlight || highlight.length < 3) {
- return done();
- }
-
- delete opt.highlight;
-
- if (!pending) return done();
-
- for (; i < tokens.length; i++) {
- (function(token) {
- if (token.type !== 'code') {
- return --pending || done();
- }
- return highlight(token.text, token.lang, function(err, code) {
- if (err) return done(err);
- if (code == null || code === token.text) {
- return --pending || done();
- }
- token.text = code;
- token.escaped = true;
- --pending || done();
- });
- })(tokens[i]);
+ throw e;
}
-
- return;
}
- try {
- if (opt) opt = merge({}, marked.defaults, opt);
- checkSanitizeDeprecation(opt);
- return Parser.parse(Lexer.lex(src, opt), opt);
- } catch (e) {
- e.message += '\nPlease report this to https://github.com/markedjs/marked.';
- if ((opt || marked.defaults).silent) {
- return 'An error occurred:
'
- + escape(e.message + '', true)
- + ' ';
- }
- throw e;
- }
-}
+ /**
+ * Options
+ */
-/**
- * Options
- */
-marked.options =
-marked.setOptions = function(opt) {
- merge(marked.defaults, opt);
- return marked;
-};
-
-marked.getDefaults = function() {
- return {
- baseUrl: null,
- breaks: false,
- gfm: true,
- headerIds: true,
- headerPrefix: '',
- highlight: null,
- langPrefix: 'language-',
- mangle: true,
- pedantic: false,
- renderer: new Renderer(),
- sanitize: false,
- sanitizer: null,
- silent: false,
- smartLists: false,
- smartypants: false,
- xhtml: false
+ marked.options = marked.setOptions = function (opt) {
+ merge$3(marked.defaults, opt);
+ changeDefaults$1(marked.defaults);
+ return marked;
};
-};
-
-marked.defaults = marked.getDefaults();
-
-/**
- * Expose
- */
-
-marked.Parser = Parser;
-marked.parser = Parser.parse;
-
-marked.Renderer = Renderer;
-marked.TextRenderer = TextRenderer;
-
-marked.Lexer = Lexer;
-marked.lexer = Lexer.lex;
-
-marked.InlineLexer = InlineLexer;
-marked.inlineLexer = InlineLexer.output;
-
-marked.Slugger = Slugger;
-
-marked.parse = marked;
-if (typeof module !== 'undefined' && typeof exports === 'object') {
- module.exports = marked;
-} else if (typeof define === 'function' && define.amd) {
- define(function() { return marked; });
-} else {
- root.marked = marked;
-}
-})(this || (typeof window !== 'undefined' ? window : global));
+ marked.getDefaults = getDefaults$1;
+ marked.defaults = defaults$5;
+ /**
+ * Expose
+ */
+
+ marked.Parser = Parser_1;
+ marked.parser = Parser_1.parse;
+ marked.Renderer = Renderer_1;
+ marked.TextRenderer = TextRenderer_1;
+ marked.Lexer = Lexer_1;
+ marked.lexer = Lexer_1.lex;
+ marked.InlineLexer = InlineLexer_1;
+ marked.inlineLexer = InlineLexer_1.output;
+ marked.Slugger = Slugger_1;
+ marked.parse = marked;
+ var marked_1 = marked;
+
+ return marked_1;
+
+})));
diff --git a/package-lock.json b/package-lock.json
index 924d43e9cd..23fc190a71 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,15 +13,817 @@
"@babel/highlight": "^7.0.0"
}
},
+ "@babel/core": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.0.tgz",
+ "integrity": "sha512-Bb1NjZCaiwTQC/ARL+MwDpgocdnwWDCaugvkGt6cxfBzQa8Whv1JybBoUEiBDKl8Ni3H3c7Fykwk7QChUsHRlg==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.5.5",
+ "@babel/generator": "^7.7.0",
+ "@babel/helpers": "^7.7.0",
+ "@babel/parser": "^7.7.0",
+ "@babel/template": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0",
+ "convert-source-map": "^1.1.0",
+ "debug": "^4.1.0",
+ "json5": "^2.1.0",
+ "lodash": "^4.17.13",
+ "resolve": "^1.3.2",
+ "semver": "^5.4.1",
+ "source-map": "^0.5.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ },
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
+ "dev": true
+ }
+ }
+ },
+ "@babel/generator": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.0.tgz",
+ "integrity": "sha512-1wdJ6UxHyL1XoJQ119JmvuRX27LRih7iYStMPZOWAjQqeAabFg3dYXKMpgihma+to+0ADsTVVt6oRyUxWZw6Mw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0",
+ "jsesc": "^2.5.1",
+ "lodash": "^4.17.13",
+ "source-map": "^0.5.0"
+ },
+ "dependencies": {
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
+ "dev": true
+ }
+ }
+ },
+ "@babel/helper-annotate-as-pure": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.0.tgz",
+ "integrity": "sha512-k50CQxMlYTYo+GGyUGFwpxKVtxVJi9yh61sXZji3zYHccK9RYliZGSTOgci85T+r+0VFN2nWbGM04PIqwfrpMg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-builder-binary-assignment-operator-visitor": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.7.0.tgz",
+ "integrity": "sha512-Cd8r8zs4RKDwMG/92lpZcnn5WPQ3LAMQbCw42oqUh4s7vsSN5ANUZjMel0OOnxDLq57hoDDbai+ryygYfCTOsw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-explode-assignable-expression": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-call-delegate": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.7.0.tgz",
+ "integrity": "sha512-Su0Mdq7uSSWGZayGMMQ+z6lnL00mMCnGAbO/R0ZO9odIdB/WNU/VfQKqMQU0fdIsxQYbRjDM4BixIa93SQIpvw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-hoist-variables": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-create-regexp-features-plugin": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.0.tgz",
+ "integrity": "sha512-ZhagAAVGD3L6MPM9/zZi7RRteonfBFLVUz3kjsnYsMAtr9hOJCKI9BAKIMpqn3NyWicPieoX779UL+7/3BEAOA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-regex": "^7.4.4",
+ "regexpu-core": "^4.6.0"
+ }
+ },
+ "@babel/helper-define-map": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.7.0.tgz",
+ "integrity": "sha512-kPKWPb0dMpZi+ov1hJiwse9dWweZsz3V9rP4KdytnX1E7z3cTNmFGglwklzFPuqIcHLIY3bgKSs4vkwXXdflQA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.7.0",
+ "@babel/types": "^7.7.0",
+ "lodash": "^4.17.13"
+ }
+ },
+ "@babel/helper-explode-assignable-expression": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.7.0.tgz",
+ "integrity": "sha512-CDs26w2shdD1urNUAji2RJXyBFCaR+iBEGnFz3l7maizMkQe3saVw9WtjG1tz8CwbjvlFnaSLVhgnu1SWaherg==",
+ "dev": true,
+ "requires": {
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-function-name": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.0.tgz",
+ "integrity": "sha512-tDsJgMUAP00Ugv8O2aGEua5I2apkaQO7lBGUq1ocwN3G23JE5Dcq0uh3GvFTChPa4b40AWiAsLvCZOA2rdnQ7Q==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-get-function-arity": "^7.7.0",
+ "@babel/template": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-get-function-arity": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.0.tgz",
+ "integrity": "sha512-tLdojOTz4vWcEnHWHCuPN5P85JLZWbm5Fx5ZsMEMPhF3Uoe3O7awrbM2nQ04bDOUToH/2tH/ezKEOR8zEYzqyw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-hoist-variables": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.0.tgz",
+ "integrity": "sha512-LUe/92NqsDAkJjjCEWkNe+/PcpnisvnqdlRe19FahVapa4jndeuJ+FBiTX1rcAKWKcJGE+C3Q3tuEuxkSmCEiQ==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-member-expression-to-functions": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.7.0.tgz",
+ "integrity": "sha512-QaCZLO2RtBcmvO/ekOLp8p7R5X2JriKRizeDpm5ChATAFWrrYDcDxPuCIBXKyBjY+i1vYSdcUTMIb8psfxHDPA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-module-imports": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.7.0.tgz",
+ "integrity": "sha512-Dv3hLKIC1jyfTkClvyEkYP2OlkzNvWs5+Q8WgPbxM5LMeorons7iPP91JM+DU7tRbhqA1ZeooPaMFvQrn23RHw==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-module-transforms": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.7.0.tgz",
+ "integrity": "sha512-rXEefBuheUYQyX4WjV19tuknrJFwyKw0HgzRwbkyTbB+Dshlq7eqkWbyjzToLrMZk/5wKVKdWFluiAsVkHXvuQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.7.0",
+ "@babel/helper-simple-access": "^7.7.0",
+ "@babel/helper-split-export-declaration": "^7.7.0",
+ "@babel/template": "^7.7.0",
+ "@babel/types": "^7.7.0",
+ "lodash": "^4.17.13"
+ }
+ },
+ "@babel/helper-optimise-call-expression": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.0.tgz",
+ "integrity": "sha512-48TeqmbazjNU/65niiiJIJRc5JozB8acui1OS7bSd6PgxfuovWsvjfWSzlgx+gPFdVveNzUdpdIg5l56Pl5jqg==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-plugin-utils": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz",
+ "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==",
+ "dev": true
+ },
+ "@babel/helper-regex": {
+ "version": "7.5.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.5.5.tgz",
+ "integrity": "sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw==",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.17.13"
+ }
+ },
+ "@babel/helper-remap-async-to-generator": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.0.tgz",
+ "integrity": "sha512-pHx7RN8X0UNHPB/fnuDnRXVZ316ZigkO8y8D835JlZ2SSdFKb6yH9MIYRU4fy/KPe5sPHDFOPvf8QLdbAGGiyw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.7.0",
+ "@babel/helper-wrap-function": "^7.7.0",
+ "@babel/template": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-replace-supers": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.7.0.tgz",
+ "integrity": "sha512-5ALYEul5V8xNdxEeWvRsBzLMxQksT7MaStpxjJf9KsnLxpAKBtfw5NeMKZJSYDa0lKdOcy0g+JT/f5mPSulUgg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-member-expression-to-functions": "^7.7.0",
+ "@babel/helper-optimise-call-expression": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-simple-access": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.7.0.tgz",
+ "integrity": "sha512-AJ7IZD7Eem3zZRuj5JtzFAptBw7pMlS3y8Qv09vaBWoFsle0d1kAn5Wq6Q9MyBXITPOKnxwkZKoAm4bopmv26g==",
+ "dev": true,
+ "requires": {
+ "@babel/template": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-split-export-declaration": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.0.tgz",
+ "integrity": "sha512-HgYSI8rH08neWlAH3CcdkFg9qX9YsZysZI5GD8LjhQib/mM0jGOZOVkoUiiV2Hu978fRtjtsGsW6w0pKHUWtqA==",
+ "dev": true,
+ "requires": {
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helper-wrap-function": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.7.0.tgz",
+ "integrity": "sha512-sd4QjeMgQqzshSjecZjOp8uKfUtnpmCyQhKQrVJBBgeHAB/0FPi33h3AbVlVp07qQtMD4QgYSzaMI7VwncNK/w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.7.0",
+ "@babel/template": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/helpers": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.7.0.tgz",
+ "integrity": "sha512-VnNwL4YOhbejHb7x/b5F39Zdg5vIQpUUNzJwx0ww1EcVRt41bbGRZWhAURrfY32T5zTT3qwNOQFWpn+P0i0a2g==",
+ "dev": true,
+ "requires": {
+ "@babel/template": "^7.7.0",
+ "@babel/traverse": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
"@babel/highlight": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
"integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
"dev": true,
"requires": {
- "chalk": "^2.0.0",
+ "chalk": "^2.0.0",
+ "esutils": "^2.0.2",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@babel/parser": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.0.tgz",
+ "integrity": "sha512-GqL+Z0d7B7ADlQBMXlJgvXEbtt5qlqd1YQ5fr12hTSfh7O/vgrEIvJxU2e7aSVrEUn75zTZ6Nd0s8tthrlZnrQ==",
+ "dev": true
+ },
+ "@babel/plugin-proposal-async-generator-functions": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.0.tgz",
+ "integrity": "sha512-ot/EZVvf3mXtZq0Pd0+tSOfGWMizqmOohXmNZg6LNFjHOV+wOPv7BvVYh8oPR8LhpIP3ye8nNooKL50YRWxpYA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/helper-remap-async-to-generator": "^7.7.0",
+ "@babel/plugin-syntax-async-generators": "^7.2.0"
+ }
+ },
+ "@babel/plugin-proposal-dynamic-import": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.7.0.tgz",
+ "integrity": "sha512-7poL3Xi+QFPC7sGAzEIbXUyYzGJwbc2+gSD0AkiC5k52kH2cqHdqxm5hNFfLW3cRSTcx9bN0Fl7/6zWcLLnKAQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/plugin-syntax-dynamic-import": "^7.2.0"
+ }
+ },
+ "@babel/plugin-proposal-json-strings": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz",
+ "integrity": "sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/plugin-syntax-json-strings": "^7.2.0"
+ }
+ },
+ "@babel/plugin-proposal-object-rest-spread": {
+ "version": "7.6.2",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz",
+ "integrity": "sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/plugin-syntax-object-rest-spread": "^7.2.0"
+ }
+ },
+ "@babel/plugin-proposal-optional-catch-binding": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz",
+ "integrity": "sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.2.0"
+ }
+ },
+ "@babel/plugin-proposal-unicode-property-regex": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.0.tgz",
+ "integrity": "sha512-mk34H+hp7kRBWJOOAR0ZMGCydgKMD4iN9TpDRp3IIcbunltxEY89XSimc6WbtSLCDrwcdy/EEw7h5CFCzxTchw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-syntax-async-generators": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz",
+ "integrity": "sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-syntax-dynamic-import": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz",
+ "integrity": "sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-syntax-json-strings": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz",
+ "integrity": "sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-syntax-object-rest-spread": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz",
+ "integrity": "sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-syntax-optional-catch-binding": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz",
+ "integrity": "sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-syntax-top-level-await": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.0.tgz",
+ "integrity": "sha512-hi8FUNiFIY1fnUI2n1ViB1DR0R4QeK4iHcTlW6aJkrPoTdb8Rf1EMQ6GT3f67DDkYyWgew9DFoOZ6gOoEsdzTA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-arrow-functions": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz",
+ "integrity": "sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-async-to-generator": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.0.tgz",
+ "integrity": "sha512-vLI2EFLVvRBL3d8roAMqtVY0Bm9C1QzLkdS57hiKrjUBSqsQYrBsMCeOg/0KK7B0eK9V71J5mWcha9yyoI2tZw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/helper-remap-async-to-generator": "^7.7.0"
+ }
+ },
+ "@babel/plugin-transform-block-scoped-functions": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz",
+ "integrity": "sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-block-scoping": {
+ "version": "7.6.3",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz",
+ "integrity": "sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "lodash": "^4.17.13"
+ }
+ },
+ "@babel/plugin-transform-classes": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.0.tgz",
+ "integrity": "sha512-/b3cKIZwGeUesZheU9jNYcwrEA7f/Bo4IdPmvp7oHgvks2majB5BoT5byAql44fiNQYOPzhk2w8DbgfuafkMoA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.7.0",
+ "@babel/helper-define-map": "^7.7.0",
+ "@babel/helper-function-name": "^7.7.0",
+ "@babel/helper-optimise-call-expression": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/helper-replace-supers": "^7.7.0",
+ "@babel/helper-split-export-declaration": "^7.7.0",
+ "globals": "^11.1.0"
+ }
+ },
+ "@babel/plugin-transform-computed-properties": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz",
+ "integrity": "sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-destructuring": {
+ "version": "7.6.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz",
+ "integrity": "sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-dotall-regex": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.0.tgz",
+ "integrity": "sha512-3QQlF7hSBnSuM1hQ0pS3pmAbWLax/uGNCbPBND9y+oJ4Y776jsyujG2k0Sn2Aj2a0QwVOiOFL5QVPA7spjvzSA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-duplicate-keys": {
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz",
+ "integrity": "sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-exponentiation-operator": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz",
+ "integrity": "sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-builder-binary-assignment-operator-visitor": "^7.1.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-for-of": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz",
+ "integrity": "sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-function-name": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.0.tgz",
+ "integrity": "sha512-P5HKu0d9+CzZxP5jcrWdpe7ZlFDe24bmqP6a6X8BHEBl/eizAsY8K6LX8LASZL0Jxdjm5eEfzp+FIrxCm/p8bA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-function-name": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-literals": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz",
+ "integrity": "sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-member-expression-literals": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz",
+ "integrity": "sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-modules-amd": {
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz",
+ "integrity": "sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.1.0",
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "babel-plugin-dynamic-import-node": "^2.3.0"
+ }
+ },
+ "@babel/plugin-transform-modules-commonjs": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.0.tgz",
+ "integrity": "sha512-KEMyWNNWnjOom8vR/1+d+Ocz/mILZG/eyHHO06OuBQ2aNhxT62fr4y6fGOplRx+CxCSp3IFwesL8WdINfY/3kg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/helper-simple-access": "^7.7.0",
+ "babel-plugin-dynamic-import-node": "^2.3.0"
+ }
+ },
+ "@babel/plugin-transform-modules-systemjs": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.0.tgz",
+ "integrity": "sha512-ZAuFgYjJzDNv77AjXRqzQGlQl4HdUM6j296ee4fwKVZfhDR9LAGxfvXjBkb06gNETPnN0sLqRm9Gxg4wZH6dXg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-hoist-variables": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "babel-plugin-dynamic-import-node": "^2.3.0"
+ }
+ },
+ "@babel/plugin-transform-modules-umd": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.0.tgz",
+ "integrity": "sha512-u7eBA03zmUswQ9LQ7Qw0/ieC1pcAkbp5OQatbWUzY1PaBccvuJXUkYzoN1g7cqp7dbTu6Dp9bXyalBvD04AANA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-named-capturing-groups-regex": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.0.tgz",
+ "integrity": "sha512-+SicSJoKouPctL+j1pqktRVCgy+xAch1hWWTMy13j0IflnyNjaoskj+DwRQFimHbLqO3sq2oN2CXMvXq3Bgapg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.7.0"
+ }
+ },
+ "@babel/plugin-transform-new-target": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz",
+ "integrity": "sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-object-super": {
+ "version": "7.5.5",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz",
+ "integrity": "sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/helper-replace-supers": "^7.5.5"
+ }
+ },
+ "@babel/plugin-transform-parameters": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz",
+ "integrity": "sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-call-delegate": "^7.4.4",
+ "@babel/helper-get-function-arity": "^7.0.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-property-literals": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz",
+ "integrity": "sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-regenerator": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.0.tgz",
+ "integrity": "sha512-AXmvnC+0wuj/cFkkS/HFHIojxH3ffSXE+ttulrqWjZZRaUOonfJc60e1wSNT4rV8tIunvu/R3wCp71/tLAa9xg==",
+ "dev": true,
+ "requires": {
+ "regenerator-transform": "^0.14.0"
+ }
+ },
+ "@babel/plugin-transform-reserved-words": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz",
+ "integrity": "sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-shorthand-properties": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz",
+ "integrity": "sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-spread": {
+ "version": "7.6.2",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz",
+ "integrity": "sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-sticky-regex": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz",
+ "integrity": "sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/helper-regex": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-template-literals": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz",
+ "integrity": "sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-annotate-as-pure": "^7.0.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-typeof-symbol": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz",
+ "integrity": "sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/plugin-transform-unicode-regex": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.0.tgz",
+ "integrity": "sha512-RrThb0gdrNwFAqEAAx9OWgtx6ICK69x7i9tCnMdVrxQwSDp/Abu9DXFU5Hh16VP33Rmxh04+NGW28NsIkFvFKA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-create-regexp-features-plugin": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0"
+ }
+ },
+ "@babel/preset-env": {
+ "version": "7.7.1",
+ "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.7.1.tgz",
+ "integrity": "sha512-/93SWhi3PxcVTDpSqC+Dp4YxUu3qZ4m7I76k0w73wYfn7bGVuRIO4QUz95aJksbS+AD1/mT1Ie7rbkT0wSplaA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.7.0",
+ "@babel/helper-plugin-utils": "^7.0.0",
+ "@babel/plugin-proposal-async-generator-functions": "^7.7.0",
+ "@babel/plugin-proposal-dynamic-import": "^7.7.0",
+ "@babel/plugin-proposal-json-strings": "^7.2.0",
+ "@babel/plugin-proposal-object-rest-spread": "^7.6.2",
+ "@babel/plugin-proposal-optional-catch-binding": "^7.2.0",
+ "@babel/plugin-proposal-unicode-property-regex": "^7.7.0",
+ "@babel/plugin-syntax-async-generators": "^7.2.0",
+ "@babel/plugin-syntax-dynamic-import": "^7.2.0",
+ "@babel/plugin-syntax-json-strings": "^7.2.0",
+ "@babel/plugin-syntax-object-rest-spread": "^7.2.0",
+ "@babel/plugin-syntax-optional-catch-binding": "^7.2.0",
+ "@babel/plugin-syntax-top-level-await": "^7.7.0",
+ "@babel/plugin-transform-arrow-functions": "^7.2.0",
+ "@babel/plugin-transform-async-to-generator": "^7.7.0",
+ "@babel/plugin-transform-block-scoped-functions": "^7.2.0",
+ "@babel/plugin-transform-block-scoping": "^7.6.3",
+ "@babel/plugin-transform-classes": "^7.7.0",
+ "@babel/plugin-transform-computed-properties": "^7.2.0",
+ "@babel/plugin-transform-destructuring": "^7.6.0",
+ "@babel/plugin-transform-dotall-regex": "^7.7.0",
+ "@babel/plugin-transform-duplicate-keys": "^7.5.0",
+ "@babel/plugin-transform-exponentiation-operator": "^7.2.0",
+ "@babel/plugin-transform-for-of": "^7.4.4",
+ "@babel/plugin-transform-function-name": "^7.7.0",
+ "@babel/plugin-transform-literals": "^7.2.0",
+ "@babel/plugin-transform-member-expression-literals": "^7.2.0",
+ "@babel/plugin-transform-modules-amd": "^7.5.0",
+ "@babel/plugin-transform-modules-commonjs": "^7.7.0",
+ "@babel/plugin-transform-modules-systemjs": "^7.7.0",
+ "@babel/plugin-transform-modules-umd": "^7.7.0",
+ "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0",
+ "@babel/plugin-transform-new-target": "^7.4.4",
+ "@babel/plugin-transform-object-super": "^7.5.5",
+ "@babel/plugin-transform-parameters": "^7.4.4",
+ "@babel/plugin-transform-property-literals": "^7.2.0",
+ "@babel/plugin-transform-regenerator": "^7.7.0",
+ "@babel/plugin-transform-reserved-words": "^7.2.0",
+ "@babel/plugin-transform-shorthand-properties": "^7.2.0",
+ "@babel/plugin-transform-spread": "^7.6.2",
+ "@babel/plugin-transform-sticky-regex": "^7.2.0",
+ "@babel/plugin-transform-template-literals": "^7.4.4",
+ "@babel/plugin-transform-typeof-symbol": "^7.2.0",
+ "@babel/plugin-transform-unicode-regex": "^7.7.0",
+ "@babel/types": "^7.7.1",
+ "browserslist": "^4.6.0",
+ "core-js-compat": "^3.1.1",
+ "invariant": "^2.2.2",
+ "js-levenshtein": "^1.1.3",
+ "semver": "^5.5.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
+ "@babel/template": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.7.0.tgz",
+ "integrity": "sha512-OKcwSYOW1mhWbnTBgQY5lvg1Fxg+VyfQGjcBduZFljfc044J5iDlnDSfhQ867O17XHiSCxYHUxHg2b7ryitbUQ==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "@babel/parser": "^7.7.0",
+ "@babel/types": "^7.7.0"
+ }
+ },
+ "@babel/traverse": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.7.0.tgz",
+ "integrity": "sha512-ea/3wRZc//e/uwCpuBX2itrhI0U9l7+FsrKWyKGNyvWbuMcCG7ATKY2VI4wlg2b2TA39HHwIxnvmXvtiKsyn7w==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.5.5",
+ "@babel/generator": "^7.7.0",
+ "@babel/helper-function-name": "^7.7.0",
+ "@babel/helper-split-export-declaration": "^7.7.0",
+ "@babel/parser": "^7.7.0",
+ "@babel/types": "^7.7.0",
+ "debug": "^4.1.0",
+ "globals": "^11.1.0",
+ "lodash": "^4.17.13"
+ }
+ },
+ "@babel/types": {
+ "version": "7.7.1",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.7.1.tgz",
+ "integrity": "sha512-kN/XdANDab9x1z5gcjDc9ePpxexkt+1EQ2MQUiM4XnMvQfvp87/+6kY4Ko2maLXH+tei/DgJ/ybFITeqqRwDiA==",
+ "dev": true,
+ "requires": {
"esutils": "^2.0.2",
- "js-tokens": "^4.0.0"
+ "lodash": "^4.17.13",
+ "to-fast-properties": "^2.0.0"
}
},
"@markedjs/html-differ": {
@@ -45,6 +847,12 @@
"@types/node": "*"
}
},
+ "@types/estree": {
+ "version": "0.0.39",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
+ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
+ "dev": true
+ },
"@types/form-data": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz",
@@ -67,9 +875,9 @@
"dev": true
},
"@types/qs": {
- "version": "6.5.1",
- "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.5.1.tgz",
- "integrity": "sha512-mNhVdZHdtKHMMxbqzNK3RzkBcN1cux3AvuCYGTvjEIQT2uheH3eCAyYsbMbh2Bq8nXkeOWs1kyDiF7geWRFQ4Q==",
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.5.3.tgz",
+ "integrity": "sha512-Jugo5V/1bS0fRhy2z8+cUAHEyWOATaz4rbyLVvcFs7+dXp5HfwpEwzF1Q11bB10ApUqHf+yTauxI0UXQDwGrbA==",
"dev": true
},
"abbrev": {
@@ -79,15 +887,15 @@
"dev": true
},
"acorn": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz",
- "integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==",
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
+ "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"dev": true
},
"acorn-jsx": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.2.tgz",
- "integrity": "sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz",
+ "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==",
"dev": true
},
"ajv": {
@@ -103,15 +911,18 @@
}
},
"ansi-escapes": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
- "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
- "dev": true
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.2.1.tgz",
+ "integrity": "sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q==",
+ "dev": true,
+ "requires": {
+ "type-fest": "^0.5.2"
+ }
},
"ansi-regex": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
- "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"ansi-styles": {
@@ -160,6 +971,15 @@
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
"dev": true
},
+ "babel-plugin-dynamic-import-node": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz",
+ "integrity": "sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ==",
+ "dev": true,
+ "requires": {
+ "object.assign": "^4.1.0"
+ }
+ },
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@@ -182,12 +1002,35 @@
"concat-map": "0.0.1"
}
},
+ "browserslist": {
+ "version": "4.7.2",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.7.2.tgz",
+ "integrity": "sha512-uZavT/gZXJd2UTi9Ov7/Z340WOSQ3+m1iBVRUknf+okKxonL9P83S3ctiBDtuRmRu8PiCHjqyueqQ9HYlJhxiw==",
+ "dev": true,
+ "requires": {
+ "caniuse-lite": "^1.0.30001004",
+ "electron-to-chromium": "^1.3.295",
+ "node-releases": "^1.1.38"
+ }
+ },
+ "buffer-from": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
+ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
+ "dev": true
+ },
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true
},
+ "caniuse-lite": {
+ "version": "1.0.30001008",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001008.tgz",
+ "integrity": "sha512-b8DJyb+VVXZGRgJUa30cbk8gKHZ3LOZTBLaUEEVr2P4xpmFigOCc62CO4uzquW641Ouq1Rm9N+rWLWdSYDaDIw==",
+ "dev": true
+ },
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
@@ -237,12 +1080,12 @@
}
},
"cli-cursor": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
- "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
+ "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
"dev": true,
"requires": {
- "restore-cursor": "^2.0.0"
+ "restore-cursor": "^3.1.0"
}
},
"cli-width": {
@@ -278,18 +1121,24 @@
"dev": true
},
"combined-stream": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
- "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"requires": {
"delayed-stream": "~1.0.0"
}
},
"commander": {
- "version": "2.20.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
- "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "dev": true
+ },
+ "commenting": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/commenting/-/commenting-1.1.0.tgz",
+ "integrity": "sha512-YeNK4tavZwtH7jEgK1ZINXzLKm6DZdEMfsaaieOsCAN0S8vsY7UeuO3Q7d/M018EFgE+IeUAuBOKkFccBZsUZA==",
"dev": true
},
"commonmark": {
@@ -311,41 +1160,36 @@
"dev": true
},
"concat-stream": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz",
- "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=",
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"dev": true,
"requires": {
+ "buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
},
"dependencies": {
- "isarray": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
- "dev": true
- },
"readable-stream": {
- "version": "2.3.3",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
- "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
+ "version": "2.3.6",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
+ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
- "process-nextick-args": "~1.0.6",
+ "process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
- "string_decoder": "~1.0.3",
+ "string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"string_decoder": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
- "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
@@ -359,6 +1203,25 @@
"integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=",
"dev": true
},
+ "convert-source-map": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
+ "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.1"
+ }
+ },
+ "core-js-compat": {
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.3.6.tgz",
+ "integrity": "sha512-YnwZG/+0/f7Pf6Lr3jxtVAFjtGBW9lsLYcqrxhYJai1GfvrP8DEyEpnNzj/FRQfIkOOfk1j5tTBvPBLWVVJm4A==",
+ "dev": true,
+ "requires": {
+ "browserslist": "^4.7.2",
+ "semver": "^6.3.0"
+ }
+ },
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@@ -484,10 +1347,16 @@
"domelementtype": "1"
}
},
+ "electron-to-chromium": {
+ "version": "1.3.303",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.303.tgz",
+ "integrity": "sha512-xDFPmMjJ0gQBsVwspB0bjcbFn3MVcvU0sxXYmh1UMbZ6rDogQVM3vSyOvTO4rym1KlnJIU6nqzK3qs0yKudmjw==",
+ "dev": true
+ },
"emoji-regex": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
- "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"entities": {
@@ -537,9 +1406,9 @@
"dev": true
},
"eslint": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.4.0.tgz",
- "integrity": "sha512-WTVEzK3lSFoXUovDHEbkJqCVPEPwbhCq4trDktNI6ygs7aO41d4cDT0JFAT5MivzZeVLWlg7vHL+bgrQv/t3vA==",
+ "version": "6.6.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.6.0.tgz",
+ "integrity": "sha512-PpEBq7b6qY/qrOmpYQ/jTMDYfuQMELR4g4WI1M/NaSDDD/bdcMb+dj4Hgks7p41kW2caXsPsEZAEAyAgjVVC0g==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@@ -549,9 +1418,9 @@
"debug": "^4.0.1",
"doctrine": "^3.0.0",
"eslint-scope": "^5.0.0",
- "eslint-utils": "^1.4.2",
+ "eslint-utils": "^1.4.3",
"eslint-visitor-keys": "^1.1.0",
- "espree": "^6.1.1",
+ "espree": "^6.1.2",
"esquery": "^1.0.1",
"esutils": "^2.0.2",
"file-entry-cache": "^5.0.1",
@@ -561,7 +1430,7 @@
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
- "inquirer": "^6.4.1",
+ "inquirer": "^7.0.0",
"is-glob": "^4.0.0",
"js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1",
@@ -579,6 +1448,17 @@
"table": "^5.2.3",
"text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3"
+ },
+ "dependencies": {
+ "eslint-utils": {
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz",
+ "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==",
+ "dev": true,
+ "requires": {
+ "eslint-visitor-keys": "^1.1.0"
+ }
+ }
}
},
"eslint-config-standard": {
@@ -739,16 +1619,6 @@
"integrity": "sha512-v/KBnfyaOMPmZc/dmc6ozOdWqekGp7bBGq4jLAecEfPGmfKiWS4sA8sC0LqiV9w5qmXAtXVn4M3p1jSyhY85SQ==",
"dev": true
},
- "eslint-plugin-vuln-regex-detector": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/eslint-plugin-vuln-regex-detector/-/eslint-plugin-vuln-regex-detector-1.0.4.tgz",
- "integrity": "sha512-MlGNEvfk/lmHrbp6gIXKP2NPedA+wX2+KwezolXLE6t9q0pcmohkYm2EKmgL9z5n57CAIYFJ/I4SSI3ANWyl/A==",
- "dev": true,
- "requires": {
- "requireindex": "~1.1.0",
- "vuln-regex-detector": "^1.3.0"
- }
- },
"eslint-scope": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz",
@@ -775,13 +1645,13 @@
"dev": true
},
"espree": {
- "version": "6.1.1",
- "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.1.tgz",
- "integrity": "sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ==",
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz",
+ "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==",
"dev": true,
"requires": {
- "acorn": "^7.0.0",
- "acorn-jsx": "^5.0.2",
+ "acorn": "^7.1.0",
+ "acorn-jsx": "^5.1.0",
"eslint-visitor-keys": "^1.1.0"
}
},
@@ -815,6 +1685,12 @@
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"dev": true
},
+ "estree-walker": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
+ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
+ "dev": true
+ },
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
@@ -851,9 +1727,9 @@
"dev": true
},
"figures": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
- "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz",
+ "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==",
"dev": true,
"requires": {
"escape-string-regexp": "^1.0.5"
@@ -895,13 +1771,13 @@
"dev": true
},
"form-data": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
- "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
+ "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"dev": true,
"requires": {
"asynckit": "^0.4.0",
- "combined-stream": "1.0.6",
+ "combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
}
},
@@ -953,9 +1829,9 @@
}
},
"glob-parent": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.0.0.tgz",
- "integrity": "sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
+ "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
@@ -1018,26 +1894,32 @@
}
},
"http-basic": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-7.0.0.tgz",
- "integrity": "sha1-gvClBr6UJzLsje6+6A50bvVzbbo=",
+ "version": "8.1.3",
+ "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz",
+ "integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==",
"dev": true,
"requires": {
- "@types/concat-stream": "^1.6.0",
- "@types/node": "^9.4.1",
- "caseless": "~0.12.0",
- "concat-stream": "^1.4.6",
+ "caseless": "^0.12.0",
+ "concat-stream": "^1.6.2",
"http-response-object": "^3.0.1",
"parse-cache-control": "^1.0.1"
}
},
"http-response-object": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.1.tgz",
- "integrity": "sha512-6L0Fkd6TozA8kFSfh9Widst0wfza3U1Ex2RjJ6zNDK0vR1U1auUR6jY4Nn2Xl7CCy0ikFmxW1XcspVpb9RvwTg==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz",
+ "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==",
"dev": true,
"requires": {
- "@types/node": "^9.3.0"
+ "@types/node": "^10.0.3"
+ },
+ "dependencies": {
+ "@types/node": {
+ "version": "10.17.4",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.4.tgz",
+ "integrity": "sha512-F2pgg+LcIr/elguz+x+fdBX5KeZXGUOp7TV8M0TVIrDezYLFRNt8oMTyps0VQ1kj5WGGoR18RdxnRDHXrIFHMQ==",
+ "dev": true
+ }
}
},
"iconv-lite": {
@@ -1088,24 +1970,41 @@
"dev": true
},
"inquirer": {
- "version": "6.5.2",
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",
- "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.0.tgz",
+ "integrity": "sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ==",
"dev": true,
"requires": {
- "ansi-escapes": "^3.2.0",
+ "ansi-escapes": "^4.2.1",
"chalk": "^2.4.2",
- "cli-cursor": "^2.1.0",
+ "cli-cursor": "^3.1.0",
"cli-width": "^2.0.0",
"external-editor": "^3.0.3",
- "figures": "^2.0.0",
- "lodash": "^4.17.12",
- "mute-stream": "0.0.7",
+ "figures": "^3.0.0",
+ "lodash": "^4.17.15",
+ "mute-stream": "0.0.8",
"run-async": "^2.2.0",
"rxjs": "^6.4.0",
- "string-width": "^2.1.0",
+ "string-width": "^4.1.0",
"strip-ansi": "^5.1.0",
"through": "^2.3.6"
+ },
+ "dependencies": {
+ "lodash": {
+ "version": "4.17.15",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
+ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
+ "dev": true
+ }
+ }
+ },
+ "invariant": {
+ "version": "2.2.4",
+ "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
+ "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
+ "dev": true,
+ "requires": {
+ "loose-envify": "^1.0.0"
}
},
"is-arrayish": {
@@ -1133,9 +2032,9 @@
"dev": true
},
"is-fullwidth-code-point": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
- "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"is-glob": {
@@ -1153,6 +2052,15 @@
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
"dev": true
},
+ "is-reference": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz",
+ "integrity": "sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==",
+ "dev": true,
+ "requires": {
+ "@types/estree": "0.0.39"
+ }
+ },
"is-regex": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
@@ -1199,6 +2107,12 @@
"integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==",
"dev": true
},
+ "js-levenshtein": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz",
+ "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==",
+ "dev": true
+ },
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -1215,6 +2129,12 @@
"esprima": "^4.0.0"
}
},
+ "jsesc": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
+ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "dev": true
+ },
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -1227,6 +2147,15 @@
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true
},
+ "json5": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz",
+ "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.0"
+ }
+ },
"levn": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
@@ -1274,6 +2203,15 @@
"integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==",
"dev": true
},
+ "loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "dev": true,
+ "requires": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ }
+ },
"lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
@@ -1283,6 +2221,15 @@
"yallist": "^3.0.2"
}
},
+ "magic-string": {
+ "version": "0.25.4",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.4.tgz",
+ "integrity": "sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw==",
+ "dev": true,
+ "requires": {
+ "sourcemap-codec": "^1.4.4"
+ }
+ },
"markdown": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/markdown/-/markdown-0.5.0.tgz",
@@ -1320,24 +2267,24 @@
"dev": true
},
"mime-db": {
- "version": "1.33.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
- "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==",
+ "version": "1.40.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
+ "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==",
"dev": true
},
"mime-types": {
- "version": "2.1.18",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
- "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
+ "version": "2.1.24",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
+ "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
"dev": true,
"requires": {
- "mime-db": "~1.33.0"
+ "mime-db": "1.40.0"
}
},
"mimic-fn": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
- "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"dev": true
},
"minimatch": {
@@ -1372,6 +2319,12 @@
}
}
},
+ "moment": {
+ "version": "2.24.0",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
+ "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==",
+ "dev": true
+ },
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -1379,9 +2332,9 @@
"dev": true
},
"mute-stream": {
- "version": "0.0.7",
- "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
- "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
+ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
"dev": true
},
"natural-compare": {
@@ -1402,6 +2355,15 @@
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==",
"dev": true
},
+ "node-releases": {
+ "version": "1.1.39",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.39.tgz",
+ "integrity": "sha512-8MRC/ErwNCHOlAFycy9OPca46fQYUjbJRDcZTHVWIGXIjYLM73k70vv3WkYutVnM4cCo4hE0MqBVVZjP6vjISA==",
+ "dev": true,
+ "requires": {
+ "semver": "^6.3.0"
+ }
+ },
"nopt": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-2.1.2.tgz",
@@ -1446,6 +2408,18 @@
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
"dev": true
},
+ "object.assign": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz",
+ "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "function-bind": "^1.1.1",
+ "has-symbols": "^1.0.0",
+ "object-keys": "^1.0.11"
+ }
+ },
"object.values": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.0.tgz",
@@ -1468,12 +2442,12 @@
}
},
"onetime": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
- "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz",
+ "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==",
"dev": true,
"requires": {
- "mimic-fn": "^1.0.0"
+ "mimic-fn": "^2.1.0"
}
},
"optionator": {
@@ -1613,10 +2587,16 @@
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
"dev": true
},
+ "private": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
+ "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==",
+ "dev": true
+ },
"process-nextick-args": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
- "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"dev": true
},
"progress": {
@@ -1626,12 +2606,12 @@
"dev": true
},
"promise": {
- "version": "8.0.1",
- "resolved": "https://registry.npmjs.org/promise/-/promise-8.0.1.tgz",
- "integrity": "sha1-5F1osAoXZHttpxG/he1u1HII9FA=",
+ "version": "8.0.3",
+ "resolved": "https://registry.npmjs.org/promise/-/promise-8.0.3.tgz",
+ "integrity": "sha512-HeRDUL1RJiLhyA0/grn+PTShlBAcLuh/1BJGtrvjwbvRDCTLLMEz9rOGCV+R3vHY4MixIuoMEd9Yq/XvsTPcjw==",
"dev": true,
"requires": {
- "asap": "~2.0.3"
+ "asap": "~2.0.6"
}
},
"punycode": {
@@ -1647,9 +2627,9 @@
"dev": true
},
"qs": {
- "version": "6.5.1",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
- "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==",
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.0.tgz",
+ "integrity": "sha512-27RP4UotQORTpmNQDX8BHPukOnBP3p1uUJY5UnDhaJB+rMt9iMsok724XL+UHU23bEFOHRMQ2ZhI99qOWUMGFA==",
"dev": true
},
"read-pkg": {
@@ -1684,18 +2664,73 @@
"util-deprecate": "^1.0.1"
}
},
+ "regenerate": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
+ "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==",
+ "dev": true
+ },
+ "regenerate-unicode-properties": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz",
+ "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==",
+ "dev": true,
+ "requires": {
+ "regenerate": "^1.4.0"
+ }
+ },
+ "regenerator-transform": {
+ "version": "0.14.1",
+ "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.1.tgz",
+ "integrity": "sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ==",
+ "dev": true,
+ "requires": {
+ "private": "^0.1.6"
+ }
+ },
"regexpp": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz",
"integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==",
"dev": true
},
- "requireindex": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.1.0.tgz",
- "integrity": "sha1-5UBLgVV+91225JxacgBIk/4D4WI=",
+ "regexpu-core": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.6.0.tgz",
+ "integrity": "sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg==",
+ "dev": true,
+ "requires": {
+ "regenerate": "^1.4.0",
+ "regenerate-unicode-properties": "^8.1.0",
+ "regjsgen": "^0.5.0",
+ "regjsparser": "^0.6.0",
+ "unicode-match-property-ecmascript": "^1.0.4",
+ "unicode-match-property-value-ecmascript": "^1.1.0"
+ }
+ },
+ "regjsgen": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.1.tgz",
+ "integrity": "sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg==",
"dev": true
},
+ "regjsparser": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz",
+ "integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==",
+ "dev": true,
+ "requires": {
+ "jsesc": "~0.5.0"
+ },
+ "dependencies": {
+ "jsesc": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
+ "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
+ "dev": true
+ }
+ }
+ },
"resolve": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz",
@@ -1712,12 +2747,12 @@
"dev": true
},
"restore-cursor": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
- "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
+ "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
"dev": true,
"requires": {
- "onetime": "^2.0.0",
+ "onetime": "^5.1.0",
"signal-exit": "^3.0.2"
}
},
@@ -1730,6 +2765,88 @@
"glob": "^7.1.3"
}
},
+ "rollup": {
+ "version": "1.26.3",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.26.3.tgz",
+ "integrity": "sha512-8MhY/M8gnv3Q/pQQSWYWzbeJ5J1C5anCNY5BK1kV8Yzw9RFS0FF4lbLt+uyPO3wLKWXSXrhAL5pWL85TZAh+Sw==",
+ "dev": true,
+ "requires": {
+ "@types/estree": "*",
+ "@types/node": "*",
+ "acorn": "^7.1.0"
+ },
+ "dependencies": {
+ "acorn": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
+ "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
+ "dev": true
+ }
+ }
+ },
+ "rollup-plugin-babel": {
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.3.3.tgz",
+ "integrity": "sha512-tKzWOCmIJD/6aKNz0H1GMM+lW1q9KyFubbWzGiOG540zxPPifnEAHTZwjo0g991Y+DyOZcLqBgqOdqazYE5fkw==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-imports": "^7.0.0",
+ "rollup-pluginutils": "^2.8.1"
+ }
+ },
+ "rollup-plugin-commonjs": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz",
+ "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==",
+ "dev": true,
+ "requires": {
+ "estree-walker": "^0.6.1",
+ "is-reference": "^1.1.2",
+ "magic-string": "^0.25.2",
+ "resolve": "^1.11.0",
+ "rollup-pluginutils": "^2.8.1"
+ }
+ },
+ "rollup-plugin-license": {
+ "version": "0.12.1",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-0.12.1.tgz",
+ "integrity": "sha512-zT8UO+Tc+DAVQHM5qeX4jnuHzTtDUYJ/8AHzUgVgqYrx5Wj5kHlvoZNaQqg7hOQbjSuHuJFlQGZmxxSQq2WMqA==",
+ "dev": true,
+ "requires": {
+ "commenting": "1.1.0",
+ "glob": "7.1.4",
+ "lodash": "4.17.15",
+ "magic-string": "0.25.3",
+ "mkdirp": "0.5.1",
+ "moment": "2.24.0"
+ },
+ "dependencies": {
+ "lodash": {
+ "version": "4.17.15",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
+ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
+ "dev": true
+ },
+ "magic-string": {
+ "version": "0.25.3",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz",
+ "integrity": "sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==",
+ "dev": true,
+ "requires": {
+ "sourcemap-codec": "^1.4.4"
+ }
+ }
+ }
+ },
+ "rollup-pluginutils": {
+ "version": "2.8.2",
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz",
+ "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==",
+ "dev": true,
+ "requires": {
+ "estree-walker": "^0.6.1"
+ }
+ },
"run-async": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
@@ -1796,6 +2913,14 @@
"ansi-styles": "^3.2.0",
"astral-regex": "^1.0.0",
"is-fullwidth-code-point": "^2.0.0"
+ },
+ "dependencies": {
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ }
}
},
"source-map": {
@@ -1804,6 +2929,12 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
+ "sourcemap-codec": {
+ "version": "1.4.6",
+ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz",
+ "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==",
+ "dev": true
+ },
"spdx-correct": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz",
@@ -1843,24 +2974,14 @@
"dev": true
},
"string-width": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
- "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.1.0.tgz",
+ "integrity": "sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ==",
"dev": true,
"requires": {
- "is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^4.0.0"
- },
- "dependencies": {
- "strip-ansi": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
- "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
- "dev": true,
- "requires": {
- "ansi-regex": "^3.0.0"
- }
- }
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^5.2.0"
}
},
"string.prototype.repeat": {
@@ -1885,14 +3006,6 @@
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
- "dev": true
- }
}
},
"strip-bom": {
@@ -1917,9 +3030,9 @@
}
},
"sync-request": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.0.0.tgz",
- "integrity": "sha512-jGNIAlCi9iU4X3Dm4oQnNQshDD3h0/1A7r79LyqjbjUnj69sX6mShAXlhRXgImsfVKtTcnra1jfzabdZvp+Lmw==",
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz",
+ "integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==",
"dev": true,
"requires": {
"http-response-object": "^3.0.1",
@@ -1928,9 +3041,9 @@
}
},
"sync-rpc": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.3.tgz",
- "integrity": "sha512-xtTZUAeFaescZALim6yqjMDsVQD7mKAkdZ0/FOvVjlrr4uQqrARlWxs4P7bKV2ZPnvOyTVyHyyxqztxtBF4iIw==",
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz",
+ "integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==",
"dev": true,
"requires": {
"get-port": "^3.1.0"
@@ -1948,6 +3061,18 @@
"string-width": "^3.0.0"
},
"dependencies": {
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
@@ -1968,9 +3093,9 @@
"dev": true
},
"then-request": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.0.tgz",
- "integrity": "sha512-xA+7uEMc+jsQIoyySJ93Ad08Kuqnik7u6jLS5hR91Z3smAoCfL3M8/MqMlobAa9gzBfO9pA88A/AntfepkkMJQ==",
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz",
+ "integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==",
"dev": true,
"requires": {
"@types/concat-stream": "^1.6.0",
@@ -1980,16 +3105,16 @@
"caseless": "~0.12.0",
"concat-stream": "^1.6.0",
"form-data": "^2.2.0",
- "http-basic": "^7.0.0",
+ "http-basic": "^8.1.1",
"http-response-object": "^3.0.1",
"promise": "^8.0.0",
"qs": "^6.4.0"
},
"dependencies": {
"@types/node": {
- "version": "8.10.8",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.8.tgz",
- "integrity": "sha512-BvcUxNZe9JgiiUVivtiQt3NrPVu9OAQzkxR1Ko9ESftCYU7V6Np5kpDzQwxd+34lsop7SNRdL292Flv52OvCaw==",
+ "version": "8.10.58",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.58.tgz",
+ "integrity": "sha512-NNcUk/rAdR7Pie7WiA5NHp345dTkD62qaxqscQXVIjCjog/ZXsrG8Wo7dZMZAzE7PSpA+qR2S3TYTeFCKuBFxQ==",
"dev": true
}
}
@@ -2009,6 +3134,12 @@
"os-tmpdir": "~1.0.2"
}
},
+ "to-fast-properties": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
+ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
+ "dev": true
+ },
"tslib": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
@@ -2024,6 +3155,12 @@
"prelude-ls": "~1.1.2"
}
},
+ "type-fest": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.5.2.tgz",
+ "integrity": "sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==",
+ "dev": true
+ },
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -2037,15 +3174,43 @@
"dev": true
},
"uglify-js": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
- "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
+ "version": "3.6.8",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.8.tgz",
+ "integrity": "sha512-XhHJ3S3ZyMwP8kY1Gkugqx3CJh2C3O0y8NPiSxtm1tyD/pktLAkFZsFGpuNfTZddKDQ/bbDBLAd2YyA1pbi8HQ==",
"dev": true,
"requires": {
- "commander": "~2.20.0",
+ "commander": "~2.20.3",
"source-map": "~0.6.1"
}
},
+ "unicode-canonical-property-names-ecmascript": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
+ "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==",
+ "dev": true
+ },
+ "unicode-match-property-ecmascript": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz",
+ "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==",
+ "dev": true,
+ "requires": {
+ "unicode-canonical-property-names-ecmascript": "^1.0.4",
+ "unicode-property-aliases-ecmascript": "^1.0.4"
+ }
+ },
+ "unicode-match-property-value-ecmascript": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz",
+ "integrity": "sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==",
+ "dev": true
+ },
+ "unicode-property-aliases-ecmascript": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz",
+ "integrity": "sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw==",
+ "dev": true
+ },
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
diff --git a/package.json b/package.json
index ffa8085b89..9601209342 100644
--- a/package.json
+++ b/package.json
@@ -3,12 +3,17 @@
"description": "A markdown parser built for speed",
"author": "Christopher Jeffrey",
"version": "0.7.0",
- "main": "./lib/marked.js",
+ "main": "./src/marked.js",
+ "module": "./lib/marked.esm.js",
+ "browser": {
+ "./src/marked.js": "./lib/marked.js"
+ },
"bin": "./bin/marked",
"man": "./man/marked.1",
"files": [
"bin/",
"lib/",
+ "src/",
"man/",
"marked.min.js"
],
@@ -29,38 +34,48 @@
"html"
],
"devDependencies": {
+ "@babel/core": "^7.7.0",
+ "@babel/preset-env": "^7.7.1",
"@markedjs/html-differ": "^3.0.0",
"cheerio": "^1.0.0-rc.3",
"commonmark": "0.29.x",
- "eslint": "^6.4.0",
+ "eslint": "^6.6.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
- "eslint-plugin-vuln-regex-detector": "^1.0.4",
"front-matter": "^3.0.2",
"jasmine": "^3.5.0",
"markdown": "0.5.x",
"markdown-it": "10.x",
"node-fetch": "^2.6.0",
- "uglify-js": "^3.6.0"
+ "rollup": "^1.26.3",
+ "rollup-plugin-babel": "^4.3.3",
+ "rollup-plugin-commonjs": "^10.1.0",
+ "rollup-plugin-license": "^0.12.1",
+ "uglify-js": "^3.6.8",
+ "vuln-regex-detector": "^1.3.0"
},
"scripts": {
"test": "jasmine --config=jasmine.json",
- "test:all": "npm test && npm run test:node4 && npm run test:lint",
+ "test:all": "npm test && npm run test:lint",
"test:unit": "npm test -- test/unit/**/*-spec.js",
"test:specs": "npm test -- test/specs/**/*-spec.js",
"test:lint": "eslint bin/marked .",
- "test:redos": "eslint --plugin vuln-regex-detector --rule '\"vuln-regex-detector/no-vuln-regex\": 2' lib/marked.js",
- "test:node4": "npx node@4 ./node_modules/jasmine/bin/jasmine.js --config=jasmine.json",
+ "test:redos": "node test/vuln-regex.js",
"test:update": "node test/update-specs.js",
- "bench": "node test/bench.js",
+ "bench": "npm run rollup && node test/bench.js",
"lint": "eslint --fix bin/marked .",
- "build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js",
- "preversion": "npm run build && (git diff --quiet || git commit -am 'minify')"
+ "build:reset": "git checkout upstream/master lib/marked.js lib/marked.esm.js marked.min.js",
+ "build": "npm run rollup && npm run minify",
+ "rollup": "npm run rollup:umd && npm run rollup:esm",
+ "rollup:umd": "rollup -c rollup.config.js",
+ "rollup:esm": "rollup -c rollup.config.esm.js",
+ "minify": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js",
+ "preversion": "npm run build && (git diff --quiet || git commit -am 'build')"
},
"engines": {
- "node": ">=0.10.0"
+ "node": ">= 8.16.2"
}
}
diff --git a/rollup.config.esm.js b/rollup.config.esm.js
new file mode 100644
index 0000000000..47590d59ea
--- /dev/null
+++ b/rollup.config.esm.js
@@ -0,0 +1,26 @@
+const commonjs = require('rollup-plugin-commonjs');
+const license = require('rollup-plugin-license');
+
+module.exports = {
+ input: 'src/marked.js',
+ output: {
+ file: 'lib/marked.esm.js',
+ format: 'esm'
+ },
+ plugins: [
+ license({
+ banner: `
+DO NOT EDIT THIS FILE
+The code in this file is generated from files in ./src/
+`
+ }),
+ license({
+ banner: `
+marked - a markdown parser
+Copyright (c) 2011-${new Date().getFullYear()}, Christopher Jeffrey. (MIT Licensed)
+https://github.com/markedjs/marked
+`
+ }),
+ commonjs()
+ ]
+};
diff --git a/rollup.config.js b/rollup.config.js
new file mode 100644
index 0000000000..8a685e2c57
--- /dev/null
+++ b/rollup.config.js
@@ -0,0 +1,31 @@
+const commonjs = require('rollup-plugin-commonjs');
+const babel = require('rollup-plugin-babel');
+const license = require('rollup-plugin-license');
+
+module.exports = {
+ input: 'src/marked.js',
+ output: {
+ file: 'lib/marked.js',
+ format: 'umd',
+ name: 'marked'
+ },
+ plugins: [
+ license({
+ banner: `
+DO NOT EDIT THIS FILE
+The code in this file is generated from files in ./src/
+`
+ }),
+ license({
+ banner: `
+marked - a markdown parser
+Copyright (c) 2011-${new Date().getFullYear()}, Christopher Jeffrey. (MIT Licensed)
+https://github.com/markedjs/marked
+`
+ }),
+ commonjs(),
+ babel({
+ presets: ['@babel/preset-env']
+ })
+ ]
+};
diff --git a/src/InlineLexer.js b/src/InlineLexer.js
new file mode 100644
index 0000000000..d0c9d4129b
--- /dev/null
+++ b/src/InlineLexer.js
@@ -0,0 +1,293 @@
+const Renderer = require('./Renderer.js');
+const { defaults } = require('./defaults.js');
+const { inline } = require('./rules.js');
+const {
+ findClosingBracket,
+ escape
+} = require('./helpers.js');
+
+/**
+ * Inline Lexer & Compiler
+ */
+module.exports = class InlineLexer {
+ constructor(links, options) {
+ this.options = options || defaults;
+ this.links = links;
+ this.rules = inline.normal;
+ this.options.renderer = this.options.renderer || new Renderer();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+
+ if (!this.links) {
+ throw new Error('Tokens array requires a `links` property.');
+ }
+
+ if (this.options.pedantic) {
+ this.rules = inline.pedantic;
+ } else if (this.options.gfm) {
+ if (this.options.breaks) {
+ this.rules = inline.breaks;
+ } else {
+ this.rules = inline.gfm;
+ }
+ }
+ }
+
+ /**
+ * Expose Inline Rules
+ */
+ static get rules() {
+ return inline;
+ }
+
+ /**
+ * Static Lexing/Compiling Method
+ */
+ static output(src, links, options) {
+ const inline = new InlineLexer(links, options);
+ return inline.output(src);
+ }
+
+ /**
+ * Lexing/Compiling
+ */
+ output(src) {
+ let 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(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;
+ }
+
+ src = src.substring(cap[0].length);
+ out += this.options.sanitize
+ ? this.options.sanitizer
+ ? this.options.sanitizer(cap[0])
+ : escape(cap[0])
+ : cap[0];
+ continue;
+ }
+
+ // link
+ if (cap = this.rules.link.exec(src)) {
+ const lastParenIndex = findClosingBracket(cap[2], '()');
+ if (lastParenIndex > -1) {
+ const start = cap[0].indexOf('!') === 0 ? 5 : 4;
+ const 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 (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) : '';
+ }
+ 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 ((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;
+ }
+ this.inLink = true;
+ out += this.outputLink(cap, link);
+ this.inLink = false;
+ continue;
+ }
+
+ // strong
+ 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.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.code.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.codespan(escape(cap[2].trim(), true));
+ continue;
+ }
+
+ // br
+ if (cap = this.rules.br.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.br();
+ continue;
+ }
+
+ // del (gfm)
+ 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.autolink.exec(src)) {
+ src = src.substring(cap[0].length);
+ if (cap[2] === '@') {
+ text = escape(this.mangle(cap[1]));
+ href = 'mailto:' + text;
+ } else {
+ text = escape(cap[1]);
+ href = text;
+ }
+ out += this.renderer.link(href, null, text);
+ continue;
+ }
+
+ // url (gfm)
+ if (!this.inLink && (cap = this.rules.url.exec(src))) {
+ if (cap[2] === '@') {
+ text = escape(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(cap[0]);
+ if (cap[1] === 'www.') {
+ href = 'http://' + text;
+ } else {
+ href = text;
+ }
+ }
+ src = src.substring(cap[0].length);
+ out += this.renderer.link(href, null, text);
+ continue;
+ }
+
+ // text
+ if (cap = this.rules.text.exec(src)) {
+ src = src.substring(cap[0].length);
+ if (this.inRawBlock) {
+ out += this.renderer.text(this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0])) : cap[0]);
+ } else {
+ out += this.renderer.text(escape(this.smartypants(cap[0])));
+ }
+ continue;
+ }
+
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
+
+ return out;
+ }
+
+ static escapes(text) {
+ return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
+ }
+
+ /**
+ * Compile Link
+ */
+ outputLink(cap, link) {
+ const href = link.href,
+ title = link.title ? escape(link.title) : null;
+
+ return cap[0].charAt(0) !== '!'
+ ? this.renderer.link(href, title, this.output(cap[1]))
+ : this.renderer.image(href, title, escape(cap[1]));
+ }
+
+ /**
+ * Smartypants Transformations
+ */
+ 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
+ */
+ mangle(text) {
+ if (!this.options.mangle) return text;
+ const l = text.length;
+ let 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;
+ }
+};
diff --git a/src/Lexer.js b/src/Lexer.js
new file mode 100644
index 0000000000..d4ab566294
--- /dev/null
+++ b/src/Lexer.js
@@ -0,0 +1,402 @@
+const { defaults } = require('./defaults.js');
+const { block } = require('./rules.js');
+const {
+ rtrim,
+ splitCells,
+ escape
+} = require('./helpers.js');
+
+/**
+ * Block Lexer
+ */
+module.exports = class Lexer {
+ constructor(options) {
+ this.tokens = [];
+ this.tokens.links = Object.create(null);
+ this.options = options || defaults;
+ this.rules = block.normal;
+
+ if (this.options.pedantic) {
+ this.rules = block.pedantic;
+ } else if (this.options.gfm) {
+ this.rules = block.gfm;
+ }
+ }
+
+ /**
+ * Expose Block Rules
+ */
+ static get rules() {
+ return block;
+ }
+
+ /**
+ * Static Lex Method
+ */
+ static lex(src, options) {
+ const lexer = new Lexer(options);
+ return lexer.lex(src);
+ };
+
+ /**
+ * Preprocessing
+ */
+ lex(src) {
+ src = src
+ .replace(/\r\n|\r/g, '\n')
+ .replace(/\t/g, ' ');
+
+ return this.token(src, true);
+ };
+
+ /**
+ * Lexing
+ */
+ token(src, top) {
+ src = src.replace(/^ +$/gm, '');
+ let 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);
+ if (cap[0].length > 1) {
+ this.tokens.push({
+ type: 'space'
+ });
+ }
+ }
+
+ // code
+ if (cap = this.rules.code.exec(src)) {
+ const lastToken = this.tokens[this.tokens.length - 1];
+ src = src.substring(cap[0].length);
+ // An indented code block cannot interrupt a paragraph.
+ 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(cap, '\n')
+ : cap
+ });
+ }
+ 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(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(item.cells[i], item.header.length);
+ }
+
+ 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
+ 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.
+ 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.
+ 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.
+ if (i !== l - 1) {
+ b = block.bullet.exec(cap[i + 1])[0];
+ 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.
+ loose = next || /\n\n(?!\s*$)/.test(item);
+ if (i !== l - 1) {
+ next = item.charAt(item.length - 1) === '\n';
+ if (!loose) loose = next;
+ }
+
+ if (loose) {
+ listStart.loose = true;
+ }
+
+ // Check for task list items
+ istask = /^\[[ xX]\] /.test(item);
+ ischecked = undefined;
+ if (istask) {
+ ischecked = item[1] !== ' ';
+ item = item.replace(/^\[[ xX]\] +/, '');
+ }
+
+ 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;
+ for (; i < l; i++) {
+ listItems[i].loose = true;
+ }
+ }
+
+ 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(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]
+ };
+ }
+ continue;
+ }
+
+ // table (gfm)
+ if (cap = this.rules.table.exec(src)) {
+ item = {
+ type: 'table',
+ header: splitCells(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(
+ item.cells[i].replace(/^ *\| *| *\| *$/g, ''),
+ item.header.length);
+ }
+
+ this.tokens.push(item);
+
+ continue;
+ }
+ }
+
+ // 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;
+ }
+
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
+
+ return this.tokens;
+ };
+};
diff --git a/src/Parser.js b/src/Parser.js
new file mode 100644
index 0000000000..30011dfe4b
--- /dev/null
+++ b/src/Parser.js
@@ -0,0 +1,206 @@
+const Renderer = require('./Renderer.js');
+const Slugger = require('./Slugger.js');
+const InlineLexer = require('./InlineLexer.js');
+const TextRenderer = require('./TextRenderer.js');
+const { defaults } = require('./defaults.js');
+const {
+ merge,
+ unescape
+} = require('./helpers.js');
+
+/**
+ * Parsing & Compiling
+ */
+module.exports = class Parser {
+ constructor(options) {
+ this.tokens = [];
+ this.token = null;
+ this.options = options || defaults;
+ this.options.renderer = this.options.renderer || new Renderer();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+ this.slugger = new Slugger();
+ }
+
+ /**
+ * Static Parse Method
+ */
+ static parse(tokens, options) {
+ const parser = new Parser(options);
+ return parser.parse(tokens);
+ };
+
+ /**
+ * Parse Loop
+ */
+ parse(tokens) {
+ this.inline = new InlineLexer(tokens.links, this.options);
+ // use an InlineLexer with a TextRenderer to extract pure text
+ this.inlineText = new InlineLexer(
+ tokens.links,
+ merge({}, this.options, { renderer: new TextRenderer() })
+ );
+ this.tokens = tokens.reverse();
+
+ let out = '';
+ while (this.next()) {
+ out += this.tok();
+ }
+
+ return out;
+ };
+
+ /**
+ * Next Token
+ */
+ next() {
+ this.token = this.tokens.pop();
+ return this.token;
+ };
+
+ /**
+ * Preview Next Token
+ */
+ peek() {
+ return this.tokens[this.tokens.length - 1] || 0;
+ };
+
+ /**
+ * Parse Text Tokens
+ */
+ parseText() {
+ let body = this.token.text;
+
+ while (this.peek().type === 'text') {
+ body += '\n' + this.next().text;
+ }
+
+ return this.inline.output(body);
+ };
+
+ /**
+ * Parse Current Token
+ */
+ tok() {
+ let body = '';
+ switch (this.token.type) {
+ case 'space': {
+ return '';
+ }
+ case 'hr': {
+ return this.renderer.hr();
+ }
+ case 'heading': {
+ return this.renderer.heading(
+ this.inline.output(this.token.text),
+ this.token.depth,
+ unescape(this.inlineText.output(this.token.text)),
+ this.slugger);
+ }
+ case 'code': {
+ return this.renderer.code(this.token.text,
+ this.token.lang,
+ this.token.escaped);
+ }
+ case 'table': {
+ let header = '',
+ i,
+ row,
+ cell,
+ j;
+
+ // header
+ cell = '';
+ 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);
+
+ 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] }
+ );
+ }
+
+ body += this.renderer.tablerow(cell);
+ }
+ return this.renderer.table(header, body);
+ }
+ case 'blockquote_start': {
+ body = '';
+
+ while (this.next().type !== 'blockquote_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.blockquote(body);
+ }
+ case 'list_start': {
+ body = '';
+ const ordered = this.token.ordered,
+ start = this.token.start;
+
+ while (this.next().type !== 'list_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.list(body, ordered, start);
+ }
+ case 'list_item_start': {
+ body = '';
+ const loose = this.token.loose;
+ const checked = this.token.checked;
+ const task = this.token.task;
+
+ if (this.token.task) {
+ if (loose) {
+ if (this.peek().type === 'text') {
+ const nextToken = this.peek();
+ nextToken.text = this.renderer.checkbox(checked) + ' ' + nextToken.text;
+ } else {
+ 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);
+ }
+ case 'paragraph': {
+ return this.renderer.paragraph(this.inline.output(this.token.text));
+ }
+ case 'text': {
+ return this.renderer.paragraph(this.parseText());
+ }
+ default: {
+ const errMsg = 'Token with "' + this.token.type + '" type was not found.';
+ if (this.options.silent) {
+ console.log(errMsg);
+ } else {
+ throw new Error(errMsg);
+ }
+ }
+ }
+ };
+};
diff --git a/src/Renderer.js b/src/Renderer.js
new file mode 100644
index 0000000000..d86341a810
--- /dev/null
+++ b/src/Renderer.js
@@ -0,0 +1,164 @@
+const { defaults } = require('./defaults.js');
+const {
+ cleanUrl,
+ escape
+} = require('./helpers.js');
+
+/**
+ * Renderer
+ */
+module.exports = class Renderer {
+ constructor(options) {
+ this.options = options || defaults;
+ }
+
+ code(code, infostring, escaped) {
+ const lang = (infostring || '').match(/\S*/)[0];
+ if (this.options.highlight) {
+ const out = this.options.highlight(code, lang);
+ if (out != null && out !== code) {
+ escaped = true;
+ code = out;
+ }
+ }
+
+ if (!lang) {
+ return ''
+ + (escaped ? code : escape(code, true))
+ + '
';
+ }
+
+ return ''
+ + (escaped ? code : escape(code, true))
+ + '
\n';
+ };
+
+ blockquote(quote) {
+ return '\n' + quote + ' \n';
+ };
+
+ html(html) {
+ return html;
+ };
+
+ heading(text, level, raw, slugger) {
+ if (this.options.headerIds) {
+ return '\n';
+ }
+ // ignore IDs
+ return '' + text + ' \n';
+ };
+
+ hr() {
+ return this.options.xhtml ? ' \n' : ' \n';
+ };
+
+ list(body, ordered, start) {
+ const type = ordered ? 'ol' : 'ul',
+ startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
+ return '<' + type + startatt + '>\n' + body + '' + type + '>\n';
+ };
+
+ listitem(text) {
+ return '' + text + ' \n';
+ };
+
+ checkbox(checked) {
+ return ' ';
+ };
+
+ paragraph(text) {
+ return '' + text + '
\n';
+ };
+
+ table(header, body) {
+ if (body) body = '' + body + ' ';
+
+ return ' \n'
+ + '\n'
+ + header
+ + ' \n'
+ + body
+ + '
\n';
+ };
+
+ tablerow(content) {
+ return '\n' + content + ' \n';
+ };
+
+ tablecell(content, flags) {
+ const type = flags.header ? 'th' : 'td';
+ const tag = flags.align
+ ? '<' + type + ' align="' + flags.align + '">'
+ : '<' + type + '>';
+ return tag + content + '' + type + '>\n';
+ };
+
+ // span level renderer
+ strong(text) {
+ return '' + text + ' ';
+ };
+
+ em(text) {
+ return '' + text + ' ';
+ };
+
+ codespan(text) {
+ return '' + text + '
';
+ };
+
+ br() {
+ return this.options.xhtml ? ' ' : ' ';
+ };
+
+ del(text) {
+ return '' + text + '';
+ };
+
+ link(href, title, text) {
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text;
+ }
+ let out = '' + text + ' ';
+ return out;
+ };
+
+ image(href, title, text) {
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text;
+ }
+
+ let out = ' ' : '>';
+ return out;
+ };
+
+ text(text) {
+ return text;
+ };
+};
diff --git a/src/Slugger.js b/src/Slugger.js
new file mode 100644
index 0000000000..51064211c1
--- /dev/null
+++ b/src/Slugger.js
@@ -0,0 +1,30 @@
+/**
+ * Slugger generates header id
+ */
+module.exports = class Slugger {
+ constructor() {
+ this.seen = {};
+ }
+
+ /**
+ * Convert string to unique id
+ */
+ slug(value) {
+ let slug = value
+ .toLowerCase()
+ .trim()
+ .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
+ .replace(/\s/g, '-');
+
+ if (this.seen.hasOwnProperty(slug)) {
+ const originalSlug = slug;
+ do {
+ this.seen[originalSlug]++;
+ slug = originalSlug + '-' + this.seen[originalSlug];
+ } while (this.seen.hasOwnProperty(slug));
+ }
+ this.seen[slug] = 0;
+
+ return slug;
+ };
+};
diff --git a/src/TextRenderer.js b/src/TextRenderer.js
new file mode 100644
index 0000000000..652004d50c
--- /dev/null
+++ b/src/TextRenderer.js
@@ -0,0 +1,38 @@
+/**
+ * TextRenderer
+ * returns only the textual part of the token
+ */
+module.exports = class TextRenderer {
+ // no need for block level renderers
+ strong(text) {
+ return text;
+ }
+
+ em(text) {
+ return text;
+ }
+
+ codespan(text) {
+ return text;
+ }
+
+ del(text) {
+ return text;
+ }
+
+ text(text) {
+ return text;
+ }
+
+ link(href, title, text) {
+ return '' + text;
+ }
+
+ image(href, title, text) {
+ return '' + text;
+ }
+
+ br() {
+ return '';
+ }
+};
diff --git a/src/defaults.js b/src/defaults.js
new file mode 100644
index 0000000000..4ff3e5a9b3
--- /dev/null
+++ b/src/defaults.js
@@ -0,0 +1,32 @@
+let defaults = getDefaults();
+
+function getDefaults() {
+ return {
+ baseUrl: null,
+ breaks: false,
+ gfm: true,
+ headerIds: true,
+ headerPrefix: '',
+ highlight: null,
+ langPrefix: 'language-',
+ mangle: true,
+ pedantic: false,
+ renderer: null,
+ sanitize: false,
+ sanitizer: null,
+ silent: false,
+ smartLists: false,
+ smartypants: false,
+ xhtml: false
+ };
+}
+
+function changeDefaults(newDefaults) {
+ defaults = newDefaults;
+}
+
+module.exports = {
+ defaults,
+ getDefaults,
+ changeDefaults
+};
diff --git a/src/helpers.js b/src/helpers.js
new file mode 100644
index 0000000000..6515dddeb3
--- /dev/null
+++ b/src/helpers.js
@@ -0,0 +1,242 @@
+/**
+ * Helpers
+ */
+function escape(html, encode) {
+ if (encode) {
+ if (escape.escapeTest.test(html)) {
+ return html.replace(escape.escapeReplace, escape.getReplacement);
+ }
+ } else {
+ if (escape.escapeTestNoEncode.test(html)) {
+ return html.replace(escape.escapeReplaceNoEncode, escape.getReplacement);
+ }
+ }
+
+ return html;
+}
+escape.escapeTest = /[&<>"']/;
+escape.escapeReplace = /[&<>"']/g;
+escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
+escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
+escape.replacements = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+};
+escape.getReplacement = (ch) => escape.replacements[ch];
+
+function unescape(html) {
+ // explicitly match decimal, hex, and named HTML entities
+ return html.replace(unescape.unescapeTest, (_, n) => {
+ n = n.toLowerCase();
+ if (n === 'colon') return ':';
+ if (n.charAt(0) === '#') {
+ return n.charAt(1) === 'x'
+ ? String.fromCharCode(parseInt(n.substring(2), 16))
+ : String.fromCharCode(+n.substring(1));
+ }
+ return '';
+ });
+}
+unescape.unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
+
+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');
+ regex = regex.replace(name, val);
+ return obj;
+ },
+ getRegex: () => {
+ return new RegExp(regex, opt);
+ }
+ };
+ return obj;
+}
+edit.caret = /(^|[^\[])\^/g;
+
+function cleanUrl(sanitize, base, href) {
+ if (sanitize) {
+ let prot;
+ try {
+ prot = decodeURIComponent(unescape(href))
+ .replace(cleanUrl.protocol, '')
+ .toLowerCase();
+ } catch (e) {
+ return null;
+ }
+ if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
+ return null;
+ }
+ }
+ if (base && !cleanUrl.originIndependentUrl.test(href)) {
+ href = resolveUrl(base, href);
+ }
+ try {
+ href = encodeURI(href).replace(/%25/g, '%');
+ } catch (e) {
+ return null;
+ }
+ return href;
+}
+cleanUrl.protocol = /[^\w:]/g;
+cleanUrl.originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
+
+function resolveUrl(base, href) {
+ if (!resolveUrl.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 + '/';
+ } else {
+ resolveUrl.baseUrls[' ' + base] = rtrim(base, '/', true);
+ }
+ }
+ base = resolveUrl.baseUrls[' ' + base];
+ const relativeBase = base.indexOf(':') === -1;
+
+ if (href.substring(0, 2) === '//') {
+ if (relativeBase) {
+ return href;
+ }
+ return base.replace(resolveUrl.protocol, '$1') + href;
+ } else if (href.charAt(0) === '/') {
+ if (relativeBase) {
+ return href;
+ }
+ return base.replace(resolveUrl.domain, '$1') + href;
+ } else {
+ return base + href;
+ }
+}
+resolveUrl.baseUrls = {};
+resolveUrl.justDomain = /^[^:]+:\/*[^/]*$/;
+resolveUrl.protocol = /^([^:]+:)[\s\S]*$/;
+resolveUrl.domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
+
+function noop() {}
+noop.exec = noop;
+
+function merge(obj) {
+ let i = 1,
+ target,
+ key;
+
+ for (; i < arguments.length; i++) {
+ target = arguments[i];
+ for (key in target) {
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
+ obj[key] = target[key];
+ }
+ }
+ }
+
+ return obj;
+}
+
+function splitCells(tableRow, count) {
+ // ensure that every cell-delimiting pipe has a space
+ // before it to distinguish it from an escaped pipe
+ const row = tableRow.replace(/\|/g, (match, offset, str) => {
+ let escaped = false,
+ curr = offset;
+ while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
+ if (escaped) {
+ // odd number of slashes means | is escaped
+ // so we leave it alone
+ return '|';
+ } else {
+ // add space before unescaped |
+ return ' |';
+ }
+ }),
+ cells = row.split(/ \|/);
+ let i = 0;
+
+ if (cells.length > count) {
+ cells.splice(count);
+ } else {
+ while (cells.length < count) cells.push('');
+ }
+
+ for (; i < cells.length; i++) {
+ // leading or trailing whitespace is ignored per the gfm spec
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
+ }
+ return cells;
+}
+
+// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
+// /c*$/ is vulnerable to REDOS.
+// invert: Remove suffix of non-c chars instead. Default falsey.
+function rtrim(str, c, invert) {
+ const l = str.length;
+ if (l === 0) {
+ return '';
+ }
+
+ // Length of suffix matching the invert condition.
+ let suffLen = 0;
+
+ // Step left until we fail to match the invert condition.
+ while (suffLen < l) {
+ const currChar = str.charAt(l - suffLen - 1);
+ if (currChar === c && !invert) {
+ suffLen++;
+ } else if (currChar !== c && invert) {
+ suffLen++;
+ } else {
+ break;
+ }
+ }
+
+ return str.substr(0, l - suffLen);
+}
+
+function findClosingBracket(str, b) {
+ if (str.indexOf(b[1]) === -1) {
+ return -1;
+ }
+ const l = str.length;
+ let level = 0,
+ i = 0;
+ for (; i < l; i++) {
+ if (str[i] === '\\') {
+ i++;
+ } else if (str[i] === b[0]) {
+ level++;
+ } else if (str[i] === b[1]) {
+ level--;
+ if (level < 0) {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+function checkSanitizeDeprecation(opt) {
+ if (opt && opt.sanitize && !opt.silent) {
+ console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
+ }
+}
+
+module.exports = {
+ escape,
+ unescape,
+ edit,
+ cleanUrl,
+ resolveUrl,
+ noop,
+ merge,
+ splitCells,
+ rtrim,
+ findClosingBracket,
+ checkSanitizeDeprecation
+};
diff --git a/src/marked.js b/src/marked.js
new file mode 100644
index 0000000000..10704b0764
--- /dev/null
+++ b/src/marked.js
@@ -0,0 +1,150 @@
+const Lexer = require('./Lexer.js');
+const Parser = require('./Parser.js');
+const Renderer = require('./Renderer.js');
+const TextRenderer = require('./TextRenderer.js');
+const InlineLexer = require('./InlineLexer.js');
+const Slugger = require('./Slugger.js');
+const {
+ merge,
+ checkSanitizeDeprecation,
+ escape
+} = require('./helpers.js');
+const {
+ getDefaults,
+ changeDefaults,
+ defaults
+} = require('./defaults.js');
+
+/**
+ * Marked
+ */
+function marked(src, opt, callback) {
+ // throw error in case of non string input
+ if (typeof src === 'undefined' || src === null) {
+ throw new Error('marked(): input parameter is undefined or null');
+ }
+ if (typeof src !== 'string') {
+ throw new Error('marked(): input parameter is of type '
+ + Object.prototype.toString.call(src) + ', string expected');
+ }
+
+ if (callback || typeof opt === 'function') {
+ if (!callback) {
+ callback = opt;
+ opt = null;
+ }
+
+ opt = merge({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation(opt);
+ const highlight = opt.highlight;
+ let tokens,
+ pending,
+ i = 0;
+
+ try {
+ tokens = Lexer.lex(src, opt);
+ } catch (e) {
+ return callback(e);
+ }
+
+ pending = tokens.length;
+
+ const done = function(err) {
+ if (err) {
+ opt.highlight = highlight;
+ return callback(err);
+ }
+
+ let out;
+
+ try {
+ out = Parser.parse(tokens, opt);
+ } catch (e) {
+ err = e;
+ }
+
+ opt.highlight = highlight;
+
+ return err
+ ? callback(err)
+ : callback(null, out);
+ };
+
+ if (!highlight || highlight.length < 3) {
+ return done();
+ }
+
+ delete opt.highlight;
+
+ if (!pending) return done();
+
+ for (; i < tokens.length; i++) {
+ (function(token) {
+ if (token.type !== 'code') {
+ return --pending || done();
+ }
+ return highlight(token.text, token.lang, function(err, code) {
+ if (err) return done(err);
+ if (code == null || code === token.text) {
+ return --pending || done();
+ }
+ token.text = code;
+ token.escaped = true;
+ --pending || done();
+ });
+ })(tokens[i]);
+ }
+
+ return;
+ }
+ try {
+ opt = merge({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation(opt);
+ return Parser.parse(Lexer.lex(src, opt), opt);
+ } catch (e) {
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
+ if ((opt || marked.defaults).silent) {
+ return 'An error occurred:
'
+ + escape(e.message + '', true)
+ + ' ';
+ }
+ throw e;
+ }
+}
+
+/**
+ * Options
+ */
+
+marked.options =
+marked.setOptions = function(opt) {
+ merge(marked.defaults, opt);
+ changeDefaults(marked.defaults);
+ return marked;
+};
+
+marked.getDefaults = getDefaults;
+
+marked.defaults = defaults;
+
+/**
+ * Expose
+ */
+
+marked.Parser = Parser;
+marked.parser = Parser.parse;
+
+marked.Renderer = Renderer;
+marked.TextRenderer = TextRenderer;
+
+marked.Lexer = Lexer;
+marked.lexer = Lexer.lex;
+
+marked.InlineLexer = InlineLexer;
+marked.inlineLexer = InlineLexer.output;
+
+marked.Slugger = Slugger;
+
+marked.parse = marked;
+
+module.exports = marked;
diff --git a/src/rules.js b/src/rules.js
new file mode 100644
index 0000000000..c50ff67663
--- /dev/null
+++ b/src/rules.js
@@ -0,0 +1,240 @@
+const {
+ noop,
+ edit,
+ merge
+} = require('./helpers.js');
+
+/**
+ * Block-Level Grammar
+ */
+const block = {
+ newline: /^\n+/,
+ code: /^( {4}[^\n]+\n*)+/,
+ fences: /^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
+ hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
+ heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
+ list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
+ html: '^ {0,3}(?:' // optional indentation
+ + '<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)' // (1)
+ + '|comment[^\\n]*(\\n+|$)' // (2)
+ + '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
+ + '|\\n*' // (4)
+ + '|\\n*' // (5)
+ + '|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ + '|(?!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,
+ table: noop,
+ 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]+)*)/,
+ text: /^[^\n]+/
+};
+
+block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
+block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
+block.def = edit(block.def)
+ .replace('label', block._label)
+ .replace('title', block._title)
+ .getRegex();
+
+block.bullet = /(?:[*+-]|\d{1,9}\.)/;
+block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
+block.item = edit(block.item, 'gm')
+ .replace(/bull/g, block.bullet)
+ .getRegex();
+
+block.list = edit(block.list)
+ .replace(/bull/g, block.bullet)
+ .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
+ .replace('def', '\\n+(?=' + block.def.source + ')')
+ .getRegex();
+
+block._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';
+block._comment = //;
+block.html = edit(block.html, 'i')
+ .replace('comment', block._comment)
+ .replace('tag', block._tag)
+ .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
+ .getRegex();
+
+block.paragraph = edit(block._paragraph)
+ .replace('hr', block.hr)
+ .replace('heading', ' {0,3}#{1,6} +')
+ .replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
+ .replace('blockquote', ' {0,3}>')
+ .replace('fences', ' {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n')
+ .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
+ .replace('html', '?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
+ .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
+ .getRegex();
+
+block.blockquote = edit(block.blockquote)
+ .replace('paragraph', block.paragraph)
+ .getRegex();
+
+/**
+ * Normal Block Grammar
+ */
+
+block.normal = merge({}, block);
+
+/**
+ * GFM Block Grammar
+ */
+
+block.gfm = merge({}, block.normal, {
+ nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
+ table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
+});
+
+/**
+ * Pedantic grammar (original John Gruber's loose markdown specification)
+ */
+
+block.pedantic = merge({}, block.normal, {
+ html: edit(
+ '^ *(?:comment *(?:\\n|\\s*$)'
+ + '|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)' // closed tag
+ + '| \\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
+ .replace('comment', block._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: noop, // fences not supported
+ paragraph: edit(block.normal._paragraph)
+ .replace('hr', block.hr)
+ .replace('heading', ' *#{1,6} *[^\n]')
+ .replace('lheading', block.lheading)
+ .replace('blockquote', ' {0,3}>')
+ .replace('|fences', '')
+ .replace('|list', '')
+ .replace('|html', '')
+ .getRegex()
+});
+
+/**
+ * Inline-Level Grammar
+ */
+const inline = {
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
+ url: noop,
+ tag: '^comment'
+ + '|^[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g.
+ + '|^' // declaration, e.g.
+ + '|^', // CDATA section
+ 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: noop,
+ text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~';
+inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
+
+inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
+
+inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
+inline._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])?)+(?![-_])/;
+inline.autolink = edit(inline.autolink)
+ .replace('scheme', inline._scheme)
+ .replace('email', inline._email)
+ .getRegex();
+
+inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
+
+inline.tag = edit(inline.tag)
+ .replace('comment', block._comment)
+ .replace('attribute', inline._attribute)
+ .getRegex();
+
+inline._label = /(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
+inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;
+inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
+
+inline.link = edit(inline.link)
+ .replace('label', inline._label)
+ .replace('href', inline._href)
+ .replace('title', inline._title)
+ .getRegex();
+
+inline.reflink = edit(inline.reflink)
+ .replace('label', inline._label)
+ .getRegex();
+
+/**
+ * Normal Inline Grammar
+ */
+
+inline.normal = merge({}, inline);
+
+/**
+ * Pedantic Inline Grammar
+ */
+
+inline.pedantic = merge({}, inline.normal, {
+ strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
+ em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
+ link: edit(/^!?\[(label)\]\((.*?)\)/)
+ .replace('label', inline._label)
+ .getRegex(),
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
+ .replace('label', inline._label)
+ .getRegex()
+});
+
+/**
+ * GFM Inline Grammar
+ */
+
+inline.gfm = merge({}, inline.normal, {
+ escape: edit(inline.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]*?(?:(?=[\\ {
+ await bench('commonmark', specs, (() => {
const commonmark = require('commonmark');
const parser = new commonmark.Parser();
const writer = new commonmark.HtmlRenderer();
@@ -79,7 +116,7 @@ function runBench(options) {
}
try {
- bench('markdown-it', specs, (() => {
+ await bench('markdown-it', specs, (() => {
const MarkdownIt = require('markdown-it');
const md = new MarkdownIt();
return md.render.bind(md);
@@ -89,7 +126,7 @@ function runBench(options) {
}
try {
- bench('markdown.js', specs, (() => {
+ await bench('markdown.js', specs, (() => {
const md = require('markdown').markdown;
return md.toHTML.bind(md);
})());
@@ -98,25 +135,23 @@ function runBench(options) {
}
}
-function bench(name, specs, engine) {
+async function bench(name, specs, engine) {
const before = process.hrtime();
for (let i = 0; i < 1e3; i++) {
for (const spec of specs) {
- engine(spec.markdown);
+ await engine(spec.markdown);
}
}
const elapsed = process.hrtime(before);
const ms = prettyElapsedTime(elapsed).toFixed();
- const results = [];
+ let correct = 0;
for (const spec of specs) {
- results.push({
- expected: spec.html,
- actual: engine(spec.markdown)
- });
+ if (await htmlDiffer.isEqual(spec.html, await engine(spec.markdown))) {
+ correct++;
+ }
}
- const correct = results.reduce((num, result) => num + (htmlDiffer.isEqual(result.expected, result.actual) ? 1 : 0), 0);
- const percent = (correct / results.length * 100).toFixed(2);
+ const percent = (correct / specs.length * 100).toFixed(2);
console.log('%s completed in %sms and passed %s%', name, ms, percent);
}
@@ -124,13 +159,13 @@ function bench(name, specs, engine) {
/**
* A simple one-time benchmark
*/
-function time(options) {
+async function time(options) {
options = options || {};
const specs = load();
if (options.marked) {
marked.setOptions(options.marked);
}
- bench('marked', specs, marked);
+ await bench('marked', specs, marked);
}
/**
@@ -226,7 +261,7 @@ function camelize(text) {
/**
* Main
*/
-function main(argv) {
+async function main(argv) {
const opt = parseArg(argv);
if (opt.minified) {
@@ -234,9 +269,9 @@ function main(argv) {
}
if (opt.time) {
- time(opt);
+ await time(opt);
} else {
- runBench(opt);
+ await runBench(opt);
}
}
diff --git a/test/helpers/helpers.js b/test/helpers/helpers.js
index f6eb634a72..a71db73cd9 100644
--- a/test/helpers/helpers.js
+++ b/test/helpers/helpers.js
@@ -1,4 +1,4 @@
-const marked = require('../../');
+const marked = require('../../src/marked.js');
const htmlDiffer = require('./html-differ.js');
beforeEach(() => {
diff --git a/test/unit/marked-spec.js b/test/unit/marked-spec.js
index e28371aa47..4145f73807 100644
--- a/test/unit/marked-spec.js
+++ b/test/unit/marked-spec.js
@@ -1,4 +1,4 @@
-const marked = require('../../lib/marked.js');
+const marked = require('../../src/marked.js');
describe('Test heading ID functionality', () => {
it('should add id attribute by default', () => {
diff --git a/test/vuln-regex.js b/test/vuln-regex.js
new file mode 100644
index 0000000000..e5645f7046
--- /dev/null
+++ b/test/vuln-regex.js
@@ -0,0 +1,42 @@
+const regexp = require('../src/rules.js');
+const vulnRegexDetector = require('vuln-regex-detector');
+
+const promises = [];
+function findRegexps(name, obj) {
+ if (typeof obj === 'string') {
+ promises.push(testRegexp(name, obj));
+ } if (obj instanceof RegExp || obj.exec) {
+ if (obj.source) {
+ promises.push(testRegexp(name, obj.source));
+ }
+ } else if (typeof obj === 'object') {
+ for (const prop in obj) {
+ findRegexps(name + (name ? '.' : '') + prop, obj[prop]);
+ }
+ }
+}
+
+async function testRegexp(name, source) {
+ try {
+ const result = await vulnRegexDetector.test(source);
+
+ if (result === vulnRegexDetector.responses.safe) {
+ console.log(`${name} is safe`);
+ return true;
+ } else if (result === vulnRegexDetector.responses.vulnerable) {
+ console.error(`${name} is vulnerable`);
+ } else {
+ console.error(`${name} might be vulnerable: ` + result.toString());
+ }
+ } catch (ex) {
+ console.error(`${name} failed with error: ` + ex.toString());
+ }
+ return false;
+}
+
+findRegexps('', regexp);
+// promises.push(testRegexp('a', /(a+)+$/.source));
+Promise.allSettled(promises).then(results => {
+ const code = results.every(r => r.value) ? 0 : 1;
+ process.exit(code);
+});