diff --git a/demo/index.html b/demo/index.html
index e5e2ac1..7e89453 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -15,14 +15,17 @@
Remarkable demo
-
Show code sample
+
code sample
var Remarkable = require('remarkable');
-
var md = new Remarkable({
- html: true,
- xhtml: true,
- breaks: false,
- langprefix: 'language-'
+ html: false, // enable html tags in source
+ xhtml: false, // use '/' to close single tags (<br />)
+ breaks: true, // convert '\n' in paragraphs into <br>
+ langPrefix: 'language-', // css language prefix for fenced blocks
+
+ // Should return HTML markup for highlighted text,
+ // or empty string to escape source
+ highlight: function (str, lang) { return ''; }
});
console.log(md.parse('# Remarkable rulezz!'));
@@ -50,7 +53,7 @@ console.log(md.parse('# Remarkable rulezz!'));
-
+
diff --git a/dist/remarkable.js b/dist/remarkable.js
index db53b02..d2885d6 100644
--- a/dist/remarkable.js
+++ b/dist/remarkable.js
@@ -2,9 +2,9 @@
'use strict';
-module.exports = require('./lib/parser');
+module.exports = require('./lib/');
-},{"./lib/parser":31}],1:[function(require,module,exports){
+},{"./lib/":7}],1:[function(require,module,exports){
// List of valid entities
//
// Generate with ./support/entities.js script
@@ -2446,11 +2446,13 @@ module.exports = {
html: false,
xhtml: false,
breaks: false,
- langprefix: 'language-'
+ maxLevel: 20,
+ langPrefix: 'language-',
+ highlight: function (/*str*/) { return ''; }
};
},{}],6:[function(require,module,exports){
-// Common functions for lexers
+// Common functions for parsers
'use strict';
@@ -2607,125 +2609,290 @@ exports.fromCodePoint = fromCodePoint;
exports.replaceEntities = replaceEntities;
},{"./common/entities":1}],7:[function(require,module,exports){
-// Block lexer
-
+// Main perser class
'use strict';
-var State = require('./lexer_block/state_block');
-var skipEmptyLines = require('./helpers').skipEmptyLines;
-var isEmpty = require('./helpers').isEmpty;
+var assign = require('object-assign');
-var rules = [];
+var Renderer = require('./renderer');
+var ParserBlock = require('./parser_block');
+var ParserInline = require('./parser_inline');
+var defaults = require('./defaults');
-// `list` should be after `hr`, but before `heading`
-rules.push(require('./lexer_block/code'));
-rules.push(require('./lexer_block/fences'));
-rules.push(require('./lexer_block/blockquote'));
-rules.push(require('./lexer_block/hr'));
-rules.push(require('./lexer_block/list'));
-rules.push(require('./lexer_block/heading'));
-rules.push(require('./lexer_block/lheading'));
-rules.push(require('./lexer_block/htmlblock'));
-rules.push(require('./lexer_block/table'));
-rules.push(require('./lexer_block/paragraph'));
+// Main class
+//
+function Remarkable(options) {
+ this.options = assign({}, defaults);
+ this.state = null;
+ this.inline = new ParserInline();
+ this.block = new ParserBlock();
+ this.renderer = new Renderer();
-function functionName(fn) {
- var ret = fn.toString();
- ret = ret.substr('function '.length);
- ret = ret.substr(0, ret.indexOf('('));
- return ret;
+ // a bunch of cross-references between parsers
+ // used for link reference definitions
+ this.block.inline = this.inline;
+
+ if (options) { this.set(options); }
}
-function findByName(self, name) {
- for (var i = 0; i < self.rules.length; i++) {
- if (functionName(self.rules[i]) === name) {
- return i;
+
+Remarkable.prototype.set = function (options) {
+ assign(this.options, options);
+};
+
+
+Remarkable.prototype.render = function (src) {
+ var tokens, tok, i, l, env = { references: Object.create(null) };
+
+ // Parse blocks
+ tokens = this.block.parse(src, this.options, env);
+
+ // Parse inlines
+ for (i = 0, l = tokens.length; i < l; i++) {
+ tok = tokens[i];
+ if (tok.type === 'inline') {
+ tok.children = this.inline.parse(tok.content, this.options, env);
}
}
- return -1;
-}
+ // Render
+ return this.renderer.render(tokens, this.options, env);
+};
+
+
+module.exports = Remarkable;
+
+},{"./defaults":5,"./parser_block":9,"./parser_inline":10,"./renderer":12,"object-assign":36}],8:[function(require,module,exports){
+
+'use strict';
-// Block Lexer class
//
-function LexerBlock() {
- this.rules = [];
- this.rules_named = {};
+// Parse link label
+//
+// this function assumes that first character ("[") already matches;
+// returns the end of the label
+function parseLinkLabel(state, start) {
+ var level, found, marker, ok,
+ labelEnd = -1,
+ max = state.posMax,
+ oldPos = state.pos,
+ oldLength = state.tokens.length,
+ oldPending = state.pending,
+ oldFlag = state.validateInsideLink;
- for (var i = 0; i < rules.length; i++) {
- this.after(null, rules[i]);
+ if (state.validateInsideLink) { return -1; }
+
+ state.pos = start + 1;
+ state.validateInsideLink = true;
+ level = 1;
+
+ while (state.pos < max) {
+ marker = state.src.charCodeAt(state.pos);
+ if (marker === 0x5B /* [ */) {
+ level++;
+ } else if (marker === 0x5D /* ] */) {
+ level--;
+ if (level === 0) {
+ found = true;
+ break;
+ }
+ }
+
+ ok = state.parser.tokenizeSingle(state);
+
+ if (!ok) { state.pending += state.src[state.pos++]; }
}
-}
+ if (found) { labelEnd = state.pos; }
+
+ // restore old state
+ state.pos = oldPos;
+ state.tokens.length = oldLength;
+ state.pending = oldPending;
+ state.validateInsideLink = oldFlag;
+
+ return labelEnd;
+}
-// Replace/delete lexer function
//
-LexerBlock.prototype.at = function (name, fn) {
- var index = findByName(name);
- if (index === -1) {
- throw new Error('Lexer rule not found: ' + name);
+// Parse link destination
+//
+// on success it returns a string and updates state.pos;
+// on failure it returns null
+function parseLinkDestination(state, pos) {
+ var code, level,
+ max = state.posMax,
+ href = '';
+
+ if (state.src.charCodeAt(pos) === 0x3C /* < */) {
+ pos++;
+ while (pos < max) {
+ code = state.src.charCodeAt(pos);
+ if (code === 0x0A /* \n */) { return false; }
+ if (code === 0x3E /* > */) {
+ state.pos = pos + 1;
+ state.link_content = href;
+ return true;
+ }
+ if (code === 0x5C /* \ */ && pos + 1 < max) {
+ pos++;
+ href += state.src[pos++];
+ continue;
+ }
+
+ href += state.src[pos++];
+ }
+
+ // no closing '>'
+ return false;
}
- if (fn) {
- this.rules[index] = fn;
- } else {
- this.rules = this.rules.slice(0, index).concat(this.rules.slice(index + 1));
+ // this should be ... } else { ... branch
+
+ level = 0;
+ while (pos < max) {
+ code = state.src.charCodeAt(pos);
+
+ if (code === 0x20) { break; }
+
+ // ascii control characters
+ if (code < 0x20 || code === 0x7F) { break; }
+
+ if (code === 0x5C /* \ */ && pos + 1 < max) {
+ pos++;
+ href += state.src[pos++];
+ continue;
+ }
+
+ if (code === 0x28 /* ( */) {
+ level++;
+ if (level > 1) { break; }
+ }
+
+ if (code === 0x29 /* ) */) {
+ level--;
+ if (level < 0) { break; }
+ }
+
+ href += state.src[pos++];
}
- this.rules_named[functionName(fn)] = fn;
-};
+ if (!href.length) { return false; }
+ state.pos = pos;
+ state.link_content = href;
+ return true;
+}
-// Add function to lexer chain before one with given name.
-// Or add to start, if name not defined
//
-LexerBlock.prototype.before = function (name, fn) {
- if (!name) {
- this.rules.unshift(fn);
- this.rules_named[functionName(fn)] = fn;
- return;
- }
+// Parse link title
+//
+// on success it returns a string and updates state.pos;
+// on failure it returns null
+function parseLinkTitle(state, pos) {
+ var title, code,
+ max = state.posMax,
+ marker = state.src.charCodeAt(pos);
- var index = findByName(name);
- if (index === -1) {
- throw new Error('Lexer rule not found: ' + name);
+ if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return false; }
+
+ pos++;
+ title = '';
+
+ // if opening marker is "(", switch it to closing marker ")"
+ if (marker === 0x28) { marker = 0x29; }
+
+ while (pos < max) {
+ code = state.src.charCodeAt(pos);
+ if (code === marker) {
+ state.pos = pos + 1;
+ state.link_content = title;
+ return true;
+ }
+ if (code === 0x5C /* \ */ && pos + 1 < max) {
+ pos++;
+ title += state.src[pos++];
+ continue;
+ }
+
+ title += state.src[pos++];
}
- this.rules.splice(index, 0, fn);
- this.rules_named[functionName(fn)] = fn;
-};
+ return false;
+}
+function normalizeReference(str) {
+ return str.trim().replace(/\s+/g, ' ').toLowerCase();
+}
-// Add function to lexer chain after one with given name.
-// Or add to end, if name not defined
+module.exports.parseLinkLabel = parseLinkLabel;
+module.exports.parseLinkDestination = parseLinkDestination;
+module.exports.parseLinkTitle = parseLinkTitle;
+module.exports.normalizeReference = normalizeReference;
+
+},{}],9:[function(require,module,exports){
+// Block parser
+
+
+'use strict';
+
+
+var Ruler = require('./ruler');
+var State = require('./rules_block/state_block');
+
+var skipEmptyLines = require('./helpers').skipEmptyLines;
+var isEmpty = require('./helpers').isEmpty;
+
+
+var rules = [];
+
+// `list` should be after `hr`, but before `heading`
+rules.push([ require('./rules_block/code') ]);
+rules.push([ require('./rules_block/fences'), 'paragraph', 'blockquote', 'list' ]);
+rules.push([ require('./rules_block/blockquote'), 'paragraph', 'blockquote', 'list' ]);
+rules.push([ require('./rules_block/hr'), 'paragraph', 'blockquote', 'list' ]);
+rules.push([ require('./rules_block/list'), 'paragraph', 'blockquote' ]);
+rules.push([ require('./rules_block/heading'), 'paragraph', 'blockquote' ]);
+rules.push([ require('./rules_block/lheading') ]);
+rules.push([ require('./rules_block/htmlblock'), 'paragraph', 'blockquote' ]);
+rules.push([ require('./rules_block/table'), 'paragraph' ]);
+rules.push([ require('./rules_block/paragraph') ]);
+
+
+// Block Parser class
//
-LexerBlock.prototype.after = function (name, fn) {
- if (!name) {
- this.rules.push(fn);
- this.rules_named[functionName(fn)] = fn;
- return;
- }
+function ParserBlock() {
+ this._rules = [];
+ this._rulesParagraphTerm = [];
+ this._rulesBlockquoteTerm = [];
+ this._rulesListTerm = [];
- var index = findByName(name);
- if (index === -1) {
- throw new Error('Lexer rule not found: ' + name);
+ this.ruler = new Ruler(this.rulesUpdate.bind(this));
+
+ for (var i = 0; i < rules.length; i++) {
+ this.ruler.after(rules[i][0], rules[i].slice(1));
}
+}
+
- this.rules.splice(index + 1, 0, fn);
- this.rules_named[functionName(fn)] = fn;
+ParserBlock.prototype.rulesUpdate = function () {
+ this._rules = this.ruler.getRules();
+ this._rulesParagraphTerm = this.ruler.getRules('paragraph');
+ this._rulesBlockquoteTerm = this.ruler.getRules('blockquote');
+ this._rulesListTerm = this.ruler.getRules('list');
};
// Generate tokens for input range
//
-LexerBlock.prototype.tokenize = function (state, startLine, endLine) {
+ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
var ok, i,
- rules = this.rules,
- len = this.rules.length,
+ rules = this._rules,
+ len = this._rules.length,
line = startLine,
hasEmptyLines = false;
@@ -2777,7 +2944,7 @@ LexerBlock.prototype.tokenize = function (state, startLine, endLine) {
};
-LexerBlock.prototype.parse = function (src, options, env) {
+ParserBlock.prototype.parse = function (src, options, env) {
var state, lineStart = 0, lastTabPos = 0;
if (!src) { return ''; }
@@ -2810,7 +2977,6 @@ LexerBlock.prototype.parse = function (src, options, env) {
});
}
-
state = new State(
src,
this,
@@ -2822,2476 +2988,2448 @@ LexerBlock.prototype.parse = function (src, options, env) {
this.tokenize(state, state.line, state.lineMax);
return state.tokens;
-
};
-module.exports = LexerBlock;
+module.exports = ParserBlock;
-},{"./helpers":6,"./lexer_block/blockquote":8,"./lexer_block/code":9,"./lexer_block/fences":10,"./lexer_block/heading":11,"./lexer_block/hr":12,"./lexer_block/htmlblock":13,"./lexer_block/lheading":14,"./lexer_block/list":15,"./lexer_block/paragraph":16,"./lexer_block/state_block":17,"./lexer_block/table":18}],8:[function(require,module,exports){
-// Block quotes
+},{"./helpers":6,"./ruler":13,"./rules_block/blockquote":14,"./rules_block/code":15,"./rules_block/fences":16,"./rules_block/heading":17,"./rules_block/hr":18,"./rules_block/htmlblock":19,"./rules_block/lheading":20,"./rules_block/list":21,"./rules_block/paragraph":22,"./rules_block/state_block":23,"./rules_block/table":24}],10:[function(require,module,exports){
+// Inline parser
'use strict';
-var skipSpaces = require('../helpers').skipSpaces;
+var Ruler = require('./ruler');
+var StateInline = require('./rules_inline/state_inline');
+////////////////////////////////////////////////////////////////////////////////
+// Parser rules
-module.exports = function blockquote(state, startLine, endLine, silent) {
- var nextLine, lastLineEmpty, oldTShift, oldBMarks, i, oldIndent, oldListMode,
- rules_named = state.lexer.rules_named,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
+var rules = [];
- if (pos > max) { return false; }
- // check the block quote marker
- if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }
+// Pure text
+rules.push(require('./rules_inline/text'));
+rules.push(require('./rules_inline/newline'));
+rules.push(require('./rules_inline/escape'));
+rules.push(require('./rules_inline/backticks'));
+rules.push(require('./rules_inline/emphasis'));
+rules.push(require('./rules_inline/links'));
+rules.push(require('./rules_inline/autolink'));
+rules.push(require('./rules_inline/htmltag'));
+rules.push(require('./rules_inline/entity'));
+rules.push(require('./rules_inline/escape_html_char'));
+
+
+// Inline Parser class
+//
+function ParserInline() {
+ this._rules = [];
- // we know that it's going to be a valid blockquote,
- // so no point trying to find the end of it in silent mode
- if (silent) { return true; }
+ // Rule to skip pure text
+ // - '{$%@}' reserved for extentions
+ // - '<>"' added for internal html escaping
+ this.textMatch = /^[^\n\\`*_\[\]!&{}$%@<>"]+/;
- // skip one optional space after '>'
- if (state.src.charCodeAt(pos) === 0x20) { pos++; }
+ this.ruler = new Ruler(this.rulesUpdate.bind(this));
- state.bqMarks[startLine]++;
- state.bqLevel++;
- oldIndent = state.blkIndent;
- state.blkIndent = 0;
+ for (var i = 0; i < rules.length; i++) {
+ this.ruler.after(rules[i]);
+ }
+}
- oldBMarks = [ state.bMarks[startLine] ];
- state.bMarks[startLine] = pos;
- // check if we have an empty blockquote
- pos = pos < max ? skipSpaces(state, pos) : pos;
- lastLineEmpty = pos >= max;
+ParserInline.prototype.rulesUpdate = function () {
+ this._rules = this.ruler.getRules();
+};
- oldTShift = [ state.tShift[startLine] ];
- state.tShift[startLine] = pos - state.bMarks[startLine];
- // Search the end of the block
- //
- // Block ends with either:
- // 1. an empty line outside:
- // ```
- // > test
- //
- // ```
- // 2. an empty line inside:
- // ```
- // >
- // test
- // ```
- // 3. another tag
- // ```
- // > test
- // - - -
- // ```
- for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
- pos = state.bMarks[nextLine] + state.tShift[nextLine];
- max = state.eMarks[nextLine];
+// Generate single token;
+// returns `true` if any rule reported success
+//
+ParserInline.prototype.tokenizeSingle = function (state) {
+ var ok, i,
+ rules = this._rules,
+ len = this._rules.length;
- if (pos >= max) {
- // Case 1: line is not inside the blockquote, and this line is empty.
- break;
- }
+ for (i = 0; i < len; i++) {
+ ok = rules[i](state);
+ if (ok) { break; }
+ }
- if (state.src.charCodeAt(pos++) === 0x3E/* > */) {
- state.bqMarks[nextLine]++;
- // This line is inside the blockquote.
+ return ok;
+};
- // skip one optional space after '>'
- if (state.src.charCodeAt(pos) === 0x20) { pos++; }
- oldBMarks.push(state.bMarks[nextLine]);
- state.bMarks[nextLine] = pos;
+// Generate tokens for input range
+//
+ParserInline.prototype.tokenize = function (state) {
+ var ok, i,
+ rules = this._rules,
+ len = this._rules.length,
+ end = state.posMax;
- pos = pos < max ? skipSpaces(state, pos) : pos;
- lastLineEmpty = pos >= max;
+ while (state.pos < end) {
- oldTShift.push(state.tShift[nextLine]);
- state.tShift[nextLine] = pos - state.bMarks[nextLine];
- continue;
- }
+ // Try all possible rules.
+ // On success, rule should:
+ //
+ // - update `state.pos`
+ // - update `state.tokens`
+ // - return true
- // Case 2: line is not inside the blockquote, and the last line was empty.
- if (lastLineEmpty) { break; }
+ for (i = 0; i < len; i++) {
+ ok = rules[i](state);
+ if (ok) { break; }
+ }
- // Case 3: another tag found.
- if (rules_named.fences(state, nextLine, endLine, true)) { break; }
- if (rules_named.hr(state, nextLine, endLine, true)) { break; }
- if (rules_named.list(state, nextLine, endLine, true)) { break; }
- if (rules_named.heading(state, nextLine, endLine, true)) { break; }
- // setex header can't interrupt paragraph
- // if (rules_named.lheading(state, nextLine, endLine, true)) { break; }
- if (rules_named.blockquote(state, nextLine, endLine, true)) { break; }
- if (rules_named.table(state, nextLine, endLine, true)) { break; }
- //if (rules_named.tag(state, nextLine, endLine, true)) { break; }
- //if (rules_named.def(state, nextLine, endLine, true)) { break; }
+ if (ok) {
+ if (state.pos >= end) { break; }
+ continue;
+ }
- oldBMarks.push(state.bMarks[nextLine]);
- oldTShift.push(state.tShift[nextLine]);
+ state.pending += state.src[state.pos++];
}
- oldListMode = state.listMode;
- state.listMode = false;
- state.tokens.push({ type: 'blockquote_open' });
- state.lexer.tokenize(state, startLine, nextLine);
- state.tokens.push({ type: 'blockquote_close' });
- state.listMode = oldListMode;
-
- // Restore original tShift; this might not be necessary since the parser
- // has already been here, but just to make sure we can do that.
- for (i = 0; i < oldTShift.length; i++) {
- state.bMarks[i + startLine] = oldBMarks[i];
- state.tShift[i + startLine] = oldTShift[i];
+ if (state.pending) {
+ state.pushPending();
}
- state.bqLevel--;
- state.blkIndent = oldIndent;
- return true;
+ return state.tokens;
};
-},{"../helpers":6}],9:[function(require,module,exports){
-// Code block (4 spaces padded)
-
-'use strict';
+// Parse input string.
+//
+ParserInline.prototype.parse = function (str, options, env) {
+ var state = new StateInline(str, this, options, env);
+ this.tokenize(state);
-var isEmpty = require('../helpers').isEmpty;
-var getLines = require('../helpers').getLines;
+ return state.tokens;
+};
-module.exports = function code(state, startLine, endLine, silent) {
- var nextLine, last;
+module.exports = ParserInline;
- if (state.tShift[startLine] - state.blkIndent < 4) { return false; }
+},{"./ruler":13,"./rules_inline/autolink":25,"./rules_inline/backticks":26,"./rules_inline/emphasis":27,"./rules_inline/entity":28,"./rules_inline/escape":29,"./rules_inline/escape_html_char":30,"./rules_inline/htmltag":31,"./rules_inline/links":32,"./rules_inline/newline":33,"./rules_inline/state_inline":34,"./rules_inline/text":35}],11:[function(require,module,exports){
- last = nextLine = startLine + 1;
+'use strict';
- while (nextLine < endLine) {
- if (state.bqMarks[nextLine] < state.bqLevel) { break; }
- if (isEmpty(state, nextLine)) {
- nextLine++;
- if (state.options.pedantic) {
- last = nextLine;
- }
- continue;
- }
- if (state.tShift[nextLine] - state.blkIndent >= 4) {
- nextLine++;
- last = nextLine;
- continue;
- }
- break;
- }
- if (silent) { return true; }
+var StateInline = require('./rules_inline/state_inline');
+var skipSpaces = require('./helpers').skipSpaces;
+var parseLinkLabel = require('./links').parseLinkLabel;
+var parseLinkDestination = require('./links').parseLinkDestination;
+var parseLinkTitle = require('./links').parseLinkTitle;
+var normalizeReference = require('./links').normalizeReference;
- state.tokens.push({
- type: 'code',
- content: getLines(state, startLine, last, 4 + state.blkIndent, true),
- block: true
- });
- state.line = nextLine;
- return true;
-};
+// Parse link reference definition.
+//
+module.exports = function parse_reference(str, parser, options, env) {
+ var state, labelEnd, pos, max, code, start, href, title, label;
-},{"../helpers":6}],10:[function(require,module,exports){
-// fences (``` lang, ~~~ lang)
+ if (str.charCodeAt(0) !== 0x5B/* [ */) { return -1; }
-'use strict';
+ // TODO: benchmark this
+ if (str.indexOf(']:') === -1) { return -1; }
+ state = new StateInline(str, parser, options, env);
+ labelEnd = parseLinkLabel(state, 0);
-var skipSpaces = require('../helpers').skipSpaces;
-var skipChars = require('../helpers').skipChars;
-var getLines = require('../helpers').getLines;
+ if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return -1; }
+ max = state.posMax;
-module.exports = function fences(state, startLine, endLine, silent) {
- var marker, len, params, nextLine, mem,
- haveEndMarker = false,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
+ // [label]: destination 'title'
+ // ^^^ skip optional whitespace here
+ for (pos = labelEnd + 2; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (code !== 0x20 && code !== 0x0A) { break; }
+ }
- if (pos + 3 > max) { return false; }
+ // [label]: destination 'title'
+ // ^^^^^^^^^^^ parse this
+ if (!parseLinkDestination(state, pos)) { return -1; }
+ href = state.link_content;
+ pos = state.pos;
- marker = state.src.charCodeAt(pos);
+ // [label]: destination 'title'
+ // ^^^ skipping those spaces
+ start = pos;
+ for (pos = pos + 1; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (code !== 0x20 && code !== 0x0A) { break; }
+ }
- if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {
- return false;
+ // [label]: destination 'title'
+ // ^^^^^^^ parse this
+ if (pos < max && start !== pos && parseLinkTitle(state, pos)) {
+ title = state.link_content;
+ pos = state.pos;
+ } else {
+ title = '';
+ pos = start;
}
- // scan marker length
- mem = pos;
- pos = skipChars(state, pos, marker);
+ // ensure that the end of the line is empty
+ pos = skipSpaces(state, pos);
+ if (pos < max && state.src.charCodeAt(pos) !== 0x0A) { return -1; }
- len = pos - mem;
+ label = normalizeReference(str.slice(1, labelEnd));
+ env.references[label] = env.references[label] || { title: title, href: href };
- if (len < 3) { return false; }
+ return pos;
+};
- params = state.src.slice(pos, max).trim();
+},{"./helpers":6,"./links":8,"./rules_inline/state_inline":34}],12:[function(require,module,exports){
+'use strict';
- if (params.indexOf('`') >= 0) { return false; }
- // Since start is found, we can report success here in validation mode
- if (silent) { return true; }
+var assign = require('object-assign');
+var escapeHtml = require('./helpers').escapeHtml;
+var unescapeMd = require('./helpers').unescapeMd;
+var replaceEntities = require('./helpers').replaceEntities;
- // search end of block
- nextLine = startLine;
- for (;;) {
- nextLine++;
- if (nextLine >= endLine) {
- // unclosed block should be autoclosed by end of document.
- // also block seems to be autoclosed by end of parent
- /*if (state.blkLevel === 0) {
- break;
- }
- return false;*/
- break;
- }
+function escapeUrl(str) {
+ try {
+ return encodeURI(str);
+ } catch (__) {}
+ return '';
+}
+function unescapeUrl(str) {
+ try {
+ return decodeURI(str);
+ } catch (__) {}
+ return '';
+}
- pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
- max = state.eMarks[nextLine];
- if (pos < max && state.tShift[nextLine] < state.blkIndent) {
- // non-empty line with negative indent should stop the list:
- // - ```
- // test
- break;
- }
- if (pos < max && state.bqMarks[nextLine] < state.bqLevel) { break; }
+// check if we need to hide '\n' before next token
+function getBreak(tokens, idx) {
+ if (++idx < tokens.length &&
+ tokens[idx].type === 'list_item_close') {
+ return '';
+ }
- if (state.src.charCodeAt(pos) !== marker) { continue; }
+ return '\n';
+}
- pos = skipChars(state, pos, marker);
+var rules = {};
- // closing code fence must be at least as long as the opening one
- if (pos - mem < len) { continue; }
- // make sure tail has spaces only
- pos = skipSpaces(state, pos);
+rules.blockquote_open = function (/*tokens, idx, options*/) {
+ return '\n';
+};
+rules.blockquote_close = function (tokens, idx /*, options*/) {
+ return '
' + getBreak(tokens, idx);
+};
- if (pos < max) { continue; }
- haveEndMarker = true;
- // found!
- break;
+rules.code = function (tokens, idx /*, options*/) {
+ if (tokens[idx].block) {
+ return '' + escapeHtml(tokens[idx].content) + '
' + getBreak(tokens, idx);
}
- // If a fence has heading spaces, they should be removed from its inner block
- len = state.tShift[startLine];
+ return '' + escapeHtml(tokens[idx].content) + '
';
+};
- state.tokens.push({
- type: 'fence',
- params: params,
- content: getLines(state, startLine + 1, nextLine, len, true)
- });
- state.line = nextLine + (haveEndMarker ? 1 : 0);
- return true;
-};
+rules.fence = function (tokens, idx, options) {
+ var token = tokens[idx];
+ var langClass = '';
+ var langPrefix = options.langPrefix || '';
+ var params, langName = '';
+ var highlighted;
-},{"../helpers":6}],11:[function(require,module,exports){
-// heading (#, ##, ...)
+ if (token.params) {
+ params = token.params.split(/ +/g);
+ langName = escapeHtml(replaceEntities(unescapeMd(params[0])));
+ langClass = ' class="' + langPrefix + langName + '"';
+ }
-'use strict';
+ highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);
+ return ''
+ + highlighted
+ + '
' + getBreak(tokens, idx);
+};
-var isWhiteSpace = require('../helpers').isWhiteSpace;
-var skipSpaces = require('../helpers').skipSpaces;
-var skipCharsBack = require('../helpers').skipCharsBack;
+rules.heading_open = function (tokens, idx /*, options*/) {
+ return '';
+};
+rules.heading_close = function (tokens, idx /*, options*/) {
+ return '\n';
+};
-module.exports = function heading(state, startLine, endLine, silent) {
- var ch, level,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
- if (pos >= max) { return false; }
+rules.hr = function (tokens, idx, options) {
+ return (options.xhtml ? '
' : '
') + getBreak(tokens, idx);
+};
- ch = state.src.charCodeAt(pos);
- if (ch !== 0x23/* # */ || pos >= max) { return false; }
+rules.bullet_list_open = function (/*tokens, idx, options*/) {
+ return '\n';
+};
+rules.bullet_list_close = function (tokens, idx /*, options*/) {
+ return '
' + getBreak(tokens, idx);
+};
+rules.list_item_open = function (/*tokens, idx, options*/) {
+ return '';
+};
+rules.list_item_close = function (/*tokens, idx, options*/) {
+ return '\n';
+};
+rules.ordered_list_open = function (tokens, idx /*, options*/) {
+ var token = tokens[idx];
+ return ' 1 ? ' start="' + token.order + '"' : '')
+ + '>\n';
+};
+rules.ordered_list_close = function (tokens, idx /*, options*/) {
+ return '
' + getBreak(tokens, idx);
+};
- // count heading level
- level = 1;
- ch = state.src.charCodeAt(++pos);
- while (ch === 0x23/* # */ && pos < max && level <= 6) {
- level++;
- ch = state.src.charCodeAt(++pos);
- }
- if (level > 6 || (pos < max && !isWhiteSpace(ch))) { return false; }
+rules.paragraph_open = function (/*tokens, idx, options*/) {
+ return '';
+};
+rules.paragraph_close = function (tokens, idx /*, options*/) {
+ return '
' + getBreak(tokens, idx);
+};
- // skip spaces before heading text
- pos = skipSpaces(state, pos);
- // Now pos contains offset of first heared char
- // Let's cut tails like ' ### ' from the end of string
+rules.link_open = function (tokens, idx /*, options*/) {
+ var title = tokens[idx].title ? (' title="' + escapeHtml(replaceEntities(tokens[idx].title)) + '"') : '';
+ return '';
+};
+rules.link_close = function (/*tokens, idx, options*/) {
+ return '';
+};
- max = skipCharsBack(state, max, 0x20/* space */, pos);
- max = skipCharsBack(state, max, 0x23/* # */, pos);
- if (max < state.eMarks[startLine] &&
- state.src.charCodeAt(max) === 0x23/* # */ &&
- state.src.charCodeAt(max - 1) === 0x5C/* \ */) {
- max++;
- }
+rules.image = function (tokens, idx, options) {
+ var src = ' src="' + escapeHtml(escapeUrl(tokens[idx].src)) + '"';
+ var title = tokens[idx].title ? (' title="' + escapeHtml(replaceEntities(tokens[idx].title)) + '"') : '';
+ var alt = ' alt="' + (tokens[idx].alt ? escapeHtml(replaceEntities(tokens[idx].alt)) : '') + '"';
+ var suffix = options.xhtml ? ' /' : '';
+ return '';
+};
- // ## Foo ####
- // ^^^
- max = skipCharsBack(state, max, 0x20/* space */, pos);
- if (silent) { return true; }
+rules.table_open = function (/*tokens, idx, options*/) {
+ return '\n';
+};
+rules.table_close = function (/*tokens, idx, options*/) {
+ return '
\n';
+};
+rules.tr_open = function (/*tokens, idx, options*/) {
+ return '\n';
+};
+rules.tr_close = function (/*tokens, idx, options*/) {
+ return '
\n';
+};
+rules.th_open = function (tokens, idx /*, options*/) {
+ var token = tokens[idx];
+ return '';
+};
+rules.th_close = function (/*tokens, idx, options*/) {
+ return ' | \n';
+};
+rules.td_open = function (tokens, idx /*, options*/) {
+ var token = tokens[idx];
+ return '';
+};
+rules.td_close = function (/*tokens, idx, options*/) {
+ return ' | \n';
+};
- state.tokens.push({ type: 'heading_open', level: level });
- // only if header is not empty
- if (pos < max) {
- state.tokens.push({
- type: 'inline',
- content: state.src.slice(pos, max).trim()
- });
- }
- state.tokens.push({ type: 'heading_close', level: level });
- state.line = startLine + 1;
- return true;
+rules.strong_open = function(/*tokens, idx, options*/) {
+ return '';
+};
+rules.strong_close = function(/*tokens, idx, options*/) {
+ return '';
+};
+rules.em_open = function(/*tokens, idx, options*/) {
+ return '';
+};
+rules.em_close = function(/*tokens, idx, options*/) {
+ return '';
};
-},{"../helpers":6}],12:[function(require,module,exports){
-// Horizontal rule
-'use strict';
+rules.hardbreak = function (tokens, idx, options) {
+ return options.xhtml ? '
\n' : '
\n';
+};
+rules.softbreak = function (tokens, idx, options) {
+ return options.breaks ? (options.xhtml ? '
\n' : '
\n') : '\n';
+};
-var isWhiteSpace = require('../helpers').isWhiteSpace;
+rules.text = function (tokens, idx /*, options*/) {
+ return tokens[idx].content;
+};
-module.exports = function hr(state, startLine, endLine, silent) {
- var marker, cnt, ch,
- pos = state.bMarks[startLine],
- max = state.eMarks[startLine];
+rules.htmlblock = function (tokens, idx /*, options*/) {
+ return tokens[idx].content;
+};
+rules.htmltag = function (tokens, idx /*, options*/) {
+ return tokens[idx].content;
+};
- pos += state.tShift[startLine];
- if (pos > max) { return false; }
+// Renderer class
+function Renderer() {
+ // Clone rules object to allow local modifications
+ this.rules = assign({}, rules);
+}
- marker = state.src.charCodeAt(pos++);
+Renderer.prototype.render = function (tokens, options) {
+ var i, len, rule, name, next,
+ result = '',
+ rules = this.rules,
+ tightStack = [];
- // Check hr marker
- if (marker !== 0x2A/* * */ &&
- marker !== 0x2D/* - */ &&
- marker !== 0x5F/* _ */) {
- return false;
- }
+ // wrap paragraphs on top level by default
+ var tight = false;
- // markers can be mixed with spaces, but there should be at least 3 one
+ for (i = 0, len = tokens.length; i < len; i++) {
+ name = tokens[i].type;
+ rule = rules[name];
- cnt = 1;
- while (pos < max) {
- ch = state.src.charCodeAt(pos++);
- if (ch !== marker && !isWhiteSpace(ch)) { return false; }
- if (ch === marker) { cnt++; }
- }
+ // Dirty stack machine to track lists style (loose/tight)
+ if (name === 'ordered_list_open' || name === 'bullet_list_open') {
+ tightStack.push(tight);
+ tight = tokens[i].tight;
+ }
+ if (name === 'ordered_list_close' || name === 'bullet_list_close') {
+ tight = tightStack.pop();
+ }
+ if (name === 'blockquote_open') {
+ tightStack.push(tight);
+ tight = false;
+ }
+ if (name === 'blockquote_close') {
+ tight = tightStack.pop();
+ }
- if (cnt < 3) { return false; }
- if (silent) { return true; }
+ // in tight mode just ignore paragraphs for lists
+ // TODO - track right nesting to blockquotes
+ if (name === 'paragraph_open' && tight) {
+ continue;
+ }
+ if (name === 'paragraph_close' && tight) {
+ // Quick hack - texts should have LF if followed by blocks
+ if (i + 1 < tokens.length) {
+ next = tokens[i + 1].type;
+ if (next === 'bullet_list_open' ||
+ next === 'ordered_list_open' ||
+ next === 'blockquote_open') {
+ result += '\n';
+ }
+ }
- state.tokens.push({ type: 'hr' });
+ continue;
+ }
- state.line = startLine + 1;
- return true;
+ if (tokens[i].type === 'inline') {
+ result += this.render(tokens[i].children, options);
+ } else {
+ // TODO: temporary check
+ if (!rule) {
+ throw new Error('Renderer error: unknown token ' + name);
+ }
+ result += rule(tokens, i, options);
+ }
+ }
+
+ return result;
};
-},{"../helpers":6}],13:[function(require,module,exports){
-// HTML block
+module.exports = Renderer;
+
+},{"./helpers":6,"object-assign":36}],13:[function(require,module,exports){
+// Ruler is helper class to build responsibility chains from parse rules.
+// It allows:
+//
+// - easy stack rules chains
+// - getting main chain and named chains content (as arrays of functions)
'use strict';
-var isEmpty = require('../helpers').isEmpty;
-var getLines = require('../helpers').getLines;
+////////////////////////////////////////////////////////////////////////////////
+// helpers
-var block_names = require('../common/html_blocks');
+function _class(obj) { return Object.prototype.toString.call(obj); }
+function isFunction(obj) { return _class(obj) === '[object Function]'; }
+function functionName(fn) {
+ var ret = fn.toString();
+ ret = ret.substr('function '.length);
+ ret = ret.substr(0, ret.indexOf('('));
+ return ret;
+}
-var HTML_TAG_OPEN_RE = /^<([a-zA-Z]{1,15})[\s\/>]/;
-var HTML_TAG_CLOSE_RE = /^<\/([a-zA-Z]{1,15})[\s>]/;
-function isLetter(ch) {
- /*eslint no-bitwise:0*/
- var lc = ch | 0x20; // to lower case
- return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
-}
+////////////////////////////////////////////////////////////////////////////////
-module.exports = function htmlblock(state, startLine, endLine, silent) {
- var ch, match, nextLine,
- pos = state.bMarks[startLine],
- max = state.eMarks[startLine],
- shift = state.tShift[startLine];
-
- pos += shift;
+function Ruler(compileFn) {
+ this.compile = compileFn; // callback to call after each change
- if (!state.options.html) { return false; }
+ // List of added rules. Each element is:
+ //
+ // {
+ // name: XXX,
+ // fn: Function(),
+ // alt: [ name2, name3 ]
+ // }
+ //
+ this.rules = [];
+}
- if (shift > 3 || pos + 2 >= max || state.blkLevel > 0) { return false; }
- if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
+// Find rule index by name
+//
+Ruler.prototype.find = function (name) {
+ for (var i = 0; i < this.rules.length; i++) {
+ if (this.rules[i].name === name) {
+ return i;
+ }
+ }
+ return -1;
+};
- ch = state.src.charCodeAt(pos + 1);
- if (ch === 0x21/* ! */ || ch === 0x3F/* ? */) {
- // Directive start / comment start / processing instruction start
- if (silent) { return true; }
+// Replace/delete parser function
+//
+Ruler.prototype.at = function (name, fn, altNames) {
+ var index = this.find(name);
- } else if (ch === 0x2F/* / */ || isLetter(ch)) {
+ if (index === -1) {
+ throw new Error('Parser rule not found: ' + name);
+ }
- // Probably start or end of tag
- if (ch === 0x2F/* \ */) {
- // closing tag
- match = state.src.slice(pos, max).match(HTML_TAG_CLOSE_RE);
- if (!match) { return false; }
- } else {
- // opening tag
- match = state.src.slice(pos, max).match(HTML_TAG_OPEN_RE);
- if (!match) { return false; }
+ if (isFunction(fn)) {
+ this.rules[index].fn = fn;
+ if (altNames) {
+ this.rules[index].alt = altNames;
}
- // Make sure tag name is valid
- if (block_names.indexOf(match[1].toLowerCase()) < 0) { return false; }
- if (silent) { return true; }
-
} else {
- return false;
- }
-
- // If we are here - we detected HTML block.
- // Let's roll down till empty line (block end).
- nextLine = startLine + 1;
- while (nextLine < state.lineMax && !isEmpty(state, nextLine)) {
- nextLine++;
+ this.rules = this.rules.slice(0, index).concat(this.rules.slice(index + 1));
}
- state.tokens.push({
- type: 'htmlblock',
- content: getLines(state, startLine, nextLine, 0, true)
- });
-
- state.line = nextLine;
- return true;
+ this.compile();
};
-},{"../common/html_blocks":2,"../helpers":6}],14:[function(require,module,exports){
-// lheading (---, ===)
-'use strict';
+// Add function to parser chain before one with given name.
+// Or add to start, if name not defined
+//
+Ruler.prototype.before = function (name, fn, altNames) {
+ var index;
+ if (isFunction(name)) {
+ altNames = fn;
+ fn = name;
+ name = '';
+ }
-var skipSpaces = require('../helpers').skipSpaces;
-var skipChars = require('../helpers').skipChars;
-var skipCharsBack = require('../helpers').skipCharsBack;
+ if (!name) {
+ this.rules.unshift({
+ name: functionName(fn),
+ fn: fn,
+ alt: altNames || []
+ });
+ } else {
-module.exports = function lheading(state, startLine, endLine, silent) {
- var marker, pos, max,
- next = startLine + 1;
+ index = this.find(name);
+ if (index === -1) {
+ throw new Error('Parser rule not found: ' + name);
+ }
+ this.rules.splice(index, 0, fn);
+ }
- if (next >= endLine) { return false; }
- if (state.tShift[next] < state.blkIndent) { return false; }
- if (state.bqMarks[next] < state.bqLevel) { return false; }
+ this.compile();
+};
- // Scan next line
- if (state.tShift[next] - state.blkIndent > 3) { return false; }
- pos = state.bMarks[next] + state.tShift[next];
- max = state.eMarks[next];
+// Add function to parser chain after one with given name.
+// Or add to end, if name not defined
+//
+Ruler.prototype.after = function (name, fn, altNames) {
+ var index;
- marker = state.src.charCodeAt(pos);
+ if (isFunction(name)) {
+ altNames = fn;
+ fn = name;
+ name = '';
+ }
- if (marker !== 0x2D/* - */ && marker !== 0x3D/* = */) { return false; }
+ if (!name) {
+ this.rules.push({
+ name: functionName(fn),
+ fn: fn,
+ alt: altNames || []
+ });
- pos = skipChars(state, pos, marker);
+ } else {
- pos = skipSpaces(state, pos);
+ index = this.find(name);
+ if (index === -1) {
+ throw new Error('Parser rule not found: ' + name);
+ }
+ this.rules.splice(index + 1, 0, fn);
+ }
- if (pos < max) { return false; }
+ this.compile();
+};
- if (silent) { return true; }
- pos = state.bMarks[startLine] + state.tShift[startLine];
- max = skipCharsBack(state, state.eMarks[startLine], 0x20/* space */, pos);
+// Get rules list as array of functions. By default returns main chain
+//
+Ruler.prototype.getRules = function (chainName) {
+ var result = [];
- state.tokens.push({ type: 'heading_open', level: marker === 0x3D/* = */ ? 1 : 2 });
- state.tokens.push({
- type: 'inline',
- content: state.src.slice(pos, max).trim()
- });
- state.tokens.push({ type: 'heading_close', level: marker === 0x3D/* = */ ? 1 : 2 });
+ if (!chainName) {
+ this.rules.forEach(function (rule) {
+ result.push(rule.fn);
+ });
+ return result;
+ }
- state.line = next + 1;
- return true;
+ this.rules.forEach(function (rule) {
+ if (rule.alt.indexOf(chainName) >= 0) {
+ result.push(rule.fn);
+ }
+ });
+ return result;
};
-},{"../helpers":6}],15:[function(require,module,exports){
-// Lists
+
+module.exports = Ruler;
+
+},{}],14:[function(require,module,exports){
+// Block quotes
'use strict';
-var isEmpty = require('../helpers').isEmpty;
-var skipSpaces = require('../helpers').skipSpaces;
+var skipSpaces = require('../helpers').skipSpaces;
-// Search `[-+*][\n ]`, returns next pos arter marker on success
-// or -1 on fail.
-function skipBulletListMarker(state, startLine) {
- var marker, pos, max;
+module.exports = function blockquote(state, startLine, endLine, silent) {
+ var nextLine, lastLineEmpty, oldTShift, oldBMarks, oldIndent, oldListMode,
+ terminatorRules = state.parser._rulesBlockquoteTerm, i, l, terminate,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
- pos = state.bMarks[startLine] + state.tShift[startLine];
- max = state.eMarks[startLine];
+ if (pos > max) { return false; }
- if (pos >= max) { return -1; }
+ // check the block quote marker
+ if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }
- marker = state.src.charCodeAt(pos++);
- // Check bullet
- if (marker !== 0x2A/* * */ &&
- marker !== 0x2D/* - */ &&
- marker !== 0x2B/* + */) {
- return -1;
- }
+ if (state.level >= state.options.maxLevel) { return false; }
- if (pos < max && state.src.charCodeAt(pos) !== 0x20) {
- // " 1.test " - is not a list item
- return -1;
- }
+ // we know that it's going to be a valid blockquote,
+ // so no point trying to find the end of it in silent mode
+ if (silent) { return true; }
- return pos;
-}
+ // skip one optional space after '>'
+ if (state.src.charCodeAt(pos) === 0x20) { pos++; }
-// Search `\d+[.)][\n ]`, returns next pos arter marker on success
-// or -1 on fail.
-function skipOrderedListMarker(state, startLine) {
- var ch,
- pos = state.bMarks[startLine] + state.tShift[startLine],
- max = state.eMarks[startLine];
+ state.bqMarks[startLine]++;
+ state.bqLevel++;
+ oldIndent = state.blkIndent;
+ state.blkIndent = 0;
- if (pos + 1 >= max) { return -1; }
+ oldBMarks = [ state.bMarks[startLine] ];
+ state.bMarks[startLine] = pos;
- ch = state.src.charCodeAt(pos++);
+ // check if we have an empty blockquote
+ pos = pos < max ? skipSpaces(state, pos) : pos;
+ lastLineEmpty = pos >= max;
- if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
+ oldTShift = [ state.tShift[startLine] ];
+ state.tShift[startLine] = pos - state.bMarks[startLine];
- for (;;) {
- // EOL -> fail
- if (pos >= max) { return -1; }
+ // Search the end of the block
+ //
+ // Block ends with either:
+ // 1. an empty line outside:
+ // ```
+ // > test
+ //
+ // ```
+ // 2. an empty line inside:
+ // ```
+ // >
+ // test
+ // ```
+ // 3. another tag
+ // ```
+ // > test
+ // - - -
+ // ```
+ for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
+ pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
- ch = state.src.charCodeAt(pos++);
+ if (pos >= max) {
+ // Case 1: line is not inside the blockquote, and this line is empty.
+ break;
+ }
- if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
+ if (state.src.charCodeAt(pos++) === 0x3E/* > */) {
+ state.bqMarks[nextLine]++;
+ // This line is inside the blockquote.
+
+ // skip one optional space after '>'
+ if (state.src.charCodeAt(pos) === 0x20) { pos++; }
+
+ oldBMarks.push(state.bMarks[nextLine]);
+ state.bMarks[nextLine] = pos;
+
+ pos = pos < max ? skipSpaces(state, pos) : pos;
+ lastLineEmpty = pos >= max;
+
+ oldTShift.push(state.tShift[nextLine]);
+ state.tShift[nextLine] = pos - state.bMarks[nextLine];
continue;
}
- // found valid marker
- if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
- break;
+ // Case 2: line is not inside the blockquote, and the last line was empty.
+ if (lastLineEmpty) { break; }
+
+ // Case 3: another tag found.
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
}
+ if (terminate) { break; }
- return -1;
+ oldBMarks.push(state.bMarks[nextLine]);
+ oldTShift.push(state.tShift[nextLine]);
}
+ oldListMode = state.listMode;
+ state.listMode = false;
+ state.tokens.push({ type: 'blockquote_open', level: state.level++ });
+ state.parser.tokenize(state, startLine, nextLine);
+ state.tokens.push({ type: 'blockquote_close', level: --state.level });
+ state.listMode = oldListMode;
- if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {
- // " 1.test " - is not a list item
- return -1;
+ // Restore original tShift; this might not be necessary since the parser
+ // has already been here, but just to make sure we can do that.
+ for (i = 0; i < oldTShift.length; i++) {
+ state.bMarks[i + startLine] = oldBMarks[i];
+ state.tShift[i + startLine] = oldTShift[i];
}
- return pos;
-}
+ state.bqLevel--;
+ state.blkIndent = oldIndent;
+ return true;
+};
-module.exports = function list(state, startLine, endLine, silent) {
- var nextLine,
- indent,
- oldTShift,
- oldIndent,
- oldTight,
- oldListMode,
- start,
- posAfterMarker,
- max,
- indentAfterMarker,
- markerValue,
- markerCharCode,
- isOrdered,
- contentStart,
- listTokIdx,
- prevEmptyEnd,
- rules_named = state.lexer.rules_named;
+},{"../helpers":6}],15:[function(require,module,exports){
+// Code block (4 spaces padded)
- // Detect list type and position after marker
- if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
- isOrdered = true;
- } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
- isOrdered = false;
- } else {
- return false;
- }
- // We should terminate list on style change. Remember first one to compare.
- markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
+'use strict';
- // For validation mode we can terminate immediately
- if (silent) { return true; }
- // Start list
- listTokIdx = state.tokens.length;
+var isEmpty = require('../helpers').isEmpty;
+var getLines = require('../helpers').getLines;
- if (isOrdered) {
- start = state.bMarks[startLine] + state.tShift[startLine];
- markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
- state.tokens.push({
- type: 'ordered_list_open',
- order: markerValue,
- tight: true
- });
+module.exports = function code(state, startLine, endLine, silent) {
+ var nextLine, last;
- } else {
- state.tokens.push({
- type: 'bullet_list_open',
- tight: true
- });
+ if (state.tShift[startLine] - state.blkIndent < 4) { return false; }
+
+ last = nextLine = startLine + 1;
+
+ while (nextLine < endLine) {
+ if (state.bqMarks[nextLine] < state.bqLevel) { break; }
+ if (isEmpty(state, nextLine)) {
+ nextLine++;
+ continue;
+ }
+ if (state.tShift[nextLine] - state.blkIndent >= 4) {
+ nextLine++;
+ last = nextLine;
+ continue;
+ }
+ break;
}
- //
- // Iterate list items
- //
+ if (silent) { return true; }
- nextLine = startLine;
- prevEmptyEnd = false;
+ state.tokens.push({
+ type: 'code',
+ content: getLines(state, startLine, last, 4 + state.blkIndent, true),
+ block: true,
+ level: state.level
+ });
- while (nextLine < endLine) {
- contentStart = skipSpaces(state, posAfterMarker);
- max = state.eMarks[nextLine];
+ state.line = nextLine;
+ return true;
+};
- if (contentStart >= max) {
- // trimming space in "- \n 3" case, indent is 1 here
- indentAfterMarker = 1;
- } else {
- indentAfterMarker = contentStart - posAfterMarker;
- }
+},{"../helpers":6}],16:[function(require,module,exports){
+// fences (``` lang, ~~~ lang)
- // If we have more than 4 spaces, the indent is 1
- // (the rest is just indented code block)
- if (indentAfterMarker > 4) { indentAfterMarker = 1; }
+'use strict';
- // If indent is less than 1, assume that it's one, example:
- // "-\n test"
- if (indentAfterMarker < 1) { indentAfterMarker = 1; }
- // " - test"
- // ^^^^^ - calculating total length of this thing
- indent = (posAfterMarker - state.bMarks[nextLine]) + indentAfterMarker;
+var skipSpaces = require('../helpers').skipSpaces;
+var skipChars = require('../helpers').skipChars;
+var getLines = require('../helpers').getLines;
- // Run sublexer & write tokens
- state.tokens.push({ type: 'list_item_open' });
- //nextLine++;
+module.exports = function fences(state, startLine, endLine, silent) {
+ var marker, len, params, nextLine, mem,
+ haveEndMarker = false,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
- oldIndent = state.blkIndent;
- oldTight = state.tight;
- oldTShift = state.tShift[startLine];
- oldListMode = state.listMode;
- state.tShift[startLine] = contentStart - state.bMarks[startLine];
- state.blkIndent = indent;
- state.tight = true;
- state.listMode = true;
+ if (pos + 3 > max) { return false; }
- state.lexer.tokenize(state, startLine, endLine, true);
+ marker = state.src.charCodeAt(pos);
- // If any of list item is tight, mark list as tight
- if (!state.tight || prevEmptyEnd) {
- state.tokens[listTokIdx].tight = false;
- }
- // Item become loose if finish with empty line,
- // but we should filter last element, because it means list finish
- prevEmptyEnd = (state.line - startLine) > 1 && isEmpty(state, state.line - 1);
+ if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {
+ return false;
+ }
- state.blkIndent = oldIndent;
- state.tShift[startLine] = oldTShift;
- state.tight = oldTight;
- state.listMode = oldListMode;
+ // scan marker length
+ mem = pos;
+ pos = skipChars(state, pos, marker);
- state.tokens.push({ type: 'list_item_close' });
+ len = pos - mem;
- nextLine = startLine = state.line;
- contentStart = state.bMarks[startLine];
+ if (len < 3) { return false; }
- if (nextLine >= endLine) { break; }
+ params = state.src.slice(pos, max).trim();
- if (isEmpty(state, nextLine)) {
- if (nextLine >= endLine || isEmpty(state, nextLine)) {
- // two newlines end the list
+ if (params.indexOf('`') >= 0) { return false; }
+
+ // Since start is found, we can report success here in validation mode
+ if (silent) { return true; }
+
+ // search end of block
+ nextLine = startLine;
+
+ for (;;) {
+ nextLine++;
+ if (nextLine >= endLine) {
+ // unclosed block should be autoclosed by end of document.
+ // also block seems to be autoclosed by end of parent
+ /*if (state.blkLevel === 0) {
break;
- } else {
- nextLine++;
}
+ return false;*/
+ break;
}
- //
- // Try to check if list is terminated or continued.
- //
- if (state.tShift[nextLine] < state.blkIndent) { break; }
- if (state.bqMarks[nextLine] < state.bqLevel) { break; }
-
- // fail if terminating block found
- if (rules_named.fences(state, nextLine, endLine, true)) { break; }
- if (rules_named.blockquote(state, nextLine, endLine, true)) { break; }
- if (rules_named.hr(state, nextLine, endLine, true)) { break; }
+ pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
- // fail if list has another type
- if (isOrdered) {
- posAfterMarker = skipOrderedListMarker(state, nextLine);
- if (posAfterMarker < 0) { break; }
- } else {
- posAfterMarker = skipBulletListMarker(state, nextLine);
- if (posAfterMarker < 0) { break; }
+ if (pos < max && state.tShift[nextLine] < state.blkIndent) {
+ // non-empty line with negative indent should stop the list:
+ // - ```
+ // test
+ break;
}
+ if (pos < max && state.bqMarks[nextLine] < state.bqLevel) { break; }
- if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
- }
+ if (state.src.charCodeAt(pos) !== marker) { continue; }
- // Finilize list
- if (isOrdered) {
- state.tokens.push({ type: 'ordered_list_close' });
- } else {
- state.tokens.push({ type: 'bullet_list_close' });
+ pos = skipChars(state, pos, marker);
+
+ // closing code fence must be at least as long as the opening one
+ if (pos - mem < len) { continue; }
+
+ // make sure tail has spaces only
+ pos = skipSpaces(state, pos);
+
+ if (pos < max) { continue; }
+
+ haveEndMarker = true;
+ // found!
+ break;
}
- state.line = nextLine;
+ // If a fence has heading spaces, they should be removed from its inner block
+ len = state.tShift[startLine];
+
+ state.tokens.push({
+ type: 'fence',
+ params: params,
+ content: getLines(state, startLine + 1, nextLine, len, true),
+ level: state.level
+ });
+
+ state.line = nextLine + (haveEndMarker ? 1 : 0);
return true;
};
-},{"../helpers":6}],16:[function(require,module,exports){
-// Paragraph
+},{"../helpers":6}],17:[function(require,module,exports){
+// heading (#, ##, ...)
'use strict';
-var isEmpty = require('../helpers').isEmpty;
-var getLines = require('../helpers').getLines;
+var isWhiteSpace = require('../helpers').isWhiteSpace;
+var skipSpaces = require('../helpers').skipSpaces;
+var skipCharsBack = require('../helpers').skipCharsBack;
-module.exports = function paragraph(state, startLine/*, endLine*/) {
- var endLine, content, ref, t,
- nextLine = startLine + 1,
- rules_named = state.lexer.rules_named;
+module.exports = function heading(state, startLine, endLine, silent) {
+ var ch, level,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
- endLine = state.lineMax;
+ if (pos >= max) { return false; }
- // jump line-by-line until empty one or EOF
- for (; nextLine < endLine && !isEmpty(state, nextLine); nextLine++) {
- // this would be a code block normally, but after paragraph
- // it's considered a lazy continuation regardless of what's there
- if (state.tShift[nextLine] - state.blkIndent > 3) { continue; }
+ ch = state.src.charCodeAt(pos);
- // Some tags can terminate paragraph without empty line.
- if (rules_named.fences(state, nextLine, endLine, true)) { break; }
- if (rules_named.hr(state, nextLine, endLine, true)) { break; }
- if (rules_named.list(state, nextLine, endLine, true)) { break; }
- if (rules_named.heading(state, nextLine, endLine, true)) { break; }
- // setex header can't interrupt paragraph
- // if (rules_named.lheading(state, nextLine, endLine, true)) { break; }
- if (rules_named.blockquote(state, nextLine, endLine, true)) { break; }
- if (rules_named.htmlblock(state, nextLine, endLine, true)) { break; }
- if (rules_named.table(state, nextLine, endLine, true)) { break; }
- //if (rules_named.tag(state, nextLine, endLine, true)) { break; }
- //if (rules_named.def(state, nextLine, endLine, true)) { break; }
+ if (ch !== 0x23/* # */ || pos >= max) { return false; }
+
+ // count heading level
+ level = 1;
+ ch = state.src.charCodeAt(++pos);
+ while (ch === 0x23/* # */ && pos < max && level <= 6) {
+ level++;
+ ch = state.src.charCodeAt(++pos);
}
- content = getLines(state, startLine, nextLine, state.blkIndent, false).trim();
+ if (level > 6 || (pos < max && !isWhiteSpace(ch))) { return false; }
+
+ // skip spaces before heading text
+ pos = skipSpaces(state, pos);
- while ((ref = state.lexer.inline.parse_reference(content, state.options, state.env))) {
- t = state.env.references;
- t[ref.label] = t[ref.label] || { title: ref.title, href: ref.href };
- content = ref.remaining.trim();
+ // Now pos contains offset of first heared char
+ // Let's cut tails like ' ### ' from the end of string
+
+ max = skipCharsBack(state, max, 0x20/* space */, pos);
+ max = skipCharsBack(state, max, 0x23/* # */, pos);
+
+ if (max < state.eMarks[startLine] &&
+ state.src.charCodeAt(max) === 0x23/* # */ &&
+ state.src.charCodeAt(max - 1) === 0x5C/* \ */) {
+ max++;
}
- if (content) {
- state.tokens.push({ type: 'paragraph_open' });
+ // ## Foo ####
+ // ^^^
+ max = skipCharsBack(state, max, 0x20/* space */, pos);
+
+ if (silent) { return true; }
+
+ state.tokens.push({ type: 'heading_open', hLevel: level, level: state.level });
+ // only if header is not empty
+ if (pos < max) {
state.tokens.push({
type: 'inline',
- content: content
+ content: state.src.slice(pos, max).trim(),
+ level: state.level + 1
});
- state.tokens.push({ type: 'paragraph_close' });
}
+ state.tokens.push({ type: 'heading_close', hLevel: level, level: state.level });
- state.line = nextLine;
+ state.line = startLine + 1;
return true;
};
-},{"../helpers":6}],17:[function(require,module,exports){
-// Parser state class
+},{"../helpers":6}],18:[function(require,module,exports){
+// Horizontal rule
'use strict';
-function State(src, lexer, tokens, options, env) {
- var ch, s, start, pos, len, indent, indent_found;
-
- // TODO: check if we can move string replaces to parser, to avoid
- // unnesessary call on shadow clone creation. Or check if we can do
- // cloning more effectively. Profile first.
-
- // Prepare string to parse:
- //
- // - replace tabs with spaces
- // - remove `\r` to simplify newlines check (???)
-
- this.src = src;
-
- // Shortcuts to simplify nested calls
- this.lexer = lexer;
-
- // TODO: (?) set directly for faster access.
- this.options = options;
-
- this.env = env;
+var isWhiteSpace = require('../helpers').isWhiteSpace;
- //
- // Internal state vartiables
- //
- this.tokens = tokens;
+module.exports = function hr(state, startLine, endLine, silent) {
+ var marker, cnt, ch,
+ pos = state.bMarks[startLine],
+ max = state.eMarks[startLine];
- this.bMarks = []; // line begin offsets for fast jumps
- this.eMarks = []; // line end offsets for fast jumps
- this.tShift = []; // indent for each line
+ pos += state.tShift[startLine];
- // Generate markers.
- s = this.src;
- indent = 0;
- indent_found = false;
+ if (pos > max) { return false; }
- for (start = pos = indent = 0, len = s.length; pos < len; pos++) {
- ch = s.charCodeAt(pos);
+ marker = state.src.charCodeAt(pos++);
- // TODO: check other spaces and tabs too or keep existing regexp replace ??
- if (!indent_found && ch === 0x20/* space */) {
- indent++;
- }
- if (!indent_found && ch !== 0x20/* space */) {
- this.tShift.push(indent);
- indent_found = true;
- }
+ // Check hr marker
+ if (marker !== 0x2A/* * */ &&
+ marker !== 0x2D/* - */ &&
+ marker !== 0x5F/* _ */) {
+ return false;
+ }
+ // markers can be mixed with spaces, but there should be at least 3 one
- if (ch === 0x0D || ch === 0x0A) {
- this.bMarks.push(start);
- this.eMarks.push(pos);
- indent_found = false;
- indent = 0;
- start = pos + 1;
- }
- if (ch === 0x0D && pos < len && s.charCodeAt(pos) === 0x0A) {
- pos++;
- start++;
- }
- }
- if (ch !== 0x0D || ch !== 0x0A) {
- this.bMarks.push(start);
- this.eMarks.push(len);
- this.tShift.push(indent);
+ cnt = 1;
+ while (pos < max) {
+ ch = state.src.charCodeAt(pos++);
+ if (ch !== marker && !isWhiteSpace(ch)) { return false; }
+ if (ch === marker) { cnt++; }
}
- // Push fake entry to simplify cache bounds checks
- this.bMarks.push(s.length);
- this.eMarks.push(s.length);
- this.tShift.push(0);
-
- // inline lexer variables
- this.pos = 0; // char index in src
+ if (cnt < 3) { return false; }
- // block lexer variables
- this.blkLevel = 0;
- this.blkIndent = 0;
- this.line = 0; // line index in src
- this.lineMax = this.bMarks.length - 1; // don't count last fake line
- this.tight = false; // loose/tight mode for lists
- this.listMode = false; // if true, block parser stops on two newlines
+ if (silent) { return true; }
- // Stuff for blockquotes
- this.bqLevel = 0;
- this.bqMarks = [];
- for (start = 0; start < this.bMarks.length; start++) {
- this.bqMarks.push(0);
- }
+ state.tokens.push({ type: 'hr', level: state.level });
- // renderer
- this.result = '';
-}
+ state.line = startLine + 1;
+ return true;
+};
+},{"../helpers":6}],19:[function(require,module,exports){
+// HTML block
-// Create shadow clone of curent state with new input data
-State.prototype.clone = function clone(src) {
- return new State(
- src,
- this.lexer,
- this.tokens,
- this.options
- );
-};
+'use strict';
-module.exports = State;
-},{}],18:[function(require,module,exports){
-// GFM table, non-standard
+var isEmpty = require('../helpers').isEmpty;
+var getLines = require('../helpers').getLines;
-'use strict';
+var block_names = require('../common/html_blocks');
-function lineMatch(state, line, reg) {
- var pos = state.bMarks[line],
- max = state.eMarks[line];
+var HTML_TAG_OPEN_RE = /^<([a-zA-Z]{1,15})[\s\/>]/;
+var HTML_TAG_CLOSE_RE = /^<\/([a-zA-Z]{1,15})[\s>]/;
- return state.src.substr(pos, max - pos).match(reg);
+function isLetter(ch) {
+ /*eslint no-bitwise:0*/
+ var lc = ch | 0x20; // to lower case
+ return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
}
+module.exports = function htmlblock(state, startLine, endLine, silent) {
+ var ch, match, nextLine,
+ pos = state.bMarks[startLine],
+ max = state.eMarks[startLine],
+ shift = state.tShift[startLine];
-module.exports = function table(state, startLine, endLine, silent) {
- var ch, firstLineMatch, secondLineMatch, i, nextLine, m, rows,
- aligns, t;
+ pos += shift;
- // should have at least three lines
- if (startLine + 2 > endLine) { return false; }
+ if (!state.options.html) { return false; }
- // first character of the second line should be '|' or '-'
- ch = state.src.charCodeAt(state.bMarks[startLine + 1]
- + state.tShift[startLine + 1]);
- if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */) { return false; }
+ if (shift > 3 || pos + 2 >= max || state.blkLevel > 0) { return false; }
- secondLineMatch = lineMatch(state, startLine + 1,
- /^ *\|?(( *[:-]-+[:-] *\|)+( *[:-]-+[:-] *))\|? *$/);
- if (!secondLineMatch) { return false; }
+ if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
- rows = secondLineMatch[1].split('|');
- aligns = [];
- for (i = 0; i < rows.length; i++) {
- t = rows[i].trim();
- if (t[t.length - 1] === ':') {
- aligns[i] = t[0] === ':' ? 'center' : 'right';
- } else if (t[0] === ':') {
- aligns[i] = 'left';
- } else {
- aligns[i] = '';
- }
- }
+ ch = state.src.charCodeAt(pos + 1);
- firstLineMatch = lineMatch(state, startLine, /^ *\|?(.*?\|.*?)\|? *$/);
- if (!firstLineMatch) { return false; }
+ if (ch === 0x21/* ! */ || ch === 0x3F/* ? */) {
+ // Directive start / comment start / processing instruction start
+ if (silent) { return true; }
- rows = firstLineMatch[1].split('|');
- if (aligns.length !== rows.length) { return false; }
- if (silent) { return true; }
+ } else if (ch === 0x2F/* / */ || isLetter(ch)) {
- state.tokens.push({ type: 'table_open' });
+ // Probably start or end of tag
+ if (ch === 0x2F/* \ */) {
+ // closing tag
+ match = state.src.slice(pos, max).match(HTML_TAG_CLOSE_RE);
+ if (!match) { return false; }
+ } else {
+ // opening tag
+ match = state.src.slice(pos, max).match(HTML_TAG_OPEN_RE);
+ if (!match) { return false; }
+ }
+ // Make sure tag name is valid
+ if (block_names.indexOf(match[1].toLowerCase()) < 0) { return false; }
+ if (silent) { return true; }
- state.tokens.push({ type: 'tr_open' });
- for (i = 0; i < rows.length; i++) {
- state.tokens.push({ type: 'th_open', align: aligns[i] });
- state.tokens.push({
- type: 'inline',
- content: rows[i].trim()
- });
- state.tokens.push({ type: 'th_close' });
+ } else {
+ return false;
}
- state.tokens.push({ type: 'tr_close' });
-
- for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
- m = lineMatch(state, nextLine, /^ *\|?(.*?\|.*?)\|? *$/);
- if (!m) { break; }
- rows = m[1].split('|');
- state.tokens.push({ type: 'tr_open' });
- for (i = 0; i < rows.length; i++) {
- state.tokens.push({ type: 'td_open', align: aligns[i] });
- state.tokens.push({
- type: 'inline',
- content: rows[i].replace(/^\|? *| *\|?$/g, '')
- });
- state.tokens.push({ type: 'td_close' });
- }
- state.tokens.push({ type: 'tr_close' });
+ // If we are here - we detected HTML block.
+ // Let's roll down till empty line (block end).
+ nextLine = startLine + 1;
+ while (nextLine < state.lineMax && !isEmpty(state, nextLine)) {
+ nextLine++;
}
- state.tokens.push({ type: 'table_close' });
+
+ state.tokens.push({
+ type: 'htmlblock',
+ level: state.level,
+ content: getLines(state, startLine, nextLine, 0, true)
+ });
state.line = nextLine;
return true;
};
-},{}],19:[function(require,module,exports){
-// Inline lexer
+},{"../common/html_blocks":2,"../helpers":6}],20:[function(require,module,exports){
+// lheading (---, ===)
'use strict';
-var StateInline = require('./lexer_inline/state_inline');
-var links = require('./lexer_inline/links');
-var skipSpaces = require('./helpers').skipSpaces;
+var skipSpaces = require('../helpers').skipSpaces;
+var skipChars = require('../helpers').skipChars;
+var skipCharsBack = require('../helpers').skipCharsBack;
-////////////////////////////////////////////////////////////////////////////////
-// Lexer rules
-var rules = [];
+module.exports = function lheading(state, startLine, endLine, silent) {
+ var marker, pos, max,
+ next = startLine + 1;
+ if (next >= endLine) { return false; }
+ if (state.tShift[next] < state.blkIndent) { return false; }
+ if (state.bqMarks[next] < state.bqLevel) { return false; }
-// Pure text
-rules.push(require('./lexer_inline/text'));
-rules.push(require('./lexer_inline/newline'));
-rules.push(require('./lexer_inline/escape'));
-rules.push(require('./lexer_inline/backticks'));
-//
-//
-rules.push(require('./lexer_inline/emphasis'));
-rules.push(require('./lexer_inline/links'));
-rules.push(require('./lexer_inline/autolink'));
-rules.push(require('./lexer_inline/htmltag'));
-rules.push(require('./lexer_inline/entity'));
-rules.push(require('./lexer_inline/escape_html_char'));
+ // Scan next line
+ if (state.tShift[next] - state.blkIndent > 3) { return false; }
+ pos = state.bMarks[next] + state.tShift[next];
+ max = state.eMarks[next];
-////////////////////////////////////////////////////////////////////////////////
-// Lexer class
+ marker = state.src.charCodeAt(pos);
+ if (marker !== 0x2D/* - */ && marker !== 0x3D/* = */) { return false; }
-function functionName(fn) {
- var ret = fn.toString();
- ret = ret.substr('function '.length);
- ret = ret.substr(0, ret.indexOf('('));
- return ret;
-}
+ pos = skipChars(state, pos, marker);
-function findByName(self, name) {
- for (var i = 0; i < self.rules.length; i++) {
- if (functionName(self.rules[i]) === name) {
- return i;
- }
- }
- return -1;
-}
+ pos = skipSpaces(state, pos);
+ if (pos < max) { return false; }
-// Block Lexer class
-//
-function LexerInline() {
- this.rules = [];
+ if (silent) { return true; }
- // Rule to skip pure text
- // - '{$%@}' reserved for extentions
- // - '<>"' added for internal html escaping
- this.textMatch = /^[^\n\\`*_\[\]!&{}$%@<>"]+/;
+ pos = state.bMarks[startLine] + state.tShift[startLine];
+ max = skipCharsBack(state, state.eMarks[startLine], 0x20/* space */, pos);
- for (var i = 0; i < rules.length; i++) {
- this.after(null, rules[i]);
- }
-}
+ state.tokens.push({
+ type: 'heading_open',
+ hLevel: marker === 0x3D/* = */ ? 1 : 2,
+ level: state.level
+ });
+ state.tokens.push({
+ type: 'inline',
+ content: state.src.slice(pos, max).trim(),
+ level: state.level + 1
+ });
+ state.tokens.push({
+ type: 'heading_close',
+ hLevel: marker === 0x3D/* = */ ? 1 : 2,
+ level: state.level
+ });
+ state.line = next + 1;
+ return true;
+};
-// Replace/delete lexer function
-//
-LexerInline.prototype.at = function (name, fn) {
- var index = findByName(name);
- if (index === -1) {
- throw new Error('Lexer rule not found: ' + name);
- }
+},{"../helpers":6}],21:[function(require,module,exports){
+// Lists
- if (fn) {
- this.rules[index] = fn;
- } else {
- this.rules = this.rules.slice(0, index).concat(this.rules.slice(index + 1));
- }
-};
+'use strict';
-// Add function to lexer chain before one with given name.
-// Or add to start, if name not defined
-//
-LexerInline.prototype.before = function (name, fn) {
- if (!name) {
- this.rules.unshift(fn);
- return;
- }
+var isEmpty = require('../helpers').isEmpty;
+var skipSpaces = require('../helpers').skipSpaces;
- var index = findByName(name);
- if (index === -1) {
- throw new Error('Lexer rule not found: ' + name);
- }
- this.rules.splice(index, 0, fn);
-};
+// Search `[-+*][\n ]`, returns next pos arter marker on success
+// or -1 on fail.
+function skipBulletListMarker(state, startLine) {
+ var marker, pos, max;
+ pos = state.bMarks[startLine] + state.tShift[startLine];
+ max = state.eMarks[startLine];
-// Add function to lexer chain after one with given name.
-// Or add to end, if name not defined
-//
-LexerInline.prototype.after = function (name, fn) {
- if (!name) {
- this.rules.push(fn);
- return;
+ if (pos >= max) { return -1; }
+
+ marker = state.src.charCodeAt(pos++);
+ // Check bullet
+ if (marker !== 0x2A/* * */ &&
+ marker !== 0x2D/* - */ &&
+ marker !== 0x2B/* + */) {
+ return -1;
}
- var index = findByName(name);
- if (index === -1) {
- throw new Error('Lexer rule not found: ' + name);
+ if (pos < max && state.src.charCodeAt(pos) !== 0x20) {
+ // " 1.test " - is not a list item
+ return -1;
}
- this.rules.splice(index + 1, 0, fn);
-};
+ return pos;
+}
+// Search `\d+[.)][\n ]`, returns next pos arter marker on success
+// or -1 on fail.
+function skipOrderedListMarker(state, startLine) {
+ var ch,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
-// Generate tokens for input range
-//
-LexerInline.prototype.tokenize = function (state) {
- var ok, i,
- rules = this.rules,
- len = this.rules.length,
- end = state.posMax;
+ if (pos + 1 >= max) { return -1; }
- while (state.pos < end) {
+ ch = state.src.charCodeAt(pos++);
- // Try all possible rules.
- // On success, rule should:
- //
- // - update `state.pos`
- // - update `state.tokens`
- // - return true
+ if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
- for (i = 0; i < len; i++) {
- ok = rules[i](state);
- if (ok) { break; }
- }
+ for (;;) {
+ // EOL -> fail
+ if (pos >= max) { return -1; }
- if (ok) {
- if (state.pos >= end) { break; }
+ ch = state.src.charCodeAt(pos++);
+
+ if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
continue;
}
- state.pending += state.src[state.pos++];
- }
+ // found valid marker
+ if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
+ break;
+ }
- if (state.pending) {
- state.pushPending();
+ return -1;
}
- return state.tokens;
-};
-
-// Parse input string.
-//
-LexerInline.prototype.parse = function (str, options, env) {
- var state = new StateInline(str, this, options, env);
- this.tokenize(state);
+ if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {
+ // " 1.test " - is not a list item
+ return -1;
+ }
+ return pos;
+}
- return state.tokens;
-};
-// Parse link reference definition.
-//
-LexerInline.prototype.parse_reference = function (str, options) {
- var state, labelEnd, pos, max, code, start, href, title;
+module.exports = function list(state, startLine, endLine, silent) {
+ var nextLine,
+ indent,
+ oldTShift,
+ oldIndent,
+ oldTight,
+ oldListMode,
+ start,
+ posAfterMarker,
+ max,
+ indentAfterMarker,
+ markerValue,
+ markerCharCode,
+ isOrdered,
+ contentStart,
+ listTokIdx,
+ prevEmptyEnd,
+ terminatorRules = state.parser._rulesListTerm, i, l, terminate;
- if (str.charCodeAt(0) !== 0x5B/* [ */) { return null; }
+ // Detect list type and position after marker
+ if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
+ isOrdered = true;
+ } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
+ isOrdered = false;
+ } else {
+ return false;
+ }
- state = new StateInline(str, this, options);
- labelEnd = links.parseLinkLabel(state, 0);
+ if (state.level >= state.options.maxLevel) { return false; }
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return null; }
+ // We should terminate list on style change. Remember first one to compare.
+ markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
- max = state.posMax;
+ // For validation mode we can terminate immediately
+ if (silent) { return true; }
- // [label]: destination 'title'
- // ^^^ skip optional whitespace here
- for (pos = labelEnd + 2; pos < max; pos++) {
- code = state.src.charCodeAt(pos);
- if (code !== 0x20 && code !== 0x0A) { break; }
- }
+ // Start list
+ listTokIdx = state.tokens.length;
- // [label]: destination 'title'
- // ^^^^^^^^^^^ parse this
- href = links.parseLinkDestination(state, pos);
- if (href === null) { return null; }
- pos = state.pos;
+ if (isOrdered) {
+ start = state.bMarks[startLine] + state.tShift[startLine];
+ markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
- // [label]: destination 'title'
- // ^^^ skipping those spaces
- start = pos;
- for (pos = pos + 1; pos < max; pos++) {
- code = state.src.charCodeAt(pos);
- if (code !== 0x20 && code !== 0x0A) { break; }
- }
+ state.tokens.push({
+ type: 'ordered_list_open',
+ order: markerValue,
+ tight: true,
+ level: state.level++
+ });
- // [label]: destination 'title'
- // ^^^^^^^ parse this
- if (pos < max && start !== pos && (title = links.parseLinkTitle(state, pos)) !== null) {
- pos = state.pos;
} else {
- title = '';
- pos = start;
+ state.tokens.push({
+ type: 'bullet_list_open',
+ tight: true,
+ level: state.level++
+ });
}
- // ensure that the end of the line is empty
- pos = skipSpaces(state, pos);
- if (pos < max && state.src.charCodeAt(pos) !== 0x0A) { return null; }
+ //
+ // Iterate list items
+ //
- return {
- label: links.normalizeReference(str.slice(1, labelEnd)),
- title: title,
- href: href,
- remaining: str.slice(pos)
- };
-};
+ nextLine = startLine;
+ prevEmptyEnd = false;
+ while (nextLine < endLine) {
+ contentStart = skipSpaces(state, posAfterMarker);
+ max = state.eMarks[nextLine];
-module.exports = LexerInline;
+ if (contentStart >= max) {
+ // trimming space in "- \n 3" case, indent is 1 here
+ indentAfterMarker = 1;
+ } else {
+ indentAfterMarker = contentStart - posAfterMarker;
+ }
-},{"./helpers":6,"./lexer_inline/autolink":20,"./lexer_inline/backticks":21,"./lexer_inline/emphasis":22,"./lexer_inline/entity":23,"./lexer_inline/escape":24,"./lexer_inline/escape_html_char":25,"./lexer_inline/htmltag":26,"./lexer_inline/links":27,"./lexer_inline/newline":28,"./lexer_inline/state_inline":29,"./lexer_inline/text":30}],20:[function(require,module,exports){
-// Process autolinks ''
+ // If we have more than 4 spaces, the indent is 1
+ // (the rest is just indented code block)
+ if (indentAfterMarker > 4) { indentAfterMarker = 1; }
+ // If indent is less than 1, assume that it's one, example:
+ // "-\n test"
+ if (indentAfterMarker < 1) { indentAfterMarker = 1; }
-var escapeHtml = require('../helpers').escapeHtml;
-var url_schemas = require('../common/url_schemas');
+ // " - test"
+ // ^^^^^ - calculating total length of this thing
+ indent = (posAfterMarker - state.bMarks[nextLine]) + indentAfterMarker;
+ // Run subparser & write tokens
+ state.tokens.push({ type: 'list_item_open', level: state.level++ });
-/*eslint max-len:0*/
-var EMAIL_RE = /^<([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])?)*)>/;
-var AUTOLINK_RE = /^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;
+ //nextLine++;
+ oldIndent = state.blkIndent;
+ oldTight = state.tight;
+ oldTShift = state.tShift[startLine];
+ oldListMode = state.listMode;
+ state.tShift[startLine] = contentStart - state.bMarks[startLine];
+ state.blkIndent = indent;
+ state.tight = true;
+ state.listMode = true;
-module.exports = function autolink(state) {
- var tail, linkMatch, emailMatch, pos = state.pos;
+ state.parser.tokenize(state, startLine, endLine, true);
- if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
+ // If any of list item is tight, mark list as tight
+ if (!state.tight || prevEmptyEnd) {
+ state.tokens[listTokIdx].tight = false;
+ }
+ // Item become loose if finish with empty line,
+ // but we should filter last element, because it means list finish
+ prevEmptyEnd = (state.line - startLine) > 1 && isEmpty(state, state.line - 1);
- tail = state.src.slice(pos);
+ state.blkIndent = oldIndent;
+ state.tShift[startLine] = oldTShift;
+ state.tight = oldTight;
+ state.listMode = oldListMode;
- if (tail.indexOf('>') < 0) { return false; }
+ state.tokens.push({ type: 'list_item_close', level: --state.level });
- linkMatch = tail.match(AUTOLINK_RE);
+ nextLine = startLine = state.line;
+ contentStart = state.bMarks[startLine];
- if (linkMatch) {
- if (url_schemas.indexOf(linkMatch[1].toLowerCase()) < 0) { return false; }
+ if (nextLine >= endLine) { break; }
- state.push({
- type: 'link_open',
- href: linkMatch[0].slice(1, -1)
- });
- state.push({
- type: 'text',
- content: escapeHtml(linkMatch[0].slice(1, -1))
- });
- state.push({ type: 'link_close' });
+ if (isEmpty(state, nextLine)) {
+ if (nextLine >= endLine || isEmpty(state, nextLine)) {
+ // two newlines end the list
+ break;
+ } else {
+ nextLine++;
+ }
+ }
- state.pos += linkMatch[0].length;
- return true;
- }
+ //
+ // Try to check if list is terminated or continued.
+ //
+ if (state.tShift[nextLine] < state.blkIndent) { break; }
+ if (state.bqMarks[nextLine] < state.bqLevel) { break; }
- emailMatch = tail.match(EMAIL_RE);
+ // fail if terminating block found
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
+ }
+ if (terminate) { break; }
- if (emailMatch) {
- state.tokens.push({
- type: 'link_open',
- href: 'mailto:' + emailMatch[0].slice(1, -1)
- });
- state.tokens.push({
- type: 'text',
- content: escapeHtml(emailMatch[0].slice(1, -1))
- });
- state.tokens.push({ type: 'link_close' });
+ // fail if list has another type
+ if (isOrdered) {
+ posAfterMarker = skipOrderedListMarker(state, nextLine);
+ if (posAfterMarker < 0) { break; }
+ } else {
+ posAfterMarker = skipBulletListMarker(state, nextLine);
+ if (posAfterMarker < 0) { break; }
+ }
- state.pos += emailMatch[0].length;
- return true;
+ if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
}
- return false;
-};
+ // Finilize list
+ if (isOrdered) {
+ state.tokens.push({ type: 'ordered_list_close', level: --state.level });
+ } else {
+ state.tokens.push({ type: 'bullet_list_close', level: --state.level });
+ }
-},{"../common/url_schemas":4,"../helpers":6}],21:[function(require,module,exports){
-// Parse backticks
+ state.line = nextLine;
+ return true;
+};
-var END_RE = /`+/g;
+},{"../helpers":6}],22:[function(require,module,exports){
+// Paragraph
-module.exports = function backticks(state) {
- var start, code, max, marker, match,
- pos = state.pos,
- ch = state.src.charCodeAt(pos);
+'use strict';
- if (ch !== 0x60/* ` */) { return false; }
- start = pos;
- pos++;
- max = state.posMax;
+var isEmpty = require('../helpers').isEmpty;
+var getLines = require('../helpers').getLines;
+var parseRef = require('../parser_ref');
- while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }
- marker = state.src.slice(start, pos);
+module.exports = function paragraph(state, startLine/*, endLine*/) {
+ var endLine, content, pos, terminate, i, l,
+ nextLine = startLine + 1,
+ terminatorRules = state.parser._rulesParagraphTerm;
- END_RE = /`+/g;
- END_RE.lastIndex = pos;
+ endLine = state.lineMax;
- while ((match = END_RE.exec(state.src)) !== null) {
- if (match[0].length === marker.length) {
- code = state.src.slice(pos, END_RE.lastIndex - marker.length);
- state.push({
- type: 'code',
- content: code
- .replace(/[ \n]+/g,' ')
- .trim(),
- block: false
- });
+ // jump line-by-line until empty one or EOF
+ for (; nextLine < endLine && !isEmpty(state, nextLine); nextLine++) {
+ // this would be a code block normally, but after paragraph
+ // it's considered a lazy continuation regardless of what's there
+ if (state.tShift[nextLine] - state.blkIndent > 3) { continue; }
- state.pos += marker.length * 2 + code.length;
- return true;
+ // Some tags can terminate paragraph without empty line.
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
}
+ if (terminate) { break; }
}
- state.pending += marker;
- state.pos += marker.length;
+ content = getLines(state, startLine, nextLine, state.blkIndent, false).trim();
+
+ while (content.length) {
+ pos = parseRef(content, state.parser.inline, state.options, state.env);
+ if (pos < 0) { break; }
+ content = content.slice(pos).trim();
+ }
+
+ if (content.length) {
+ state.tokens.push({ type: 'paragraph_open', level: state.level });
+ state.tokens.push({
+ type: 'inline',
+ content: content,
+ level: state.level + 1
+ });
+ state.tokens.push({ type: 'paragraph_close', level: state.level });
+ }
+
+ state.line = nextLine;
return true;
};
-},{}],22:[function(require,module,exports){
-// Process *this* and _that_
+},{"../helpers":6,"../parser_ref":11}],23:[function(require,module,exports){
+// Parser state class
'use strict';
-function isAlphaNum(code) {
- return (code >= 0x30 /* 0 */ && code <= 0x39 /* 9 */) ||
- (code >= 0x41 /* A */ && code <= 0x5A /* Z */) ||
- (code >= 0x61 /* a */ && code <= 0x7A /* z */);
-}
+function State(src, parser, tokens, options, env) {
+ var ch, s, start, pos, len, indent, indent_found;
-// returns the amount of markers (1, 2, 3, 4+), or -1 on failure;
-// "start" should point at a valid marker
-//
-// note: in case if 4+ markers it is still not a valid emphasis,
-// should be treated as a special case
-function parseStart(state, start) {
- var pos = start, lastChar, count,
- max = Math.min(state.posMax, pos + 4),
- marker = state.src.charCodeAt(start);
+ // TODO: check if we can move string replaces to parser, to avoid
+ // unnesessary call on shadow clone creation. Or check if we can do
+ // cloning more effectively. Profile first.
- lastChar = state.pending.length !== 0 ? state.pending.charCodeAt(state.pending.length - 1) : -1;
+ // Prepare string to parse:
+ //
+ // - replace tabs with spaces
+ // - remove `\r` to simplify newlines check (???)
- if (lastChar === marker) { return -1; }
+ this.src = src;
- while (pos < max && state.src.charCodeAt(pos) === marker) { pos++; }
- if (pos >= max) { return -1; }
- count = pos - start;
+ // Shortcuts to simplify nested calls
+ this.parser = parser;
- // Quoting spec:
- //
- // Character can open emphasis iff
- // 1. it is not part of a sequence of four or more unescaped markers,
- // 2. it is not followed by whitespace,
- // 3. it is "_" and it is not preceded by an ASCII alphanumeric character, and
- // 4. either it is not followed by a marker or it is followed immediately by strong emphasis.
+ // TODO: (?) set directly for faster access.
+ this.options = options;
- if (count >= 4) {
- // check condition 1
- // sequence of four or more unescaped markers can't start an emphasis
- return count;
- }
+ this.env = env;
- // check condition 2, marker followed by whitespace
- if (state.src.charCodeAt(pos) === 0x20) { return -1; }
+ //
+ // Internal state vartiables
+ //
- if (marker === 0x5F /* _ */) {
- // check condition 3, if it's the beginning of the word
- // we need to look back for this
- if (isAlphaNum(lastChar)) { return -1; }
- }
+ this.tokens = tokens;
- return count;
-}
+ this.bMarks = []; // line begin offsets for fast jumps
+ this.eMarks = []; // line end offsets for fast jumps
+ this.tShift = []; // indent for each line
-// returns the amount of markers (1, 2, 3, 4+), or -1 on failure;
-// "start" should point at a valid marker
-//
-// note: in case if 4+ markers it is still not a valid emphasis,
-// should be treated as a special case
-function parseEnd(state, start) {
- var pos = start, lastChar, count,
- max = Math.min(state.posMax, pos + 4),
- marker = state.src.charCodeAt(start);
+ // Generate markers.
+ s = this.src;
+ indent = 0;
+ indent_found = false;
- lastChar = state.pending.length !== 0 ? state.pending.charCodeAt(state.pending.length - 1) : -1;
+ for (start = pos = indent = 0, len = s.length; pos < len; pos++) {
+ ch = s.charCodeAt(pos);
- while (pos < max && state.src.charCodeAt(pos) === marker) { pos++; }
- count = pos - start;
+ // TODO: check other spaces and tabs too or keep existing regexp replace ??
+ if (!indent_found && ch === 0x20/* space */) {
+ indent++;
+ }
+ if (!indent_found && ch !== 0x20/* space */) {
+ this.tShift.push(indent);
+ indent_found = true;
+ }
- // Quoting spec:
- //
- // Character can close emphasis iff
- // 1. it is not part of a sequence of four or more unescaped markers,
- // 2. it is not preceded by whitespace,
- // 3. it is not "_" or it is not followed by an ASCII alphanumeric character
- if (count >= 4) {
- // check condition 1
- // sequence of four or more unescaped markers can't start an emphasis
- return count;
+ if (ch === 0x0D || ch === 0x0A) {
+ this.bMarks.push(start);
+ this.eMarks.push(pos);
+ indent_found = false;
+ indent = 0;
+ start = pos + 1;
+ }
+ if (ch === 0x0D && pos < len && s.charCodeAt(pos) === 0x0A) {
+ pos++;
+ start++;
+ }
}
-
- // check condition 2, marker preceded by whitespace
- if (lastChar === 0x20) { return -1; }
-
- if (marker === 0x5F) {
- // check condition 3, if it's the end of the word
- if (pos < max && isAlphaNum(state.src.charCodeAt(pos))) { return -1; }
+ if (ch !== 0x0D || ch !== 0x0A) {
+ this.bMarks.push(start);
+ this.eMarks.push(len);
+ this.tShift.push(indent);
}
- return count;
-}
+ // Push fake entry to simplify cache bounds checks
+ this.bMarks.push(s.length);
+ this.eMarks.push(s.length);
+ this.tShift.push(0);
-module.exports = function emphasis(state/*, silent*/) {
- var startCount,
- count,
- oldLength,
- oldPending,
- found,
- ok,
- i,
- oldCount,
- newCount,
- len,
- rules,
- stack,
- breakOutOfOuterLoop,
- max = state.posMax,
- start = state.pos,
- haveLiteralAsterisk,
- marker = state.src.charCodeAt(start);
+ // inline parser variables
+ this.pos = 0; // char index in src
- if (marker !== 0x5F/* _ */ && marker !== 0x2A /* * */) { return false; }
+ // block parser variables
+ this.blkLevel = 0;
+ this.blkIndent = 0;
+ this.line = 0; // line index in src
+ this.lineMax = this.bMarks.length - 1; // don't count last fake line
+ this.tight = false; // loose/tight mode for lists
+ this.listMode = false; // if true, block parser stops on two newlines
- startCount = parseStart(state, start);
- if (startCount < 0) { return false; }
- if (startCount >= 4) {
- state.pos += startCount;
- state.pending += state.src.slice(start, startCount);
- return true;
+ // Stuff for blockquotes
+ this.bqLevel = 0;
+ this.bqMarks = [];
+ for (start = 0; start < this.bMarks.length; start++) {
+ this.bqMarks.push(0);
}
- oldLength = state.tokens.length;
- oldPending = state.pending;
-
- state.pos = start + startCount;
- stack = [ startCount ];
- rules = state.lexer.rules;
- len = rules.length;
+ this.level = 0;
- while (state.pos < max) {
- if (state.src.charCodeAt(state.pos) === marker && !haveLiteralAsterisk) {
- count = parseEnd(state, state.pos);
- if (count >= 1 && count < 4) {
- oldCount = stack.pop();
- newCount = count;
-
- while (oldCount !== newCount) {
- if (oldCount === 3) {
- // e.g. `***foo*`
- stack.push(3 - newCount);
- break;
- }
-
- if (newCount < oldCount) {
- // assert(oldCount == 2 && newCount == 1)
- // i.e. `**foo* bar*`
- // not valid for now, but might be in the future
-
- // eslint is misconfigured, so it doesn't accept "break MAIN;"
- // here is a crappy workaround
- breakOutOfOuterLoop = true;
- break;
- }
-
- // assert(newCount > oldCount)
- newCount -= oldCount;
-
- if (stack.length === 0) { break; }
- state.pos += oldCount;
- oldCount = stack.pop();
- }
-
- if (breakOutOfOuterLoop) { break; }
-
- if (stack.length === 0) {
- startCount = oldCount;
- found = true;
- break;
- }
- state.pos += count;
- continue;
- }
-
- count = parseStart(state, state.pos);
- if (count >= 1) {
- stack.push(count);
- state.pos += count;
- continue;
- }
- }
-
- for (i = 0; i < len; i++) {
- if (rules[i] !== emphasis) { ok = rules[i](state); }
- if (ok) { break; }
- }
-
- if (ok) {
- haveLiteralAsterisk = false;
- } else {
- haveLiteralAsterisk = state.src.charCodeAt(state.pos) === marker;
- state.pending += state.src[state.pos];
- state.pos++;
- }
- }
-
- // restore old state
- state.tokens.length = oldLength;
- state.pending = oldPending;
+ // renderer
+ this.result = '';
+}
- if (!found) {
- // parser failed to find ending tag, so it's not valid emphasis
- state.pos = start;
- return false;
- }
- // found!
- state.posMax = state.pos;
- state.pos = start + startCount;
- if (state.pending) { state.pushPending(); }
- if (startCount === 2 || startCount === 3) { state.push({ type: 'strong_open' }); }
- if (startCount === 1 || startCount === 3) { state.push({ type: 'em_open' }); }
- state.lexer.tokenize(state);
- if (startCount === 1 || startCount === 3) { state.push({ type: 'em_close' }); }
- if (startCount === 2 || startCount === 3) { state.push({ type: 'strong_close' }); }
- state.pos = state.posMax + startCount;
- state.posMax = max;
- return true;
+// Create shadow clone of curent state with new input data
+State.prototype.clone = function clone(src) {
+ return new State(
+ src,
+ this.parser,
+ this.tokens,
+ this.options
+ );
};
-},{}],23:[function(require,module,exports){
-// Proceess html entity - {, ¯, ", ...
+module.exports = State;
+
+},{}],24:[function(require,module,exports){
+// GFM table, non-standard
'use strict';
-var entities = require('../common/entities');
-var escapeHtml = require('../helpers').escapeHtml;
-var isValidEntityCode = require('../helpers').isValidEntityCode;
-var fromCodePoint = require('../helpers').fromCodePoint;
+function lineMatch(state, line, reg) {
+ var pos = state.bMarks[line],
+ max = state.eMarks[line];
-var DIGITAL_RE = /^((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;
-var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
+ return state.src.substr(pos, max - pos).match(reg);
+}
-module.exports = function entity(state) {
- var ch, code, match, pos = state.pos, max = state.posMax;
+module.exports = function table(state, startLine, endLine, silent) {
+ var ch, firstLineMatch, secondLineMatch, i, nextLine, m, rows,
+ aligns, t;
- if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }
+ // should have at least three lines
+ if (startLine + 2 > endLine) { return false; }
- if (pos + 1 < max) {
- ch = state.src.charCodeAt(pos + 1);
+ // first character of the second line should be '|' or '-'
+ ch = state.src.charCodeAt(state.bMarks[startLine + 1]
+ + state.tShift[startLine + 1]);
+ if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */) { return false; }
- if (ch === 0x23 /* # */) {
- match = state.src.slice(pos).match(DIGITAL_RE);
- if (match) {
- code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
- state.pending += isValidEntityCode(code) ? escapeHtml(fromCodePoint(code)) : fromCodePoint(0xFFFD);
- state.pos += match[0].length;
- return true;
- }
+ secondLineMatch = lineMatch(state, startLine + 1,
+ /^ *\|?(( *[:-]-+[:-] *\|)+( *[:-]-+[:-] *))\|? *$/);
+ if (!secondLineMatch) { return false; }
+
+ rows = secondLineMatch[1].split('|');
+ aligns = [];
+ for (i = 0; i < rows.length; i++) {
+ t = rows[i].trim();
+ if (t[t.length - 1] === ':') {
+ aligns[i] = t[0] === ':' ? 'center' : 'right';
+ } else if (t[0] === ':') {
+ aligns[i] = 'left';
} else {
- match = state.src.slice(pos).match(NAMED_RE);
- if (match) {
- if (entities.hasOwnProperty(match[1])) {
- state.pending += escapeHtml(entities[match[1]]);
- state.pos += match[0].length;
- return true;
- }
- }
+ aligns[i] = '';
}
}
- state.pending += '&';
- state.pos++;
- return true;
-};
-
-},{"../common/entities":1,"../helpers":6}],24:[function(require,module,exports){
-// Proceess escaped chars and hardbreaks
-
-var ESCAPED = '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
- .split('')
- .map(function(ch) { return ch.charCodeAt(0); });
-
-module.exports = function escape(state) {
- var ch, pos = state.pos, max = state.posMax;
+ firstLineMatch = lineMatch(state, startLine, /^ *\|?(.*?\|.*?)\|? *$/);
+ if (!firstLineMatch) { return false; }
- if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }
+ rows = firstLineMatch[1].split('|');
+ if (aligns.length !== rows.length) { return false; }
+ if (silent) { return true; }
- pos++;
+ state.tokens.push({ type: 'table_open', level: state.level++ });
- if (pos < max) {
- ch = state.src.charCodeAt(pos);
+ state.tokens.push({ type: 'tr_open', level: state.level++ });
+ for (i = 0; i < rows.length; i++) {
+ state.tokens.push({ type: 'th_open', align: aligns[i], level: state.level++ });
+ state.tokens.push({
+ type: 'inline',
+ content: rows[i].trim(),
+ level: state.level
+ });
+ state.tokens.push({ type: 'th_close', level: --state.level });
+ }
+ state.tokens.push({ type: 'tr_close', level: --state.level });
- if (ESCAPED.indexOf(ch) >= 0) {
- // escape html chars if needed
- if (ch === 0x26/* & */) {
- state.pending += '&';
- } else if (ch === 0x3C/* < */) {
- state.pending += '<';
- } else if (ch === 0x3E/* > */) {
- state.pending += '>';
- } else if (ch === 0x22/* " */) {
- state.pending += '"';
- } else {
- state.pending += state.src[pos];
- }
- state.pos += 2;
- return true;
- }
+ for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
+ m = lineMatch(state, nextLine, /^ *\|?(.*?\|.*?)\|? *$/);
+ if (!m) { break; }
+ rows = m[1].split('|');
- if (ch === 0x0A) {
- state.push({
- type: 'hardbreak'
+ state.tokens.push({ type: 'tr_open', level: state.level++ });
+ for (i = 0; i < rows.length; i++) {
+ state.tokens.push({ type: 'td_open', align: aligns[i], level: state.level++ });
+ state.tokens.push({
+ type: 'inline',
+ content: rows[i].replace(/^\|? *| *\|?$/g, '')
});
-
- pos++;
- // skip leading whitespaces from next line
- while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }
-
- state.pos = pos;
- return true;
+ state.tokens.push({ type: 'td_close', level: --state.level });
}
+ state.tokens.push({ type: 'tr_close', level: --state.level });
}
+ state.tokens.push({ type: 'table_close', level: --state.level });
- state.pending += '\\';
- state.pos++;
+ state.line = nextLine;
return true;
};
},{}],25:[function(require,module,exports){
-// Process < > " (& was processed in markdown escape)
+// Process autolinks ''
-module.exports = function escape_html_char(state) {
- var ch = state.src.charCodeAt(state.pos);
- if (ch === 0x3C/* < */) {
- state.pending += '<';
- } else if (ch === 0x3E/* > */) {
- state.pending += '>';
- } else if (ch === 0x22/* " */) {
- state.pending += '"';
- } else {
- return false;
- }
+var escapeHtml = require('../helpers').escapeHtml;
+var url_schemas = require('../common/url_schemas');
- state.pos++;
- return true;
-};
-},{}],26:[function(require,module,exports){
-// Process html tags
+/*eslint max-len:0*/
+var EMAIL_RE = /^<([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])?)*)>/;
+var AUTOLINK_RE = /^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;
-'use strict';
+module.exports = function autolink(state) {
+ var tail, linkMatch, emailMatch, pos = state.pos;
-var HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;
+ if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
+ tail = state.src.slice(pos);
-function isLetter(ch) {
- /*eslint no-bitwise:0*/
- var lc = ch | 0x20; // to lower case
- return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
-}
+ if (tail.indexOf('>') < 0) { return false; }
+ linkMatch = tail.match(AUTOLINK_RE);
-module.exports = function htmltag(state) {
- var ch, match, max, pos = state.pos;
+ if (linkMatch) {
+ if (url_schemas.indexOf(linkMatch[1].toLowerCase()) < 0) { return false; }
- if (!state.options.html) { return false; }
+ state.push({
+ type: 'link_open',
+ href: linkMatch[0].slice(1, -1),
+ level: state.level
+ });
+ state.push({
+ type: 'text',
+ content: escapeHtml(linkMatch[0].slice(1, -1)),
+ level: state.level + 1
+ });
+ state.push({ type: 'link_close', level: state.level });
- // Check start
- max = state.posMax;
- if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
- pos + 2 >= max) {
- return false;
+ state.pos += linkMatch[0].length;
+ return true;
}
- // Quick fail on second char
- ch = state.src.charCodeAt(pos + 1);
- if (ch !== 0x21/* ! */ &&
- ch !== 0x3F/* ? */ &&
- ch !== 0x2F/* / */ &&
- !isLetter(ch)) {
- return false;
- }
+ emailMatch = tail.match(EMAIL_RE);
- match = state.src.slice(pos).match(HTML_TAG_RE);
- if (!match) { return false; }
+ if (emailMatch) {
+ state.push({
+ type: 'link_open',
+ href: 'mailto:' + emailMatch[0].slice(1, -1),
+ level: state.level
+ });
+ state.push({
+ type: 'text',
+ content: escapeHtml(emailMatch[0].slice(1, -1)),
+ level: state.level + 1
+ });
+ state.push({ type: 'link_close', level: state.level });
- state.push({
- type: 'htmltag',
- content: state.src.slice(pos, pos + match[0].length)
- });
-//console.log(state.tokens)
- state.pos += match[0].length;
- return true;
+ state.pos += emailMatch[0].length;
+ return true;
+ }
+
+ return false;
};
-},{"../common/html_re":3}],27:[function(require,module,exports){
-// Process [links]( "stuff")
+},{"../common/url_schemas":4,"../helpers":6}],26:[function(require,module,exports){
+// Parse backticks
-'use strict';
+var END_RE = /`+/g;
+module.exports = function backticks(state) {
+ var start, code, max, marker, match,
+ pos = state.pos,
+ ch = state.src.charCodeAt(pos);
-//
-// Parse link label
-//
-// this function assumes that first character ("[") already matches;
-// returns the end of the label
-function parseLinkLabel(state, start) {
- var level, rules, len, found, marker, i, ok,
- labelEnd = -1,
- max = state.posMax,
- oldPos = state.pos,
- oldLength = state.tokens.length,
- oldPending = state.pending;
+ if (ch !== 0x60/* ` */) { return false; }
- state.pos = start + 1;
- level = 1;
- rules = state.lexer.rules;
- len = rules.length;
+ start = pos;
+ pos++;
+ max = state.posMax;
- while (state.pos < max) {
- marker = state.src.charCodeAt(state.pos);
- if (marker === 0x5B /* [ */) {
- level++;
- } else if (marker === 0x5D /* ] */) {
- level--;
- if (level === 0) {
- found = true;
- break;
- }
- }
+ while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }
- for (i = 0; i < len; i++) {
- // skip emphasis because it has lower priority, compare:
- // [foo *bar]()*
- // [foo `bar]()`
- if (rules[i].name !== 'emphasis' && rules[i].name !== 'links') {
- ok = rules[i](state);
- }
- if (ok) { break; }
- }
+ marker = state.src.slice(start, pos);
- if (!ok) { state.pending += state.src[state.pos++]; }
- }
+ END_RE = /`+/g;
+ END_RE.lastIndex = pos;
- if (found) { labelEnd = state.pos; }
+ while ((match = END_RE.exec(state.src)) !== null) {
+ if (match[0].length === marker.length) {
+ code = state.src.slice(pos, END_RE.lastIndex - marker.length);
+ state.push({
+ type: 'code',
+ content: code
+ .replace(/[ \n]+/g,' ')
+ .trim(),
+ block: false,
+ level: state.level
+ });
- // restore old state
- state.pos = oldPos;
- state.tokens.length = oldLength;
- state.pending = oldPending;
+ state.pos += marker.length * 2 + code.length;
+ return true;
+ }
+ }
- return labelEnd;
-}
+ state.pending += marker;
+ state.pos += marker.length;
+ return true;
+};
-//
-// Parse link destination
-//
-// on success it returns a string and updates state.pos;
-// on failure it returns null
-function parseLinkDestination(state, pos) {
- var code, level,
- max = state.posMax,
- href = '';
+},{}],27:[function(require,module,exports){
+// Process *this* and _that_
- if (state.src.charCodeAt(pos) === 0x3C /* < */) {
- pos++;
- while (pos < max) {
- code = state.src.charCodeAt(pos);
- if (code === 0x0A /* \n */) { return null; }
- if (code === 0x3E /* > */) {
- state.pos = pos + 1;
- return href;
- }
- if (code === 0x5C /* \ */ && pos + 1 < max) {
- pos++;
- href += state.src[pos++];
- continue;
- }
+'use strict';
- href += state.src[pos++];
- }
- // no closing '>'
- return null;
- }
+function isAlphaNum(code) {
+ return (code >= 0x30 /* 0 */ && code <= 0x39 /* 9 */) ||
+ (code >= 0x41 /* A */ && code <= 0x5A /* Z */) ||
+ (code >= 0x61 /* a */ && code <= 0x7A /* z */);
+}
- // this should be ... } else { ... branch
+// returns the amount of markers (1, 2, 3, 4+), or -1 on failure;
+// "start" should point at a valid marker
+//
+// note: in case if 4+ markers it is still not a valid emphasis,
+// should be treated as a special case
+function parseStart(state, start) {
+ var pos = start, lastChar, count,
+ max = Math.min(state.posMax, pos + 4),
+ marker = state.src.charCodeAt(start);
- level = 0;
- while (pos < max) {
- code = state.src.charCodeAt(pos);
+ lastChar = state.pending.length !== 0 ? state.pending.charCodeAt(state.pending.length - 1) : -1;
- if (code === 0x20) { break; }
+ if (lastChar === marker) { return -1; }
- // ascii control characters
- if (code < 0x20 || code === 0x7F) { break; }
+ while (pos < max && state.src.charCodeAt(pos) === marker) { pos++; }
+ if (pos >= max) { return -1; }
+ count = pos - start;
- if (code === 0x5C /* \ */ && pos + 1 < max) {
- pos++;
- href += state.src[pos++];
- continue;
- }
+ // Quoting spec:
+ //
+ // Character can open emphasis iff
+ // 1. it is not part of a sequence of four or more unescaped markers,
+ // 2. it is not followed by whitespace,
+ // 3. it is "_" and it is not preceded by an ASCII alphanumeric character, and
+ // 4. either it is not followed by a marker or it is followed immediately by strong emphasis.
- if (code === 0x28 /* ( */) {
- level++;
- if (level > 1) { break; }
- }
+ if (count >= 4) {
+ // check condition 1
+ // sequence of four or more unescaped markers can't start an emphasis
+ return count;
+ }
- if (code === 0x29 /* ) */) {
- level--;
- if (level < 0) { break; }
- }
+ // check condition 2, marker followed by whitespace
+ if (state.src.charCodeAt(pos) === 0x20) { return -1; }
- href += state.src[pos++];
+ if (marker === 0x5F /* _ */) {
+ // check condition 3, if it's the beginning of the word
+ // we need to look back for this
+ if (isAlphaNum(lastChar)) { return -1; }
}
- if (!href.length) { return null; }
-
- state.pos = pos;
- return href;
+ return count;
}
+// returns the amount of markers (1, 2, 3, 4+), or -1 on failure;
+// "start" should point at a valid marker
//
-// Parse link title
-//
-// on success it returns a string and updates state.pos;
-// on failure it returns null
-function parseLinkTitle(state, pos) {
- var title, code,
- max = state.posMax,
- marker = state.src.charCodeAt(pos);
-
- if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return null; }
+// note: in case if 4+ markers it is still not a valid emphasis,
+// should be treated as a special case
+function parseEnd(state, start) {
+ var pos = start, lastChar, count,
+ max = Math.min(state.posMax, pos + 4),
+ marker = state.src.charCodeAt(start);
- pos++;
- title = '';
+ lastChar = state.pending.length !== 0 ? state.pending.charCodeAt(state.pending.length - 1) : -1;
- // if opening marker is "(", switch it to closing marker ")"
- if (marker === 0x28) { marker = 0x29; }
+ while (pos < max && state.src.charCodeAt(pos) === marker) { pos++; }
+ count = pos - start;
- while (pos < max) {
- code = state.src.charCodeAt(pos);
- if (code === marker) {
- state.pos = pos + 1;
- return title;
- }
- if (code === 0x5C /* \ */ && pos + 1 < max) {
- pos++;
- title += state.src[pos++];
- continue;
- }
+ // Quoting spec:
+ //
+ // Character can close emphasis iff
+ // 1. it is not part of a sequence of four or more unescaped markers,
+ // 2. it is not preceded by whitespace,
+ // 3. it is not "_" or it is not followed by an ASCII alphanumeric character
- title += state.src[pos++];
+ if (count >= 4) {
+ // check condition 1
+ // sequence of four or more unescaped markers can't start an emphasis
+ return count;
}
- return null;
-}
+ // check condition 2, marker preceded by whitespace
+ if (lastChar === 0x20) { return -1; }
-function normalizeReference(str) {
- return str.trim().replace(/\s+/g, ' ').toLowerCase();
+ if (marker === 0x5F) {
+ // check condition 3, if it's the end of the word
+ if (pos < max && isAlphaNum(state.src.charCodeAt(pos))) { return -1; }
+ }
+
+ return count;
}
-function links(state) {
- var labelStart,
- labelEnd,
- label,
- href,
- title,
- pos,
- ref,
- code,
- isImage = false,
+module.exports = function emphasis(state/*, silent*/) {
+ var startCount,
+ count,
+ oldLength,
+ oldPending,
+ oldFlag,
+ found,
+ ok,
+ oldCount,
+ newCount,
+ stack,
+ breakOutOfOuterLoop,
max = state.posMax,
start = state.pos,
+ haveLiteralAsterisk,
marker = state.src.charCodeAt(start);
- if (marker === 0x21/* ! */) {
- isImage = true;
- marker = state.src.charCodeAt(++start);
+ if (marker !== 0x5F/* _ */ && marker !== 0x2A /* * */) { return false; }
+
+ // skip emphasis in links because it has lower priority, compare:
+ // [foo *bar]()*
+ // [foo `bar]()`
+ if (state.validateInsideEm || state.validateInsideLink) { return false; }
+
+ startCount = parseStart(state, start);
+ if (startCount < 0) { return false; }
+ if (startCount >= 4) {
+ state.pos += startCount;
+ state.pending += state.src.slice(start, startCount);
+ return true;
}
- if (marker !== 0x5B/* [ */) { return false; }
+ if (state.level >= state.options.maxLevel) { return false; }
- labelStart = start + 1;
- labelEnd = parseLinkLabel(state, start);
+ oldLength = state.tokens.length;
+ oldPending = state.pending;
+ oldFlag = state.validateInsideEm;
- // parser failed to find ']', so it's not a valid link
- if (pos < 0) { return false; }
+ state.pos = start + startCount;
+ stack = [ startCount ];
+ state.validateInsideEm = true;
- pos = labelEnd + 1;
- if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
- //
- // Inline link
- //
+ while (state.pos < max) {
+ if (state.src.charCodeAt(state.pos) === marker && !haveLiteralAsterisk) {
+ count = parseEnd(state, state.pos);
+ if (count >= 1 && count < 4) {
+ oldCount = stack.pop();
+ newCount = count;
- // [link]( "title" )
- // ^^ skipping these spaces
- pos++;
- for (; pos < max; pos++) {
- code = state.src.charCodeAt(pos);
- if (code !== 0x20 && code !== 0x0A) { break; }
- }
- if (pos >= max) { return false; }
+ while (oldCount !== newCount) {
+ if (oldCount === 3) {
+ // e.g. `***foo*`
+ stack.push(3 - newCount);
+ break;
+ }
- // [link]( "title" )
- // ^^^^^^ parsing link destination
- start = pos;
- href = parseLinkDestination(state, pos);
- if (href !== null) {
- pos = state.pos;
- } else {
- href = '';
- }
+ if (newCount < oldCount) {
+ // assert(oldCount == 2 && newCount == 1)
+ // i.e. `**foo* bar*`
+ // not valid for now, but might be in the future
- // [link]( "title" )
- // ^^ skipping these spaces
- start = pos;
- for (; pos < max; pos++) {
- code = state.src.charCodeAt(pos);
- if (code !== 0x20 && code !== 0x0A) { break; }
- }
+ // eslint is misconfigured, so it doesn't accept "break MAIN;"
+ // here is a crappy workaround
+ breakOutOfOuterLoop = true;
+ break;
+ }
- // [link]( "title" )
- // ^^^^^^^ parsing link title
- if (pos < max && start !== pos && (title = parseLinkTitle(state, pos)) !== null) {
- pos = state.pos;
+ // assert(newCount > oldCount)
+ newCount -= oldCount;
- // [link]( "title" )
- // ^^ skipping these spaces
- for (; pos < max; pos++) {
- code = state.src.charCodeAt(pos);
- if (code !== 0x20 && code !== 0x0A) { break; }
- }
- } else {
- title = '';
- }
+ if (stack.length === 0) { break; }
+ state.pos += oldCount;
+ oldCount = stack.pop();
+ }
- if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
- state.pos = labelStart - 1;
- return false;
- }
- pos++;
- } else {
- //
- // Link reference
- //
+ if (breakOutOfOuterLoop) { break; }
- // [foo] [bar]
- // ^^ optional whitespace (can include newlines)
- for (; pos < max; pos++) {
- code = state.src.charCodeAt(pos);
- if (code !== 0x20 && code !== 0x0A) { break; }
- }
+ if (stack.length === 0) {
+ startCount = oldCount;
+ found = true;
+ break;
+ }
+ state.pos += count;
+ continue;
+ }
- if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
- start = pos + 1;
- pos = parseLinkLabel(state, pos);
- if (pos >= 0) {
- label = state.src.slice(start, pos++);
- } else {
- pos = start - 1;
+ count = parseStart(state, state.pos);
+ if (count >= 1) {
+ stack.push(count);
+ state.pos += count;
+ continue;
}
}
- // covers label === '' and label === undefined
- // (collapsed reference link and shortcut reference link respectively)
- if (!label) { label = state.src.slice(labelStart, labelEnd); }
+ ok = state.parser.tokenizeSingle(state);
- ref = state.env.references[normalizeReference(label)];
- if (!ref) {
- state.pos = labelStart - 1;
- return false;
+ if (ok) {
+ haveLiteralAsterisk = false;
+ } else {
+ haveLiteralAsterisk = state.src.charCodeAt(state.pos) === marker;
+ state.pending += state.src[state.pos];
+ state.pos++;
}
- href = ref.href;
- title = ref.title;
}
- //
- // We found the end of the link, and know for a fact it's a valid link;
- // so all that's left to do is to call tokenizer.
- //
- state.pos = labelStart;
- state.posMax = labelEnd;
- if (state.pending) { state.pushPending(); }
+ // restore old state
+ state.tokens.length = oldLength;
+ state.pending = oldPending;
+ state.validateInsideEm = oldFlag;
- if (isImage) {
- state.push({ type: 'image',
- src: href,
- title: title,
- alt: state.src.substr(labelStart, labelEnd - labelStart) });
- } else {
- state.push({ type: 'link_open', href: href, title: title });
- state.lexer.tokenize(state);
- state.push({ type: 'link_close' });
+ if (!found) {
+ // parser failed to find ending tag, so it's not valid emphasis
+ state.pos = start;
+ return false;
}
- state.pos = pos;
- state.posMax = max;
- return true;
-}
-
-module.exports = links;
-module.exports.parseLinkLabel = parseLinkLabel;
-module.exports.parseLinkDestination = parseLinkDestination;
-module.exports.parseLinkTitle = parseLinkTitle;
-module.exports.normalizeReference = normalizeReference;
-
-},{}],28:[function(require,module,exports){
-// Proceess '\n'
-
-module.exports = function escape(state) {
- var pmax, max, pos = state.pos;
-
- if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
-
- pmax = state.pending.length - 1;
- max = state.posMax;
-
- // ' \n' -> hardbreak
- // Lookup in pending chars is bad practice! Don't copy to other rules!
- // Pending string is stored in concat mode, indexed lookups will cause
- // convertion to flat mode.
- if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
- if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
- state.pending = state.pending.replace(/ +$/, '');
- state.push({
- type: 'hardbreak'
- });
- } else {
- state.pending = state.pending.slice(0, -1);
- state.push({
- type: 'softbreak'
- });
- }
+ // found!
+ state.posMax = state.pos;
+ state.pos = start + startCount;
- } else {
- state.push({
- type: 'softbreak'
- });
+ if (startCount === 2 || startCount === 3) {
+ state.push({ type: 'strong_open', level: state.level++ });
+ }
+ if (startCount === 1 || startCount === 3) {
+ state.push({ type: 'em_open', level: state.level++ });
}
- pos++;
+ state.parser.tokenize(state);
- // skip heading spaces for next line
- while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }
+ if (startCount === 1 || startCount === 3) {
+ state.push({ type: 'em_close', level: --state.level });
+ }
+ if (startCount === 2 || startCount === 3) {
+ state.push({ type: 'strong_close', level: --state.level });
+ }
- state.pos = pos;
+ state.pos = state.posMax + startCount;
+ state.posMax = max;
return true;
};
-},{}],29:[function(require,module,exports){
-// Inline parser state
+},{}],28:[function(require,module,exports){
+// Proceess html entity - {, ¯, ", ...
'use strict';
-
-function StateInline(src, lexer, options, env) {
- this.src = src;
- this.env = env;
- this.options = options;
- this.lexer = lexer;
- this.tokens = [];
- this.pos = 0;
- this.pending = '';
- this.posMax = this.src.length;
-}
+var entities = require('../common/entities');
+var escapeHtml = require('../helpers').escapeHtml;
+var isValidEntityCode = require('../helpers').isValidEntityCode;
+var fromCodePoint = require('../helpers').fromCodePoint;
-StateInline.prototype.pushPending = function () {
- var pending = this.pending;
+var DIGITAL_RE = /^((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;
+var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
- this.tokens.push({
- type: 'text',
- content: pending
- });
- this.pending = '';
-};
-StateInline.prototype.push = function (token) {
- if (this.pending) {
- this.pushPending();
- }
+module.exports = function entity(state) {
+ var ch, code, match, pos = state.pos, max = state.posMax;
- this.tokens.push(token);
-};
+ if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }
-module.exports = StateInline;
+ if (pos + 1 < max) {
+ ch = state.src.charCodeAt(pos + 1);
-},{}],30:[function(require,module,exports){
-// Skip text characters for text token, place those to pendibg buffer
-// and increment current pos
-
-module.exports = function text(state) {
- var match = state.src.slice(state.pos).match(state.lexer.textMatch);
-
- if (!match) { return false; }
-
- state.pending += match[0];
- state.pos += match[0].length;
+ if (ch === 0x23 /* # */) {
+ match = state.src.slice(pos).match(DIGITAL_RE);
+ if (match) {
+ code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
+ state.pending += isValidEntityCode(code) ? escapeHtml(fromCodePoint(code)) : fromCodePoint(0xFFFD);
+ state.pos += match[0].length;
+ return true;
+ }
+ } else {
+ match = state.src.slice(pos).match(NAMED_RE);
+ if (match) {
+ if (entities.hasOwnProperty(match[1])) {
+ state.pending += escapeHtml(entities[match[1]]);
+ state.pos += match[0].length;
+ return true;
+ }
+ }
+ }
+ }
+ state.pending += '&';
+ state.pos++;
return true;
};
-},{}],31:[function(require,module,exports){
-// Main perser class
-
-'use strict';
+},{"../common/entities":1,"../helpers":6}],29:[function(require,module,exports){
+// Proceess escaped chars and hardbreaks
+var ESCAPED = '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
+ .split('')
+ .map(function(ch) { return ch.charCodeAt(0); });
-var assign = require('object-assign');
+module.exports = function escape(state) {
+ var ch, pos = state.pos, max = state.posMax;
+ if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }
-var Renderer = require('./renderer');
-var LexerBlock = require('./lexer_block');
-var LexerInline = require('./lexer_inline');
-var defaults = require('./defaults');
+ pos++;
-// Main class
-//
-function Parser(options) {
- this.options = assign({}, defaults);
- this.state = null;
+ if (pos < max) {
+ ch = state.src.charCodeAt(pos);
- this.inline = new LexerInline();
- this.block = new LexerBlock();
- this.renderer = new Renderer();
+ if (ESCAPED.indexOf(ch) >= 0) {
+ // escape html chars if needed
+ if (ch === 0x26/* & */) {
+ state.pending += '&';
+ } else if (ch === 0x3C/* < */) {
+ state.pending += '<';
+ } else if (ch === 0x3E/* > */) {
+ state.pending += '>';
+ } else if (ch === 0x22/* " */) {
+ state.pending += '"';
+ } else {
+ state.pending += state.src[pos];
+ }
+ state.pos += 2;
+ return true;
+ }
- // a bunch of cross-references between parsers
- // used for link reference definitions
- this.block.inline = this.inline;
+ if (ch === 0x0A) {
+ state.push({
+ type: 'hardbreak',
+ level: state.level
+ });
- if (options) { this.set(options); }
-}
+ pos++;
+ // skip leading whitespaces from next line
+ while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }
+ state.pos = pos;
+ return true;
+ }
+ }
-Parser.prototype.set = function (options) {
- assign(this.options, options);
+ state.pending += '\\';
+ state.pos++;
+ return true;
};
+},{}],30:[function(require,module,exports){
+// Process < > " (& was processed in markdown escape)
-Parser.prototype.render = function (src) {
- var tokens, tok, i, l, env = { references: Object.create(null) };
-
- // Parse blocks
- tokens = this.block.parse(src, this.options, env);
+module.exports = function escape_html_char(state) {
+ var ch = state.src.charCodeAt(state.pos);
- // Parse inlines
- for (i = 0, l = tokens.length; i < l; i++) {
- tok = tokens[i];
- if (tok.type === 'inline') {
- tok.children = this.inline.parse(tok.content, this.options, env);
- }
+ if (ch === 0x3C/* < */) {
+ state.pending += '<';
+ } else if (ch === 0x3E/* > */) {
+ state.pending += '>';
+ } else if (ch === 0x22/* " */) {
+ state.pending += '"';
+ } else {
+ return false;
}
- // Render
- return this.renderer.render(tokens, this.options, env);
+ state.pos++;
+ return true;
};
+},{}],31:[function(require,module,exports){
+// Process html tags
-module.exports = Parser;
-
-},{"./defaults":5,"./lexer_block":7,"./lexer_inline":19,"./renderer":32,"object-assign":33}],32:[function(require,module,exports){
'use strict';
-var assign = require('object-assign');
-var escapeHtml = require('./helpers').escapeHtml;
-var unescapeMd = require('./helpers').unescapeMd;
-var replaceEntities = require('./helpers').replaceEntities;
+var HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;
-function escapeUrl(str) {
- try {
- return encodeURI(str);
- } catch (__) {}
- return '';
-}
-function unescapeUrl(str) {
- try {
- return decodeURI(str);
- } catch (__) {}
- return '';
+function isLetter(ch) {
+ /*eslint no-bitwise:0*/
+ var lc = ch | 0x20; // to lower case
+ return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
}
-// check if we need to hide '\n' before next token
-function getBreak(tokens, idx) {
- if (++idx < tokens.length &&
- tokens[idx].type === 'list_item_close') {
- return '';
- }
+module.exports = function htmltag(state) {
+ var ch, match, max, pos = state.pos;
- return '\n';
-}
+ if (!state.options.html) { return false; }
-var rules = {};
+ // Check start
+ max = state.posMax;
+ if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
+ pos + 2 >= max) {
+ return false;
+ }
+ // Quick fail on second char
+ ch = state.src.charCodeAt(pos + 1);
+ if (ch !== 0x21/* ! */ &&
+ ch !== 0x3F/* ? */ &&
+ ch !== 0x2F/* / */ &&
+ !isLetter(ch)) {
+ return false;
+ }
-rules.blockquote_open = function (/*tokens, idx, options*/) {
- return '\n';
-};
-rules.blockquote_close = function (tokens, idx /*, options*/) {
- return '
' + getBreak(tokens, idx);
+ match = state.src.slice(pos).match(HTML_TAG_RE);
+ if (!match) { return false; }
+
+ state.push({
+ type: 'htmltag',
+ content: state.src.slice(pos, pos + match[0].length),
+ level: state.level
+ });
+//console.log(state.tokens)
+ state.pos += match[0].length;
+ return true;
};
+},{"../common/html_re":3}],32:[function(require,module,exports){
+// Process [links]( "stuff")
-rules.code = function (tokens, idx /*, options*/) {
- if (tokens[idx].block) {
- return '' + escapeHtml(tokens[idx].content) + '
' + getBreak(tokens, idx);
- }
+'use strict';
- return '' + escapeHtml(tokens[idx].content) + '
';
-};
+var parseLinkLabel = require('../links').parseLinkLabel;
+var parseLinkDestination = require('../links').parseLinkDestination;
+var parseLinkTitle = require('../links').parseLinkTitle;
+var normalizeReference = require('../links').normalizeReference;
-rules.fence = function (tokens, idx, options) {
- var token = tokens[idx];
- var langMark = '';
- var langPrefix = options.langprefix || '';
- var params;
+function links(state) {
+ var labelStart,
+ labelEnd,
+ label,
+ href,
+ title,
+ pos,
+ ref,
+ code,
+ isImage = false,
+ max = state.posMax,
+ start = state.pos,
+ marker = state.src.charCodeAt(start);
- if (token.params) {
- params = token.params.split(/ +/g);
- langMark = ' class="' + langPrefix + escapeHtml(replaceEntities(unescapeMd(params[0]))) + '"';
+ if (marker === 0x21/* ! */) {
+ isImage = true;
+ marker = state.src.charCodeAt(++start);
}
- return ''
- + escapeHtml(token.content)
- + '
' + getBreak(tokens, idx);
-};
-
+ if (marker !== 0x5B/* [ */) { return false; }
+ if (state.level >= state.options.maxLevel) { return false; }
-rules.heading_open = function (tokens, idx /*, options*/) {
- return '';
-};
-rules.heading_close = function (tokens, idx /*, options*/) {
- return '\n';
-};
+ labelStart = start + 1;
+ labelEnd = parseLinkLabel(state, start);
+ // parser failed to find ']', so it's not a valid link
+ if (labelEnd < 0) { return false; }
-rules.hr = function (tokens, idx, options) {
- return (options.xhtml ? '
' : '
') + getBreak(tokens, idx);
-};
+ pos = labelEnd + 1;
+ if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
+ //
+ // Inline link
+ //
+ // [link]( "title" )
+ // ^^ skipping these spaces
+ pos++;
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (code !== 0x20 && code !== 0x0A) { break; }
+ }
+ if (pos >= max) { return false; }
-rules.bullet_list_open = function (/*tokens, idx, options*/) {
- return '\n';
-};
-rules.bullet_list_close = function (tokens, idx /*, options*/) {
- return '
' + getBreak(tokens, idx);
-};
-rules.list_item_open = function (/*tokens, idx, options*/) {
- return '';
-};
-rules.list_item_close = function (/*tokens, idx, options*/) {
- return '\n';
-};
-rules.ordered_list_open = function (tokens, idx /*, options*/) {
- var token = tokens[idx];
- return ' 1 ? ' start="' + token.order + '"' : '')
- + '>\n';
-};
-rules.ordered_list_close = function (tokens, idx /*, options*/) {
- return '
' + getBreak(tokens, idx);
-};
+ // [link]( "title" )
+ // ^^^^^^ parsing link destination
+ start = pos;
+ if (parseLinkDestination(state, pos)) {
+ href = state.link_content;
+ pos = state.pos;
+ } else {
+ href = '';
+ }
+ // [link]( "title" )
+ // ^^ skipping these spaces
+ start = pos;
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (code !== 0x20 && code !== 0x0A) { break; }
+ }
-rules.paragraph_open = function (/*tokens, idx, options*/) {
- return '';
-};
-rules.paragraph_close = function (tokens, idx /*, options*/) {
- return '
' + getBreak(tokens, idx);
-};
+ // [link]( "title" )
+ // ^^^^^^^ parsing link title
+ if (pos < max && start !== pos && parseLinkTitle(state, pos)) {
+ title = state.link_content;
+ pos = state.pos;
+ // [link]( "title" )
+ // ^^ skipping these spaces
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (code !== 0x20 && code !== 0x0A) { break; }
+ }
+ } else {
+ title = '';
+ }
-rules.link_open = function (tokens, idx /*, options*/) {
- var title = tokens[idx].title ? (' title="' + escapeHtml(replaceEntities(tokens[idx].title)) + '"') : '';
- return '';
-};
-rules.link_close = function (/*tokens, idx, options*/) {
- return '';
-};
+ if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
+ state.pos = labelStart - 1;
+ return false;
+ }
+ pos++;
+ } else {
+ //
+ // Link reference
+ //
+ // [foo] [bar]
+ // ^^ optional whitespace (can include newlines)
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (code !== 0x20 && code !== 0x0A) { break; }
+ }
-rules.image = function (tokens, idx, options) {
- var src = ' src="' + escapeHtml(escapeUrl(tokens[idx].src)) + '"';
- var title = tokens[idx].title ? (' title="' + escapeHtml(replaceEntities(tokens[idx].title)) + '"') : '';
- var alt = ' alt="' + (tokens[idx].alt ? escapeHtml(replaceEntities(tokens[idx].alt)) : '') + '"';
- var suffix = options.xhtml ? ' /' : '';
- return '';
-};
+ if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
+ start = pos + 1;
+ pos = parseLinkLabel(state, pos);
+ if (pos >= 0) {
+ label = state.src.slice(start, pos++);
+ } else {
+ pos = start - 1;
+ }
+ }
+ // covers label === '' and label === undefined
+ // (collapsed reference link and shortcut reference link respectively)
+ if (!label) { label = state.src.slice(labelStart, labelEnd); }
-rules.table_open = function (/*tokens, idx, options*/) {
- return '\n';
-};
-rules.table_close = function (/*tokens, idx, options*/) {
- return '
\n';
-};
-rules.tr_open = function (/*tokens, idx, options*/) {
- return '\n';
-};
-rules.tr_close = function (/*tokens, idx, options*/) {
- return '
\n';
-};
-rules.th_open = function (tokens, idx /*, options*/) {
- var token = tokens[idx];
- return '';
-};
-rules.th_close = function (/*tokens, idx, options*/) {
- return ' | \n';
-};
-rules.td_open = function (tokens, idx /*, options*/) {
- var token = tokens[idx];
- return '';
-};
-rules.td_close = function (/*tokens, idx, options*/) {
- return ' | \n';
-};
+ ref = state.env.references[normalizeReference(label)];
+ if (!ref) {
+ state.pos = labelStart - 1;
+ return false;
+ }
+ href = ref.href;
+ title = ref.title;
+ }
+ //
+ // We found the end of the link, and know for a fact it's a valid link;
+ // so all that's left to do is to call tokenizer.
+ //
+ state.pos = labelStart;
+ state.posMax = labelEnd;
-rules.strong_open = function(/*tokens, idx, options*/) {
- return '';
-};
-rules.strong_close = function(/*tokens, idx, options*/) {
- return '';
-};
-rules.em_open = function(/*tokens, idx, options*/) {
- return '';
-};
-rules.em_close = function(/*tokens, idx, options*/) {
- return '';
-};
+ if (isImage) {
+ state.push({
+ type: 'image',
+ src: href,
+ title: title,
+ alt: state.src.substr(labelStart, labelEnd - labelStart),
+ level: state.level
+ });
+ } else {
+ state.push({
+ type: 'link_open',
+ href: href,
+ title: title,
+ level: state.level++
+ });
+ state.parser.tokenize(state);
+ state.push({ type: 'link_close', level: --state.level });
+ }
+ state.pos = pos;
+ state.posMax = max;
+ return true;
+}
-rules.hardbreak = function (tokens, idx, options) {
- return options.xhtml ? '
\n' : '
\n';
-};
-rules.softbreak = function (tokens, idx, options) {
- return options.breaks ? (options.xhtml ? '
\n' : '
\n') : '\n';
-};
+module.exports = links;
+},{"../links":8}],33:[function(require,module,exports){
+// Proceess '\n'
-rules.text = function (tokens, idx /*, options*/) {
- return tokens[idx].content;
-};
+module.exports = function escape(state) {
+ var pmax, max, pos = state.pos;
+ if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
-rules.htmlblock = function (tokens, idx /*, options*/) {
- return tokens[idx].content;
-};
-rules.htmltag = function (tokens, idx /*, options*/) {
- return tokens[idx].content;
-};
+ pmax = state.pending.length - 1;
+ max = state.posMax;
+ // ' \n' -> hardbreak
+ // Lookup in pending chars is bad practice! Don't copy to other rules!
+ // Pending string is stored in concat mode, indexed lookups will cause
+ // convertion to flat mode.
+ if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
+ if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
+ state.pending = state.pending.replace(/ +$/, '');
+ state.push({
+ type: 'hardbreak',
+ level: state.level
+ });
+ } else {
+ state.pending = state.pending.slice(0, -1);
+ state.push({
+ type: 'softbreak',
+ level: state.level
+ });
+ }
-// Renderer class
-function Renderer() {
- // Clone rules object to allow local modifications
- this.rules = assign({}, rules);
-}
+ } else {
+ state.push({
+ type: 'softbreak',
+ level: state.level
+ });
+ }
-Renderer.prototype.render = function (tokens, options) {
- var i, len, rule, name, next,
- result = '',
- rules = this.rules,
- tightStack = [];
+ pos++;
- // wrap paragraphs on top level by default
- var tight = false;
+ // skip heading spaces for next line
+ while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }
- for (i = 0, len = tokens.length; i < len; i++) {
- name = tokens[i].type;
- rule = rules[name];
+ state.pos = pos;
+ return true;
+};
- // Dirty stack machine to track lists style (loose/tight)
- if (name === 'ordered_list_open' || name === 'bullet_list_open') {
- tightStack.push(tight);
- tight = tokens[i].tight;
- }
- if (name === 'ordered_list_close' || name === 'bullet_list_close') {
- tight = tightStack.pop();
- }
- if (name === 'blockquote_open') {
- tightStack.push(tight);
- tight = false;
- }
- if (name === 'blockquote_close') {
- tight = tightStack.pop();
- }
+},{}],34:[function(require,module,exports){
+// Inline parser state
+'use strict';
- // in tight mode just ignore paragraphs for lists
- // TODO - track right nesting to blockquotes
- if (name === 'paragraph_open' && tight) {
- continue;
- }
- if (name === 'paragraph_close' && tight) {
- // Quick hack - texts should have LF if followed by blocks
- if (i + 1 < tokens.length) {
- next = tokens[i + 1].type;
- if (next === 'bullet_list_open' ||
- next === 'ordered_list_open' ||
- next === 'blockquote_open') {
- result += '\n';
- }
- }
- continue;
- }
+function StateInline(src, parser, options, env) {
+ this.src = src;
+ this.env = env;
+ this.options = options;
+ this.parser = parser;
+ this.tokens = [];
+ this.pos = 0;
+ this.pending = '';
+ this.posMax = this.src.length;
+ this.validateInsideEm = false;
+ this.validateInsideLink = false;
+ this.level = 0;
+ this.link_content = '';
+ this.pendingLevel = 0;
+}
- if (tokens[i].type === 'inline') {
- result += this.render(tokens[i].children, options);
- } else {
- // TODO: temporary check
- if (!rule) {
- throw new Error('Renderer error: unknown token ' + name);
- }
- result += rule(tokens, i, options);
- }
+
+StateInline.prototype.pushPending = function () {
+ var pending = this.pending;
+
+ this.tokens.push({
+ type: 'text',
+ content: pending,
+ level: this.pendingLevel
+ });
+ this.pending = '';
+};
+
+StateInline.prototype.push = function (token) {
+ if (this.pending) {
+ this.pushPending();
}
- return result;
+ this.tokens.push(token);
+ this.pendingLevel = this.level;
};
-module.exports = Renderer;
+module.exports = StateInline;
+
+},{}],35:[function(require,module,exports){
+// Skip text characters for text token, place those to pendibg buffer
+// and increment current pos
+
+module.exports = function text(state) {
+ var match = state.src.slice(state.pos).match(state.parser.textMatch);
+
+ if (!match) { return false; }
+
+ state.pending += match[0];
+ state.pos += match[0].length;
+
+ return true;
+};
-},{"./helpers":6,"object-assign":33}],33:[function(require,module,exports){
+},{}],36:[function(require,module,exports){
'use strict';
function ToObject(val) {
diff --git a/dist/remarkable.min.js b/dist/remarkable.min.js
index 00d29aa..abfa28d 100644
--- a/dist/remarkable.min.js
+++ b/dist/remarkable.min.js
@@ -1,3 +1,3 @@
/* remarkable 1.0.0 https://github.com//jonschlinkert/remarkable */
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.Remarkable=e()}}(function(){return function e(r,t,n){function s(i,a){if(!t[i]){if(!r[i]){var l="function"==typeof require&&require;if(!a&&l)return l(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[i]={exports:{}};r[i][0].call(u.exports,function(e){var t=r[i][1][e];return s(t?t:e)},u,u.exports,e,r,t,n)}return t[i].exports}for(var o="function"==typeof require&&require,i=0;i",Gt:"≫",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒","in":"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬","int":"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",LT:"<",Lt:"≪",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}},{}],2:[function(e,r){"use strict";r.exports=["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"]},{}],3:[function(e,r){"use strict";function t(e,r){return e=e.source,r=r||"",function t(n,s){return n?(s=s.source||s,e=e.replace(n,s),t):new RegExp(e,r)}}var n=/[a-zA-Z_:][a-zA-Z0-9:._-]*/,s=/[^"'=<>`\x00-\x20]+/,o=/'[^']*'/,i=/"[^"]*"/,a=t(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",s)("single_quoted",o)("double_quoted",i)(),l=t(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",n)("attr_value",a)(),c=t(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",l)(),u=/<\/[A-Za-z][A-Za-z0-9]*\s*>/,p=//,h=/<[?].*?[?]>/,f=/]*>/,d=/])*\]\]>/,g=t(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",c)("close_tag",u)("comment",p)("processing",h)("declaration",f)("cdata",d)();r.exports.HTML_TAG_RE=g},{}],4:[function(e,r){"use strict";r.exports=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"]},{}],5:[function(e,r){"use strict";r.exports={html:!1,xhtml:!1,breaks:!1,langprefix:"language-"}},{}],6:[function(e,r,t){"use strict";function n(e){return 32===e}function s(e,r){return e.bMarks[r]+e.tShift[r]>=e.eMarks[r]}function o(e,r){for(var t=e.lineMax;t>r&&!(e.bMarks[r]+e.tShift[r]r&&n(e.src.charCodeAt(r));r++);return r}function a(e,r,t){for(var n=e.src.length;n>r&&e.src.charCodeAt(r)===t;r++);return r}function l(e,r,t,n){if(n>=r)return r;for(;r>n;)if(t!==e.src.charCodeAt(--r))return r+1;return r}function c(e,r,t,n,s){var o,i,a,l,c=r;if(r>=t)return"";if(c+1===t)return i=e.bMarks[c]+Math.min(e.tShift[c],n),a=s?e.bMarks[t]:e.eMarks[t-1],e.src.slice(i,a);for(l=new Array(t-r),o=0;t>c;c++,o++)i=e.bMarks[c]+Math.min(e.tShift[c],n),a=t>c+1||s?e.eMarks[c]+1:e.eMarks[c],l[o]=e.src.slice(i,a);return l.join("")}function u(e){return e.indexOf("&")>=0&&(e=e.replace(/&/g,"&")),e.indexOf("<")>=0&&(e=e.replace(/")>=0&&(e=e.replace(/>/g,">")),e.indexOf('"')>=0&&(e=e.replace(/"/g,""")),e}function p(e){return e.indexOf("\\")<0?e:e.replace(g,"$1")}function h(e){return e>=55296&&57343>=e?!1:e>=245&&255>=e?!1:192===e||193===e?!1:e>=64976&&65007>=e?!1:65535===(65535&e)||65534===(65535&e)?!1:31>=e?!1:e>=127&&159>=e?!1:e>1114111?!1:!0}function f(e){if(e>65535){e-=65536;var r=55296+(e>>10),t=56320+(1023&e);return String.fromCharCode(r,t)}return String.fromCharCode(e)}function d(e){return e.indexOf("&")<0?e:e.replace(b,function(e,r){return m.hasOwnProperty(r)?m[r]:e})}var g=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,b=/&([a-z][a-z0-9]{1,31});/gi,m=e("./common/entities");t.isWhiteSpace=n,t.isEmpty=s,t.skipEmptyLines=o,t.skipSpaces=i,t.skipChars=a,t.getLines=c,t.skipCharsBack=l,t.escapeHtml=u,t.unescapeMd=p,t.isValidEntityCode=h,t.fromCodePoint=f,t.replaceEntities=d},{"./common/entities":1}],7:[function(e,r){"use strict";function t(e){var r=e.toString();return r=r.substr("function ".length),r=r.substr(0,r.indexOf("("))}function n(e,r){for(var n=0;nc)||(e.line=c=i(e,c,t),c>=t)||e.tShift[c]s&&!(n=o[s](e,c,t,!1));s++);if(!n)throw new Error("No matching rules found");if(c===e.line)throw new Error("None of rules updated state.line");if(e.tight=!u,a(e,e.line-1)&&(u=!0),c=e.line,t>c&&a(e,c)){if(u=!0,c++,t>c&&e.listMode&&a(e,c))break;
-e.line=c}}},s.prototype.parse=function(e,r,t){var n,s=0,i=0;return e?(e.indexOf("\r")>=0&&(e=e.replace(/\r/,"")),e.indexOf(" ")>=0&&(e=e.replace(/\u00a0/g," ")),e.indexOf("")>=0&&(e=e.replace(/\u2424/g,"\n")),e.indexOf(" ")>=0&&(e=e.replace(/[\n\t]/g,function(r,t){var n;return 10===e.charCodeAt(t)?(s=t+1,i=0,r):(n=" ".slice((t-s-i)%4),i=t-s+1,n)})),n=new o(e,this,[],r,t),this.tokenize(n,n.line,n.lineMax),n.tokens):""},r.exports=s},{"./helpers":6,"./lexer_block/blockquote":8,"./lexer_block/code":9,"./lexer_block/fences":10,"./lexer_block/heading":11,"./lexer_block/hr":12,"./lexer_block/htmlblock":13,"./lexer_block/lheading":14,"./lexer_block/list":15,"./lexer_block/paragraph":16,"./lexer_block/state_block":17,"./lexer_block/table":18}],8:[function(e,r){"use strict";var t=e("../helpers").skipSpaces;r.exports=function(e,r,n,s){var o,i,a,l,c,u,p,h=e.lexer.rules_named,f=e.bMarks[r]+e.tShift[r],d=e.eMarks[r];if(f>d)return!1;if(62!==e.src.charCodeAt(f++))return!1;if(s)return!0;for(32===e.src.charCodeAt(f)&&f++,e.bqMarks[r]++,e.bqLevel++,u=e.blkIndent,e.blkIndent=0,l=[e.bMarks[r]],e.bMarks[r]=f,f=d>f?t(e,f):f,i=f>=d,a=[e.tShift[r]],e.tShift[r]=f-e.bMarks[r],o=r+1;n>o&&(f=e.bMarks[o]+e.tShift[o],d=e.eMarks[o],!(f>=d));o++)if(62!==e.src.charCodeAt(f++)){if(i)break;if(h.fences(e,o,n,!0))break;if(h.hr(e,o,n,!0))break;if(h.list(e,o,n,!0))break;if(h.heading(e,o,n,!0))break;if(h.blockquote(e,o,n,!0))break;if(h.table(e,o,n,!0))break;l.push(e.bMarks[o]),a.push(e.tShift[o])}else e.bqMarks[o]++,32===e.src.charCodeAt(f)&&f++,l.push(e.bMarks[o]),e.bMarks[o]=f,f=d>f?t(e,f):f,i=f>=d,a.push(e.tShift[o]),e.tShift[o]=f-e.bMarks[o];for(p=e.listMode,e.listMode=!1,e.tokens.push({type:"blockquote_open"}),e.lexer.tokenize(e,r,o),e.tokens.push({type:"blockquote_close"}),e.listMode=p,c=0;ci&&!(e.bqMarks[i]=4))break;i++,a=i}return o?!0:(e.tokens.push({type:"code",content:n(e,r,a,4+e.blkIndent,!0),block:!0}),e.line=i,!0)}},{"../helpers":6}],10:[function(e,r){"use strict";var t=e("../helpers").skipSpaces,n=e("../helpers").skipChars,s=e("../helpers").getLines;r.exports=function(e,r,o,i){var a,l,c,u,p,h=!1,f=e.bMarks[r]+e.tShift[r],d=e.eMarks[r];if(f+3>d)return!1;if(a=e.src.charCodeAt(f),126!==a&&96!==a)return!1;if(p=f,f=n(e,f,a),l=f-p,3>l)return!1;if(c=e.src.slice(f,d).trim(),c.indexOf("`")>=0)return!1;if(i)return!0;for(u=r;(u++,!(u>=o))&&(f=p=e.bMarks[u]+e.tShift[u],d=e.eMarks[u],!(d>f&&e.tShift[u]f&&e.bqMarks[u]f-p||(f=t(e,f),d>f)))){h=!0;break}return l=e.tShift[r],e.tokens.push({type:"fence",params:c,content:s(e,r+1,u,l,!0)}),e.line=u+(h?1:0),!0}},{"../helpers":6}],11:[function(e,r){"use strict";var t=e("../helpers").isWhiteSpace,n=e("../helpers").skipSpaces,s=e("../helpers").skipCharsBack;r.exports=function(e,r,o,i){var a,l,c=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(c>=u)return!1;if(a=e.src.charCodeAt(c),35!==a||c>=u)return!1;for(l=1,a=e.src.charCodeAt(++c);35===a&&u>c&&6>=l;)l++,a=e.src.charCodeAt(++c);return l>6||u>c&&!t(a)?!1:(c=n(e,c),u=s(e,u,32,c),u=s(e,u,35,c),uc&&e.tokens.push({type:"inline",content:e.src.slice(c,u).trim()}),e.tokens.push({type:"heading_close",level:l}),e.line=r+1,!0))}},{"../helpers":6}],12:[function(e,r){"use strict";var t=e("../helpers").isWhiteSpace;r.exports=function(e,r,n,s){var o,i,a,l=e.bMarks[r],c=e.eMarks[r];if(l+=e.tShift[r],l>c)return!1;if(o=e.src.charCodeAt(l++),42!==o&&45!==o&&95!==o)return!1;for(i=1;c>l;){if(a=e.src.charCodeAt(l++),a!==o&&!t(a))return!1;a===o&&i++}return 3>i?!1:s?!0:(e.tokens.push({type:"hr"}),e.line=r+1,!0)}},{"../helpers":6}],13:[function(e,r){"use strict";function t(e){var r=32|e;return r>=97&&122>=r}var n=e("../helpers").isEmpty,s=e("../helpers").getLines,o=e("../common/html_blocks"),i=/^<([a-zA-Z]{1,15})[\s\/>]/,a=/^<\/([a-zA-Z]{1,15})[\s>]/;r.exports=function(e,r,l,c){var u,p,h,f=e.bMarks[r],d=e.eMarks[r],g=e.tShift[r];if(f+=g,!e.options.html)return!1;if(g>3||f+2>=d||e.blkLevel>0)return!1;if(60!==e.src.charCodeAt(f))return!1;if(u=e.src.charCodeAt(f+1),33===u||63===u){if(c)return!0}else{if(47!==u&&!t(u))return!1;if(47===u){if(p=e.src.slice(f,d).match(a),!p)return!1}else if(p=e.src.slice(f,d).match(i),!p)return!1;if(o.indexOf(p[1].toLowerCase())<0)return!1;if(c)return!0}for(h=r+1;h=o?!1:e.tShift[u]3?!1:(l=e.bMarks[u]+e.tShift[u],c=e.eMarks[u],a=e.src.charCodeAt(l),45!==a&&61!==a?!1:(l=n(e,l,a),l=t(e,l),c>l?!1:i?!0:(l=e.bMarks[r]+e.tShift[r],c=s(e,e.eMarks[r],32,l),e.tokens.push({type:"heading_open",level:61===a?1:2}),e.tokens.push({type:"inline",content:e.src.slice(l,c).trim()}),e.tokens.push({type:"heading_close",level:61===a?1:2}),e.line=u+1,!0)))}},{"../helpers":6}],15:[function(e,r){"use strict";function t(e,r){var t,n,s;return n=e.bMarks[r]+e.tShift[r],s=e.eMarks[r],n>=s?-1:(t=e.src.charCodeAt(n++),42!==t&&45!==t&&43!==t?-1:s>n&&32!==e.src.charCodeAt(n)?-1:n)}function n(e,r){var t,n=e.bMarks[r]+e.tShift[r],s=e.eMarks[r];if(n+1>=s)return-1;if(t=e.src.charCodeAt(n++),48>t||t>57)return-1;for(;;){if(n>=s)return-1;if(t=e.src.charCodeAt(n++),!(t>=48&&57>=t)){if(41===t||46===t)break;return-1}}return s>n&&32!==e.src.charCodeAt(n)?-1:n}var s=e("../helpers").isEmpty,o=e("../helpers").skipSpaces;r.exports=function(e,r,i,a){var l,c,u,p,h,f,d,g,b,m,k,v,x,q,y,w,_=e.lexer.rules_named;if((g=n(e,r))>=0)x=!0;else{if(!((g=t(e,r))>=0))return!1;x=!1}if(v=e.src.charCodeAt(g-1),a)return!0;for(y=e.tokens.length,x?(d=e.bMarks[r]+e.tShift[r],k=Number(e.src.substr(d,g-d-1)),e.tokens.push({type:"ordered_list_open",order:k,tight:!0})):e.tokens.push({type:"bullet_list_open",tight:!0}),l=r,w=!1;i>l&&(q=o(e,g),b=e.eMarks[l],m=q>=b?1:q-g,m>4&&(m=1),1>m&&(m=1),c=g-e.bMarks[l]+m,e.tokens.push({type:"list_item_open"}),p=e.blkIndent,h=e.tight,u=e.tShift[r],f=e.listMode,e.tShift[r]=q-e.bMarks[r],e.blkIndent=c,e.tight=!0,e.listMode=!0,e.lexer.tokenize(e,r,i,!0),(!e.tight||w)&&(e.tokens[y].tight=!1),w=e.line-r>1&&s(e,e.line-1),e.blkIndent=p,e.tShift[r]=u,e.tight=h,e.listMode=f,e.tokens.push({type:"list_item_close"}),l=r=e.line,q=e.bMarks[r],!(l>=i));){if(s(e,l)){if(l>=i||s(e,l))break;l++}if(e.tShift[l]g)break}else if(g=t(e,l),0>g)break;if(v!==e.src.charCodeAt(g-1))break}return e.tokens.push(x?{type:"ordered_list_close"}:{type:"bullet_list_close"}),e.line=l,!0}},{"../helpers":6}],16:[function(e,r){"use strict";var t=e("../helpers").isEmpty,n=e("../helpers").getLines;r.exports=function(e,r){var s,o,i,a,l=r+1,c=e.lexer.rules_named;for(s=e.lineMax;s>l&&!t(e,l);l++)if(!(e.tShift[l]-e.blkIndent>3)){if(c.fences(e,l,s,!0))break;if(c.hr(e,l,s,!0))break;if(c.list(e,l,s,!0))break;if(c.heading(e,l,s,!0))break;if(c.blockquote(e,l,s,!0))break;if(c.htmlblock(e,l,s,!0))break;if(c.table(e,l,s,!0))break}for(o=n(e,r,l,e.blkIndent,!1).trim();i=e.lexer.inline.parse_reference(o,e.options,e.env);)a=e.env.references,a[i.label]=a[i.label]||{title:i.title,href:i.href},o=i.remaining.trim();return o&&(e.tokens.push({type:"paragraph_open"}),e.tokens.push({type:"inline",content:o}),e.tokens.push({type:"paragraph_close"})),e.line=l,!0}},{"../helpers":6}],17:[function(e,r){"use strict";function t(e,r,t,n,s){var o,i,a,l,c,u,p;for(this.src=e,this.lexer=r,this.options=n,this.env=s,this.tokens=t,this.bMarks=[],this.eMarks=[],this.tShift=[],i=this.src,u=0,p=!1,a=l=u=0,c=i.length;c>l;l++)o=i.charCodeAt(l),p||32!==o||u++,p||32===o||(this.tShift.push(u),p=!0),(13===o||10===o)&&(this.bMarks.push(a),this.eMarks.push(l),p=!1,u=0,a=l+1),13===o&&c>l&&10===i.charCodeAt(l)&&(l++,a++);for((13!==o||10!==o)&&(this.bMarks.push(a),this.eMarks.push(c),this.tShift.push(u)),this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.pos=0,this.blkLevel=0,this.blkIndent=0,this.line=0,this.lineMax=this.bMarks.length-1,this.tight=!1,this.listMode=!1,this.bqLevel=0,this.bqMarks=[],a=0;an)return!1;if(o=e.src.charCodeAt(e.bMarks[r+1]+e.tShift[r+1]),124!==o&&45!==o)return!1;if(a=t(e,r+1,/^ *\|?(( *[:-]-+[:-] *\|)+( *[:-]-+[:-] *))\|? *$/),!a)return!1;for(p=a[1].split("|"),h=[],l=0;lc&&(u=t(e,c,/^ *\|?(.*?\|.*?)\|? *$/),u);c++){for(p=u[1].split("|"),e.tokens.push({type:"tr_open"}),l=0;l"]+/;for(var e=0;et&&!(r=n[t](e));t++);if(r){if(e.pos>=o)break}else e.pending+=e.src[e.pos++]}return e.pending&&e.pushPending(),e.tokens},s.prototype.parse=function(e,r,t){var n=new o(e,this,r,t);return this.tokenize(n),n.tokens},s.prototype.parse_reference=function(e,r){var t,n,s,l,c,u,p,h;if(91!==e.charCodeAt(0))return null;if(t=new o(e,this,r),n=i.parseLinkLabel(t,0),0>n||58!==e.charCodeAt(n+1))return null;for(l=t.posMax,s=n+2;l>s&&(c=t.src.charCodeAt(s),32===c||10===c);s++);if(p=i.parseLinkDestination(t,s),null===p)return null;for(s=t.pos,u=s,s+=1;l>s&&(c=t.src.charCodeAt(s),32===c||10===c);s++);return l>s&&u!==s&&null!==(h=i.parseLinkTitle(t,s))?s=t.pos:(h="",s=u),s=a(t,s),l>s&&10!==t.src.charCodeAt(s)?null:{label:i.normalizeReference(e.slice(1,n)),title:h,href:p,remaining:e.slice(s)}},r.exports=s},{"./helpers":6,"./lexer_inline/autolink":20,"./lexer_inline/backticks":21,"./lexer_inline/emphasis":22,"./lexer_inline/entity":23,"./lexer_inline/escape":24,"./lexer_inline/escape_html_char":25,"./lexer_inline/htmltag":26,"./lexer_inline/links":27,"./lexer_inline/newline":28,"./lexer_inline/state_inline":29,"./lexer_inline/text":30}],20:[function(e,r){var t=e("../helpers").escapeHtml,n=e("../common/url_schemas"),s=/^<([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])?)*)>/,o=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;r.exports=function(e){var r,i,a,l=e.pos;return 60!==e.src.charCodeAt(l)?!1:(r=e.src.slice(l),r.indexOf(">")<0?!1:(i=r.match(o))?n.indexOf(i[1].toLowerCase())<0?!1:(e.push({type:"link_open",href:i[0].slice(1,-1)}),e.push({type:"text",content:t(i[0].slice(1,-1))}),e.push({type:"link_close"}),e.pos+=i[0].length,!0):(a=r.match(s),a?(e.tokens.push({type:"link_open",href:"mailto:"+a[0].slice(1,-1)}),e.tokens.push({type:"text",content:t(a[0].slice(1,-1))}),e.tokens.push({type:"link_close"}),e.pos+=a[0].length,!0):!1))}},{"../common/url_schemas":4,"../helpers":6}],21:[function(e,r){var t=/`+/g;r.exports=function(e){var r,n,s,o,i,a=e.pos,l=e.src.charCodeAt(a);if(96!==l)return!1;for(r=a,a++,s=e.posMax;s>a&&96===e.src.charCodeAt(a);)a++;for(o=e.src.slice(r,a),t=/`+/g,t.lastIndex=a;null!==(i=t.exec(e.src));)if(i[0].length===o.length)return n=e.src.slice(a,t.lastIndex-o.length),e.push({type:"code",content:n.replace(/[ \n]+/g," ").trim(),block:!1}),e.pos+=2*o.length+n.length,!0;return e.pending+=o,e.pos+=o.length,!0}},{}],22:[function(e,r){"use strict";function t(e){return e>=48&&57>=e||e>=65&&90>=e||e>=97&&122>=e}function n(e,r){var n,s,o=r,i=Math.min(e.posMax,o+4),a=e.src.charCodeAt(r);if(n=0!==e.pending.length?e.pending.charCodeAt(e.pending.length-1):-1,n===a)return-1;for(;i>o&&e.src.charCodeAt(o)===a;)o++;return o>=i?-1:(s=o-r,s>=4?s:32===e.src.charCodeAt(o)?-1:95===a&&t(n)?-1:s)}function s(e,r){var n,s,o=r,i=Math.min(e.posMax,o+4),a=e.src.charCodeAt(r);for(n=0!==e.pending.length?e.pending.charCodeAt(e.pending.length-1):-1;i>o&&e.src.charCodeAt(o)===a;)o++;return s=o-r,s>=4?s:32===n?-1:95===a&&i>o&&t(e.src.charCodeAt(o))?-1:s}r.exports=function o(e){var r,t,i,a,l,c,u,p,h,f,d,g,b,m,k=e.posMax,v=e.pos,x=e.src.charCodeAt(v);if(95!==x&&42!==x)return!1;if(r=n(e,v),0>r)return!1;if(r>=4)return e.pos+=r,e.pending+=e.src.slice(v,r),!0;for(i=e.tokens.length,a=e.pending,e.pos=v+r,g=[r],d=e.lexer.rules,f=d.length;e.pos=1&&4>t){for(p=g.pop(),h=t;p!==h;){if(3===p){g.push(3-h);break}if(p>h){b=!0;break}if(h-=p,0===g.length)break;e.pos+=p,p=g.pop()}if(b)break;if(0===g.length){r=p,l=!0;break}e.pos+=t;continue}if(t=n(e,e.pos),t>=1){g.push(t),e.pos+=t;continue}}for(u=0;f>u&&(d[u]!==o&&(c=d[u](e)),!c);u++);c?m=!1:(m=e.src.charCodeAt(e.pos)===x,e.pending+=e.src[e.pos],e.pos++)}return e.tokens.length=i,e.pending=a,l?(e.posMax=e.pos,e.pos=v+r,e.pending&&e.pushPending(),(2===r||3===r)&&e.push({type:"strong_open"}),(1===r||3===r)&&e.push({type:"em_open"}),e.lexer.tokenize(e),(1===r||3===r)&&e.push({type:"em_close"}),(2===r||3===r)&&e.push({type:"strong_close"}),e.pos=e.posMax+r,e.posMax=k,!0):(e.pos=v,!1)}},{}],23:[function(e,r){"use strict";var t=e("../common/entities"),n=e("../helpers").escapeHtml,s=e("../helpers").isValidEntityCode,o=e("../helpers").fromCodePoint,i=/^((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,a=/^&([a-z][a-z0-9]{1,31});/i;r.exports=function(e){var r,l,c,u=e.pos,p=e.posMax;if(38!==e.src.charCodeAt(u))return!1;if(p>u+1)if(r=e.src.charCodeAt(u+1),35===r){if(c=e.src.slice(u).match(i))return l="x"===c[1][0].toLowerCase()?parseInt(c[1].slice(1),16):parseInt(c[1],10),e.pending+=s(l)?n(o(l)):o(65533),e.pos+=c[0].length,!0}else if(c=e.src.slice(u).match(a),c&&t.hasOwnProperty(c[1]))return e.pending+=n(t[c[1]]),e.pos+=c[0].length,!0;return e.pending+="&",e.pos++,!0}},{"../common/entities":1,"../helpers":6}],24:[function(e,r){var t="\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").map(function(e){return e.charCodeAt(0)});r.exports=function(e){var r,n=e.pos,s=e.posMax;if(92!==e.src.charCodeAt(n))return!1;if(n++,s>n){if(r=e.src.charCodeAt(n),t.indexOf(r)>=0)return e.pending+=38===r?"&":60===r?"<":62===r?">":34===r?""":e.src[n],e.pos+=2,!0;if(10===r){for(e.push({type:"hardbreak"}),n++;s>n&&32===e.src.charCodeAt(n);)n++;return e.pos=n,!0}}return e.pending+="\\",e.pos++,!0}},{}],25:[function(e,r){r.exports=function(e){var r=e.src.charCodeAt(e.pos);if(60===r)e.pending+="<";else if(62===r)e.pending+=">";else{if(34!==r)return!1;e.pending+="""}return e.pos++,!0}},{}],26:[function(e,r){"use strict";function t(e){var r=32|e;return r>=97&&122>=r}var n=e("../common/html_re").HTML_TAG_RE;r.exports=function(e){var r,s,o,i=e.pos;return e.options.html?(o=e.posMax,60!==e.src.charCodeAt(i)||i+2>=o?!1:(r=e.src.charCodeAt(i+1),(33===r||63===r||47===r||t(r))&&(s=e.src.slice(i).match(n))?(e.push({type:"htmltag",content:e.src.slice(i,i+s[0].length)}),e.pos+=s[0].length,!0):!1)):!1}},{"../common/html_re":3}],27:[function(e,r){"use strict";function t(e,r){var t,n,s,o,i,a,l,c=-1,u=e.posMax,p=e.pos,h=e.tokens.length,f=e.pending;for(e.pos=r+1,t=1,n=e.lexer.rules,s=n.length;e.posa&&("emphasis"!==n[a].name&&"links"!==n[a].name&&(l=n[a](e)),!l);a++);l||(e.pending+=e.src[e.pos++])}return o&&(c=e.pos),e.pos=p,e.tokens.length=h,e.pending=f,c}function n(e,r){var t,n,s=e.posMax,o="";if(60===e.src.charCodeAt(r)){for(r++;s>r;){if(t=e.src.charCodeAt(r),10===t)return null;if(62===t)return e.pos=r+1,o;92===t&&s>r+1?(r++,o+=e.src[r++]):o+=e.src[r++]}return null}for(n=0;s>r&&(t=e.src.charCodeAt(r),32!==t)&&!(32>t||127===t);)if(92===t&&s>r+1)r++,o+=e.src[r++];else{if(40===t&&(n++,n>1))break;if(41===t&&(n--,0>n))break;o+=e.src[r++]}return o.length?(e.pos=r,o):null}function s(e,r){var t,n,s=e.posMax,o=e.src.charCodeAt(r);if(34!==o&&39!==o&&40!==o)return null;for(r++,t="",40===o&&(o=41);s>r;){if(n=e.src.charCodeAt(r),n===o)return e.pos=r+1,t;92===n&&s>r+1?(r++,t+=e.src[r++]):t+=e.src[r++]}return null}function o(e){return e.trim().replace(/\s+/g," ").toLowerCase()}function i(e){var r,i,a,l,c,u,p,h,f=!1,d=e.posMax,g=e.pos,b=e.src.charCodeAt(g);if(33===b&&(f=!0,b=e.src.charCodeAt(++g)),91!==b)return!1;if(r=g+1,i=t(e,g),0>u)return!1;if(u=i+1,d>u&&40===e.src.charCodeAt(u)){for(u++;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);if(u>=d)return!1;for(g=u,l=n(e,u),null!==l?u=e.pos:l="",g=u;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);if(d>u&&g!==u&&null!==(c=s(e,u)))for(u=e.pos;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);else c="";if(u>=d||41!==e.src.charCodeAt(u))return e.pos=r-1,!1;u++}else{for(;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);if(d>u&&91===e.src.charCodeAt(u)&&(g=u+1,u=t(e,u),u>=0?a=e.src.slice(g,u++):u=g-1),a||(a=e.src.slice(r,i)),p=e.env.references[o(a)],!p)return e.pos=r-1,!1;l=p.href,c=p.title}return e.pos=r,e.posMax=i,e.pending&&e.pushPending(),f?e.push({type:"image",src:l,title:c,alt:e.src.substr(r,i-r)}):(e.push({type:"link_open",href:l,title:c}),e.lexer.tokenize(e),e.push({type:"link_close"})),e.pos=u,e.posMax=d,!0}r.exports=i,r.exports.parseLinkLabel=t,r.exports.parseLinkDestination=n,r.exports.parseLinkTitle=s,r.exports.normalizeReference=o},{}],28:[function(e,r){r.exports=function(e){var r,t,n=e.pos;if(10!==e.src.charCodeAt(n))return!1;for(r=e.pending.length-1,t=e.posMax,r>=0&&32===e.pending.charCodeAt(r)?r>=1&&32===e.pending.charCodeAt(r-1)?(e.pending=e.pending.replace(/ +$/,""),e.push({type:"hardbreak"})):(e.pending=e.pending.slice(0,-1),e.push({type:"softbreak"})):e.push({type:"softbreak"}),n++;t>n&&32===e.src.charCodeAt(n);)n++;return e.pos=n,!0}},{}],29:[function(e,r){"use strict";function t(e,r,t,n){this.src=e,this.env=n,this.options=t,this.lexer=r,this.tokens=[],this.pos=0,this.pending="",this.posMax=this.src.length}t.prototype.pushPending=function(){var e=this.pending;this.tokens.push({type:"text",content:e}),this.pending=""},t.prototype.push=function(e){this.pending&&this.pushPending(),this.tokens.push(e)},r.exports=t},{}],30:[function(e,r){r.exports=function(e){var r=e.src.slice(e.pos).match(e.lexer.textMatch);return r?(e.pending+=r[0],e.pos+=r[0].length,!0):!1}},{}],31:[function(e,r){"use strict";function t(e){this.options=n({},a),this.state=null,this.inline=new i,this.block=new o,this.renderer=new s,this.block.inline=this.inline,e&&this.set(e)}var n=e("object-assign"),s=e("./renderer"),o=e("./lexer_block"),i=e("./lexer_inline"),a=e("./defaults");t.prototype.set=function(e){n(this.options,e)},t.prototype.render=function(e){var r,t,n,s,o={references:Object.create(null)};for(r=this.block.parse(e,this.options,o),n=0,s=r.length;s>n;n++)t=r[n],"inline"===t.type&&(t.children=this.inline.parse(t.content,this.options,o));return this.renderer.render(r,this.options,o)},r.exports=t},{"./defaults":5,"./lexer_block":7,"./lexer_inline":19,"./renderer":32,"object-assign":33}],32:[function(e,r){"use strict";function t(e){try{return encodeURI(e)}catch(r){}return""}function n(e){try{return decodeURI(e)}catch(r){}return""}function s(e,r){return++r\n"},u.blockquote_close=function(e,r){return""+s(e,r)},u.code=function(e,r){return e[r].block?""+a(e[r].content)+"
"+s(e,r):""+a(e[r].content)+"
"},u.fence=function(e,r,t){var n,o=e[r],i="",u=t.langprefix||"";return o.params&&(n=o.params.split(/ +/g),i=' class="'+u+a(c(l(n[0])))+'"'),""+a(o.content)+"
"+s(e,r)},u.heading_open=function(e,r){return""},u.heading_close=function(e,r){return"\n"},u.hr=function(e,r,t){return(t.xhtml?"
":"
")+s(e,r)},u.bullet_list_open=function(){return"\n"},u.bullet_list_close=function(e,r){return"
"+s(e,r)},u.list_item_open=function(){return""},u.list_item_close=function(){return"\n"},u.ordered_list_open=function(e,r){var t=e[r];return"1?' start="'+t.order+'"':"")+">\n"},u.ordered_list_close=function(e,r){return"
"+s(e,r)},u.paragraph_open=function(){return""},u.paragraph_close=function(e,r){return"
"+s(e,r)},u.link_open=function(e,r){var s=e[r].title?' title="'+a(c(e[r].title))+'"':"";return'"},u.link_close=function(){return""},u.image=function(e,r,n){var s=' src="'+a(t(e[r].src))+'"',o=e[r].title?' title="'+a(c(e[r].title))+'"':"",i=' alt="'+(e[r].alt?a(c(e[r].alt)):"")+'"',l=n.xhtml?" /":"";return""},u.table_open=function(){return"\n"},u.table_close=function(){return"
\n"},u.tr_open=function(){return"\n"},u.tr_close=function(){return"
\n"},u.th_open=function(e,r){var t=e[r];return""},u.th_close=function(){return" | \n"},u.td_open=function(e,r){var t=e[r];return""},u.td_close=function(){return" | \n"},u.strong_open=function(){return""},u.strong_close=function(){return""},u.em_open=function(){return""},u.em_close=function(){return""},u.hardbreak=function(e,r,t){return t.xhtml?"
\n":"
\n"},u.softbreak=function(e,r,t){return t.breaks?t.xhtml?"
\n":"
\n":"\n"},u.text=function(e,r){return e[r].content},u.htmlblock=function(e,r){return e[r].content},u.htmltag=function(e,r){return e[r].content},o.prototype.render=function(e,r){var t,n,s,o,i,a="",l=this.rules,c=[],u=!1;for(t=0,n=e.length;n>t;t++)if(o=e[t].type,s=l[o],("ordered_list_open"===o||"bullet_list_open"===o)&&(c.push(u),u=e[t].tight),("ordered_list_close"===o||"bullet_list_close"===o)&&(u=c.pop()),"blockquote_open"===o&&(c.push(u),u=!1),"blockquote_close"===o&&(u=c.pop()),"paragraph_open"!==o||!u)if("paragraph_close"===o&&u)t+1",Gt:"≫",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒","in":"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬","int":"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",LT:"<",Lt:"≪",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}},{}],2:[function(e,r){"use strict";r.exports=["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"]},{}],3:[function(e,r){"use strict";function t(e,r){return e=e.source,r=r||"",function t(s,n){return s?(n=n.source||n,e=e.replace(s,n),t):new RegExp(e,r)}}var s=/[a-zA-Z_:][a-zA-Z0-9:._-]*/,n=/[^"'=<>`\x00-\x20]+/,i=/'[^']*'/,o=/"[^"]*"/,l=t(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",n)("single_quoted",i)("double_quoted",o)(),a=t(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",s)("attr_value",l)(),c=t(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",a)(),u=/<\/[A-Za-z][A-Za-z0-9]*\s*>/,p=//,h=/<[?].*?[?]>/,f=/]*>/,d=/])*\]\]>/,g=t(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",c)("close_tag",u)("comment",p)("processing",h)("declaration",f)("cdata",d)();r.exports.HTML_TAG_RE=g},{}],4:[function(e,r){"use strict";r.exports=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"]},{}],5:[function(e,r){"use strict";r.exports={html:!1,xhtml:!1,breaks:!1,maxLevel:20,langPrefix:"language-",highlight:function(){return""}}},{}],6:[function(e,r,t){"use strict";function s(e){return 32===e}function n(e,r){return e.bMarks[r]+e.tShift[r]>=e.eMarks[r]}function i(e,r){for(var t=e.lineMax;t>r&&!(e.bMarks[r]+e.tShift[r]r&&s(e.src.charCodeAt(r));r++);return r}function l(e,r,t){for(var s=e.src.length;s>r&&e.src.charCodeAt(r)===t;r++);return r}function a(e,r,t,s){if(s>=r)return r;for(;r>s;)if(t!==e.src.charCodeAt(--r))return r+1;return r}function c(e,r,t,s,n){var i,o,l,a,c=r;if(r>=t)return"";if(c+1===t)return o=e.bMarks[c]+Math.min(e.tShift[c],s),l=n?e.bMarks[t]:e.eMarks[t-1],e.src.slice(o,l);for(a=new Array(t-r),i=0;t>c;c++,i++)o=e.bMarks[c]+Math.min(e.tShift[c],s),l=t>c+1||n?e.eMarks[c]+1:e.eMarks[c],a[i]=e.src.slice(o,l);return a.join("")}function u(e){return e.indexOf("&")>=0&&(e=e.replace(/&/g,"&")),e.indexOf("<")>=0&&(e=e.replace(/")>=0&&(e=e.replace(/>/g,">")),e.indexOf('"')>=0&&(e=e.replace(/"/g,""")),e}function p(e){return e.indexOf("\\")<0?e:e.replace(g,"$1")}function h(e){return e>=55296&&57343>=e?!1:e>=245&&255>=e?!1:192===e||193===e?!1:e>=64976&&65007>=e?!1:65535===(65535&e)||65534===(65535&e)?!1:31>=e?!1:e>=127&&159>=e?!1:e>1114111?!1:!0}function f(e){if(e>65535){e-=65536;var r=55296+(e>>10),t=56320+(1023&e);return String.fromCharCode(r,t)}return String.fromCharCode(e)}function d(e){return e.indexOf("&")<0?e:e.replace(b,function(e,r){return m.hasOwnProperty(r)?m[r]:e})}var g=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,b=/&([a-z][a-z0-9]{1,31});/gi,m=e("./common/entities");t.isWhiteSpace=s,t.isEmpty=n,t.skipEmptyLines=i,t.skipSpaces=o,t.skipChars=l,t.getLines=c,t.skipCharsBack=a,t.escapeHtml=u,t.unescapeMd=p,t.isValidEntityCode=h,t.fromCodePoint=f,t.replaceEntities=d},{"./common/entities":1}],7:[function(e,r){"use strict";function t(e){this.options=s({},l),this.state=null,this.inline=new o,this.block=new i,this.renderer=new n,this.block.inline=this.inline,e&&this.set(e)}var s=e("object-assign"),n=e("./renderer"),i=e("./parser_block"),o=e("./parser_inline"),l=e("./defaults");t.prototype.set=function(e){s(this.options,e)},t.prototype.render=function(e){var r,t,s,n,i={references:Object.create(null)};for(r=this.block.parse(e,this.options,i),s=0,n=r.length;n>s;s++)t=r[s],"inline"===t.type&&(t.children=this.inline.parse(t.content,this.options,i));return this.renderer.render(r,this.options,i)},r.exports=t},{"./defaults":5,"./parser_block":9,"./parser_inline":10,"./renderer":12,"object-assign":36}],8:[function(e,r){"use strict";function t(e,r){var t,s,n,i,o=-1,l=e.posMax,a=e.pos,c=e.tokens.length,u=e.pending,p=e.validateInsideLink;if(e.validateInsideLink)return-1;for(e.pos=r+1,e.validateInsideLink=!0,t=1;e.posr;){if(t=e.src.charCodeAt(r),10===t)return!1;if(62===t)return e.pos=r+1,e.link_content=i,!0;92===t&&n>r+1?(r++,i+=e.src[r++]):i+=e.src[r++]}return!1}for(s=0;n>r&&(t=e.src.charCodeAt(r),32!==t)&&!(32>t||127===t);)if(92===t&&n>r+1)r++,i+=e.src[r++];else{if(40===t&&(s++,s>1))break;if(41===t&&(s--,0>s))break;i+=e.src[r++]}return i.length?(e.pos=r,e.link_content=i,!0):!1}function n(e,r){var t,s,n=e.posMax,i=e.src.charCodeAt(r);if(34!==i&&39!==i&&40!==i)return!1;
+for(r++,t="",40===i&&(i=41);n>r;){if(s=e.src.charCodeAt(r),s===i)return e.pos=r+1,e.link_content=t,!0;92===s&&n>r+1?(r++,t+=e.src[r++]):t+=e.src[r++]}return!1}function i(e){return e.trim().replace(/\s+/g," ").toLowerCase()}r.exports.parseLinkLabel=t,r.exports.parseLinkDestination=s,r.exports.parseLinkTitle=n,r.exports.normalizeReference=i},{}],9:[function(e,r){"use strict";function t(){this._rules=[],this._rulesParagraphTerm=[],this._rulesBlockquoteTerm=[],this._rulesListTerm=[],this.ruler=new s(this.rulesUpdate.bind(this));for(var e=0;ec)||(e.line=c=i(e,c,t),c>=t)||e.tShift[c]n&&!(s=l[n](e,c,t,!1));n++);if(!s)throw new Error("No matching rules found");if(c===e.line)throw new Error("None of rules updated state.line");if(e.tight=!u,o(e,e.line-1)&&(u=!0),c=e.line,t>c&&o(e,c)){if(u=!0,c++,t>c&&e.listMode&&o(e,c))break;e.line=c}}},t.prototype.parse=function(e,r,t){var s,i=0,o=0;return e?(e.indexOf("\r")>=0&&(e=e.replace(/\r/,"")),e.indexOf(" ")>=0&&(e=e.replace(/\u00a0/g," ")),e.indexOf("")>=0&&(e=e.replace(/\u2424/g,"\n")),e.indexOf(" ")>=0&&(e=e.replace(/[\n\t]/g,function(r,t){var s;return 10===e.charCodeAt(t)?(i=t+1,o=0,r):(s=" ".slice((t-i-o)%4),o=t-i+1,s)})),s=new n(e,this,[],r,t),this.tokenize(s,s.line,s.lineMax),s.tokens):""},r.exports=t},{"./helpers":6,"./ruler":13,"./rules_block/blockquote":14,"./rules_block/code":15,"./rules_block/fences":16,"./rules_block/heading":17,"./rules_block/hr":18,"./rules_block/htmlblock":19,"./rules_block/lheading":20,"./rules_block/list":21,"./rules_block/paragraph":22,"./rules_block/state_block":23,"./rules_block/table":24}],10:[function(e,r){"use strict";function t(){this._rules=[],this.textMatch=/^[^\n\\`*_\[\]!&{}$%@<>"]+/,this.ruler=new s(this.rulesUpdate.bind(this));for(var e=0;et&&!(r=s[t](e));t++);return r},t.prototype.tokenize=function(e){for(var r,t,s=this._rules,n=this._rules.length,i=e.posMax;e.post&&!(r=s[t](e));t++);if(r){if(e.pos>=i)break}else e.pending+=e.src[e.pos++]}return e.pending&&e.pushPending(),e.tokens},t.prototype.parse=function(e,r,t){var s=new n(e,this,r,t);return this.tokenize(s),s.tokens},r.exports=t},{"./ruler":13,"./rules_inline/autolink":25,"./rules_inline/backticks":26,"./rules_inline/emphasis":27,"./rules_inline/entity":28,"./rules_inline/escape":29,"./rules_inline/escape_html_char":30,"./rules_inline/htmltag":31,"./rules_inline/links":32,"./rules_inline/newline":33,"./rules_inline/state_inline":34,"./rules_inline/text":35}],11:[function(e,r){"use strict";var t=e("./rules_inline/state_inline"),s=e("./helpers").skipSpaces,n=e("./links").parseLinkLabel,i=e("./links").parseLinkDestination,o=e("./links").parseLinkTitle,l=e("./links").normalizeReference;r.exports=function(e,r,a,c){var u,p,h,f,d,g,b,m,k;if(91!==e.charCodeAt(0))return-1;if(-1===e.indexOf("]:"))return-1;if(u=new t(e,r,a,c),p=n(u,0),0>p||58!==e.charCodeAt(p+1))return-1;for(f=u.posMax,h=p+2;f>h&&(d=u.src.charCodeAt(h),32===d||10===d);h++);if(!i(u,h))return-1;for(b=u.link_content,h=u.pos,g=h,h+=1;f>h&&(d=u.src.charCodeAt(h),32===d||10===d);h++);return f>h&&g!==h&&o(u,h)?(m=u.link_content,h=u.pos):(m="",h=g),h=s(u,h),f>h&&10!==u.src.charCodeAt(h)?-1:(k=l(e.slice(1,p)),c.references[k]=c.references[k]||{title:m,href:b},h)}},{"./helpers":6,"./links":8,"./rules_inline/state_inline":34}],12:[function(e,r){"use strict";function t(e){try{return encodeURI(e)}catch(r){}return""}function s(e){try{return decodeURI(e)}catch(r){}return""}function n(e,r){return++r\n"},u.blockquote_close=function(e,r){return""+n(e,r)},u.code=function(e,r){return e[r].block?""+l(e[r].content)+"
"+n(e,r):""+l(e[r].content)+"
"},u.fence=function(e,r,t){var s,i,o=e[r],u="",p=t.langPrefix||"",h="";return o.params&&(s=o.params.split(/ +/g),h=l(c(a(s[0]))),u=' class="'+p+h+'"'),i=t.highlight(o.content,h)||l(o.content),""+i+"
"+n(e,r)},u.heading_open=function(e,r){return""},u.heading_close=function(e,r){return"\n"},u.hr=function(e,r,t){return(t.xhtml?"
":"
")+n(e,r)},u.bullet_list_open=function(){return"\n"},u.bullet_list_close=function(e,r){return"
"+n(e,r)},u.list_item_open=function(){return""},u.list_item_close=function(){return"\n"},u.ordered_list_open=function(e,r){var t=e[r];return"1?' start="'+t.order+'"':"")+">\n"},u.ordered_list_close=function(e,r){return"
"+n(e,r)},u.paragraph_open=function(){return""},u.paragraph_close=function(e,r){return"
"+n(e,r)},u.link_open=function(e,r){var n=e[r].title?' title="'+l(c(e[r].title))+'"':"";return'"},u.link_close=function(){return""},u.image=function(e,r,s){var n=' src="'+l(t(e[r].src))+'"',i=e[r].title?' title="'+l(c(e[r].title))+'"':"",o=' alt="'+(e[r].alt?l(c(e[r].alt)):"")+'"',a=s.xhtml?" /":"";return""},u.table_open=function(){return"\n"},u.table_close=function(){return"
\n"},u.tr_open=function(){return"\n"},u.tr_close=function(){return"
\n"},u.th_open=function(e,r){var t=e[r];return""},u.th_close=function(){return" | \n"},u.td_open=function(e,r){var t=e[r];return""},u.td_close=function(){return" | \n"},u.strong_open=function(){return""},u.strong_close=function(){return""},u.em_open=function(){return""},u.em_close=function(){return""},u.hardbreak=function(e,r,t){return t.xhtml?"
\n":"
\n"},u.softbreak=function(e,r,t){return t.breaks?t.xhtml?"
\n":"
\n":"\n"},u.text=function(e,r){return e[r].content},u.htmlblock=function(e,r){return e[r].content},u.htmltag=function(e,r){return e[r].content},i.prototype.render=function(e,r){var t,s,n,i,o,l="",a=this.rules,c=[],u=!1;for(t=0,s=e.length;s>t;t++)if(i=e[t].type,n=a[i],("ordered_list_open"===i||"bullet_list_open"===i)&&(c.push(u),u=e[t].tight),("ordered_list_close"===i||"bullet_list_close"===i)&&(u=c.pop()),"blockquote_open"===i&&(c.push(u),u=!1),"blockquote_close"===i&&(u=c.pop()),"paragraph_open"!==i||!u)if("paragraph_close"===i&&u)t+1=0&&r.push(t.fn)}),r):(this.rules.forEach(function(e){r.push(e.fn)}),r)},r.exports=i},{}],14:[function(e,r){"use strict";var t=e("../helpers").skipSpaces;r.exports=function(e,r,s,n){var i,o,l,a,c,u,p,h,f,d=e.parser._rulesBlockquoteTerm,g=e.bMarks[r]+e.tShift[r],b=e.eMarks[r];if(g>b)return!1;if(62!==e.src.charCodeAt(g++))return!1;if(e.level>=e.options.maxLevel)return!1;if(n)return!0;for(32===e.src.charCodeAt(g)&&g++,e.bqMarks[r]++,e.bqLevel++,c=e.blkIndent,e.blkIndent=0,a=[e.bMarks[r]],e.bMarks[r]=g,g=b>g?t(e,g):g,o=g>=b,l=[e.tShift[r]],e.tShift[r]=g-e.bMarks[r],i=r+1;s>i&&(g=e.bMarks[i]+e.tShift[i],b=e.eMarks[i],!(g>=b));i++)if(62!==e.src.charCodeAt(g++)){if(o)break;for(f=!1,p=0,h=d.length;h>p;p++)if(d[p](e,i,s,!0)){f=!0;break}if(f)break;a.push(e.bMarks[i]),l.push(e.tShift[i])}else e.bqMarks[i]++,32===e.src.charCodeAt(g)&&g++,a.push(e.bMarks[i]),e.bMarks[i]=g,g=b>g?t(e,g):g,o=g>=b,l.push(e.tShift[i]),e.tShift[i]=g-e.bMarks[i];for(u=e.listMode,e.listMode=!1,e.tokens.push({type:"blockquote_open",level:e.level++}),e.parser.tokenize(e,r,i),e.tokens.push({type:"blockquote_close",level:--e.level}),e.listMode=u,p=0;po&&!(e.bqMarks[o]=4))break;o++,l=o}return i?!0:(e.tokens.push({type:"code",content:s(e,r,l,4+e.blkIndent,!0),block:!0,level:e.level}),e.line=o,!0)}},{"../helpers":6}],16:[function(e,r){"use strict";var t=e("../helpers").skipSpaces,s=e("../helpers").skipChars,n=e("../helpers").getLines;r.exports=function(e,r,i,o){var l,a,c,u,p,h=!1,f=e.bMarks[r]+e.tShift[r],d=e.eMarks[r];if(f+3>d)return!1;if(l=e.src.charCodeAt(f),126!==l&&96!==l)return!1;if(p=f,f=s(e,f,l),a=f-p,3>a)return!1;if(c=e.src.slice(f,d).trim(),c.indexOf("`")>=0)return!1;if(o)return!0;for(u=r;(u++,!(u>=i))&&(f=p=e.bMarks[u]+e.tShift[u],d=e.eMarks[u],!(d>f&&e.tShift[u]f&&e.bqMarks[u]f-p||(f=t(e,f),d>f)))){h=!0;break}return a=e.tShift[r],e.tokens.push({type:"fence",params:c,content:n(e,r+1,u,a,!0),level:e.level}),e.line=u+(h?1:0),!0}},{"../helpers":6}],17:[function(e,r){"use strict";var t=e("../helpers").isWhiteSpace,s=e("../helpers").skipSpaces,n=e("../helpers").skipCharsBack;r.exports=function(e,r,i,o){var l,a,c=e.bMarks[r]+e.tShift[r],u=e.eMarks[r];if(c>=u)return!1;if(l=e.src.charCodeAt(c),35!==l||c>=u)return!1;for(a=1,l=e.src.charCodeAt(++c);35===l&&u>c&&6>=a;)a++,l=e.src.charCodeAt(++c);return a>6||u>c&&!t(l)?!1:(c=s(e,c),u=n(e,u,32,c),u=n(e,u,35,c),uc&&e.tokens.push({type:"inline",content:e.src.slice(c,u).trim(),level:e.level+1}),e.tokens.push({type:"heading_close",hLevel:a,level:e.level}),e.line=r+1,!0))}},{"../helpers":6}],18:[function(e,r){"use strict";var t=e("../helpers").isWhiteSpace;r.exports=function(e,r,s,n){var i,o,l,a=e.bMarks[r],c=e.eMarks[r];if(a+=e.tShift[r],a>c)return!1;if(i=e.src.charCodeAt(a++),42!==i&&45!==i&&95!==i)return!1;for(o=1;c>a;){if(l=e.src.charCodeAt(a++),l!==i&&!t(l))return!1;l===i&&o++}return 3>o?!1:n?!0:(e.tokens.push({type:"hr",level:e.level}),e.line=r+1,!0)}},{"../helpers":6}],19:[function(e,r){"use strict";function t(e){var r=32|e;return r>=97&&122>=r}var s=e("../helpers").isEmpty,n=e("../helpers").getLines,i=e("../common/html_blocks"),o=/^<([a-zA-Z]{1,15})[\s\/>]/,l=/^<\/([a-zA-Z]{1,15})[\s>]/;r.exports=function(e,r,a,c){var u,p,h,f=e.bMarks[r],d=e.eMarks[r],g=e.tShift[r];if(f+=g,!e.options.html)return!1;if(g>3||f+2>=d||e.blkLevel>0)return!1;if(60!==e.src.charCodeAt(f))return!1;if(u=e.src.charCodeAt(f+1),33===u||63===u){if(c)return!0}else{if(47!==u&&!t(u))return!1;if(47===u){if(p=e.src.slice(f,d).match(l),!p)return!1}else if(p=e.src.slice(f,d).match(o),!p)return!1;if(i.indexOf(p[1].toLowerCase())<0)return!1;if(c)return!0}for(h=r+1;h=i?!1:e.tShift[u]3?!1:(a=e.bMarks[u]+e.tShift[u],c=e.eMarks[u],l=e.src.charCodeAt(a),45!==l&&61!==l?!1:(a=s(e,a,l),a=t(e,a),c>a?!1:o?!0:(a=e.bMarks[r]+e.tShift[r],c=n(e,e.eMarks[r],32,a),e.tokens.push({type:"heading_open",hLevel:61===l?1:2,level:e.level}),e.tokens.push({type:"inline",content:e.src.slice(a,c).trim(),level:e.level+1}),e.tokens.push({type:"heading_close",hLevel:61===l?1:2,level:e.level}),e.line=u+1,!0)))}},{"../helpers":6}],21:[function(e,r){"use strict";function t(e,r){var t,s,n;return s=e.bMarks[r]+e.tShift[r],n=e.eMarks[r],s>=n?-1:(t=e.src.charCodeAt(s++),42!==t&&45!==t&&43!==t?-1:n>s&&32!==e.src.charCodeAt(s)?-1:s)}function s(e,r){var t,s=e.bMarks[r]+e.tShift[r],n=e.eMarks[r];if(s+1>=n)return-1;if(t=e.src.charCodeAt(s++),48>t||t>57)return-1;for(;;){if(s>=n)return-1;if(t=e.src.charCodeAt(s++),!(t>=48&&57>=t)){if(41===t||46===t)break;return-1}}return n>s&&32!==e.src.charCodeAt(s)?-1:s}var n=e("../helpers").isEmpty,i=e("../helpers").skipSpaces;r.exports=function(e,r,o,l){var a,c,u,p,h,f,d,g,b,m,k,v,q,y,w,x,_,A,L,S=e.parser._rulesListTerm;if((g=s(e,r))>=0)q=!0;else{if(!((g=t(e,r))>=0))return!1;q=!1}if(e.level>=e.options.maxLevel)return!1;if(v=e.src.charCodeAt(g-1),l)return!0;for(w=e.tokens.length,q?(d=e.bMarks[r]+e.tShift[r],k=Number(e.src.substr(d,g-d-1)),e.tokens.push({type:"ordered_list_open",order:k,tight:!0,level:e.level++})):e.tokens.push({type:"bullet_list_open",tight:!0,level:e.level++}),a=r,x=!1;o>a&&(y=i(e,g),b=e.eMarks[a],m=y>=b?1:y-g,m>4&&(m=1),1>m&&(m=1),c=g-e.bMarks[a]+m,e.tokens.push({type:"list_item_open",level:e.level++}),p=e.blkIndent,h=e.tight,u=e.tShift[r],f=e.listMode,e.tShift[r]=y-e.bMarks[r],e.blkIndent=c,e.tight=!0,e.listMode=!0,e.parser.tokenize(e,r,o,!0),(!e.tight||x)&&(e.tokens[w].tight=!1),x=e.line-r>1&&n(e,e.line-1),e.blkIndent=p,e.tShift[r]=u,e.tight=h,e.listMode=f,e.tokens.push({type:"list_item_close",level:--e.level}),a=r=e.line,y=e.bMarks[r],!(a>=o));){if(n(e,a)){if(a>=o||n(e,a))break;a++}if(e.tShift[a]_;_++)if(S[_](e,a,o,!0)){L=!0;break}if(L)break;if(q){if(g=s(e,a),0>g)break}else if(g=t(e,a),0>g)break;if(v!==e.src.charCodeAt(g-1))break}return e.tokens.push(q?{type:"ordered_list_close",level:--e.level}:{type:"bullet_list_close",level:--e.level}),e.line=a,!0}},{"../helpers":6}],22:[function(e,r){"use strict";var t=e("../helpers").isEmpty,s=e("../helpers").getLines,n=e("../parser_ref");r.exports=function(e,r){var i,o,l,a,c,u,p=r+1,h=e.parser._rulesParagraphTerm;for(i=e.lineMax;i>p&&!t(e,p);p++)if(!(e.tShift[p]-e.blkIndent>3)){for(a=!1,c=0,u=h.length;u>c;c++)if(h[c](e,p,i,!0)){a=!0;break}if(a)break}for(o=s(e,r,p,e.blkIndent,!1).trim();o.length&&(l=n(o,e.parser.inline,e.options,e.env),!(0>l));)o=o.slice(l).trim();return o.length&&(e.tokens.push({type:"paragraph_open",level:e.level}),e.tokens.push({type:"inline",content:o,level:e.level+1}),e.tokens.push({type:"paragraph_close",level:e.level})),e.line=p,!0}},{"../helpers":6,"../parser_ref":11}],23:[function(e,r){"use strict";function t(e,r,t,s,n){var i,o,l,a,c,u,p;for(this.src=e,this.parser=r,this.options=s,this.env=n,this.tokens=t,this.bMarks=[],this.eMarks=[],this.tShift=[],o=this.src,u=0,p=!1,l=a=u=0,c=o.length;c>a;a++)i=o.charCodeAt(a),p||32!==i||u++,p||32===i||(this.tShift.push(u),p=!0),(13===i||10===i)&&(this.bMarks.push(l),this.eMarks.push(a),p=!1,u=0,l=a+1),13===i&&c>a&&10===o.charCodeAt(a)&&(a++,l++);for((13!==i||10!==i)&&(this.bMarks.push(l),this.eMarks.push(c),this.tShift.push(u)),this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.pos=0,this.blkLevel=0,this.blkIndent=0,this.line=0,this.lineMax=this.bMarks.length-1,this.tight=!1,this.listMode=!1,this.bqLevel=0,this.bqMarks=[],l=0;ls)return!1;if(i=e.src.charCodeAt(e.bMarks[r+1]+e.tShift[r+1]),124!==i&&45!==i)return!1;if(l=t(e,r+1,/^ *\|?(( *[:-]-+[:-] *\|)+( *[:-]-+[:-] *))\|? *$/),!l)return!1;for(p=l[1].split("|"),h=[],a=0;ac&&(u=t(e,c,/^ *\|?(.*?\|.*?)\|? *$/),u);c++){for(p=u[1].split("|"),e.tokens.push({type:"tr_open",level:e.level++}),a=0;a/,i=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;r.exports=function(e){var r,o,l,a=e.pos;return 60!==e.src.charCodeAt(a)?!1:(r=e.src.slice(a),r.indexOf(">")<0?!1:(o=r.match(i))?s.indexOf(o[1].toLowerCase())<0?!1:(e.push({type:"link_open",href:o[0].slice(1,-1),level:e.level}),e.push({type:"text",content:t(o[0].slice(1,-1)),level:e.level+1}),e.push({type:"link_close",level:e.level}),e.pos+=o[0].length,!0):(l=r.match(n),l?(e.push({type:"link_open",href:"mailto:"+l[0].slice(1,-1),level:e.level}),e.push({type:"text",content:t(l[0].slice(1,-1)),level:e.level+1}),e.push({type:"link_close",level:e.level}),e.pos+=l[0].length,!0):!1))}},{"../common/url_schemas":4,"../helpers":6}],26:[function(e,r){var t=/`+/g;r.exports=function(e){var r,s,n,i,o,l=e.pos,a=e.src.charCodeAt(l);if(96!==a)return!1;for(r=l,l++,n=e.posMax;n>l&&96===e.src.charCodeAt(l);)l++;for(i=e.src.slice(r,l),t=/`+/g,t.lastIndex=l;null!==(o=t.exec(e.src));)if(o[0].length===i.length)return s=e.src.slice(l,t.lastIndex-i.length),e.push({type:"code",content:s.replace(/[ \n]+/g," ").trim(),block:!1,level:e.level}),e.pos+=2*i.length+s.length,!0;return e.pending+=i,e.pos+=i.length,!0}},{}],27:[function(e,r){"use strict";function t(e){return e>=48&&57>=e||e>=65&&90>=e||e>=97&&122>=e}function s(e,r){var s,n,i=r,o=Math.min(e.posMax,i+4),l=e.src.charCodeAt(r);if(s=0!==e.pending.length?e.pending.charCodeAt(e.pending.length-1):-1,s===l)return-1;for(;o>i&&e.src.charCodeAt(i)===l;)i++;return i>=o?-1:(n=i-r,n>=4?n:32===e.src.charCodeAt(i)?-1:95===l&&t(s)?-1:n)}function n(e,r){var s,n,i=r,o=Math.min(e.posMax,i+4),l=e.src.charCodeAt(r);for(s=0!==e.pending.length?e.pending.charCodeAt(e.pending.length-1):-1;o>i&&e.src.charCodeAt(i)===l;)i++;return n=i-r,n>=4?n:32===s?-1:95===l&&o>i&&t(e.src.charCodeAt(i))?-1:n}r.exports=function(e){var r,t,i,o,l,a,c,u,p,h,f,d,g=e.posMax,b=e.pos,m=e.src.charCodeAt(b);if(95!==m&&42!==m)return!1;if(e.validateInsideEm||e.validateInsideLink)return!1;if(r=s(e,b),0>r)return!1;if(r>=4)return e.pos+=r,e.pending+=e.src.slice(b,r),!0;if(e.level>=e.options.maxLevel)return!1;for(i=e.tokens.length,o=e.pending,l=e.validateInsideEm,e.pos=b+r,h=[r],e.validateInsideEm=!0;e.pos=1&&4>t){for(u=h.pop(),p=t;u!==p;){if(3===u){h.push(3-p);break}if(u>p){f=!0;break}if(p-=u,0===h.length)break;e.pos+=u,u=h.pop()}if(f)break;if(0===h.length){r=u,a=!0;break}e.pos+=t;continue}if(t=s(e,e.pos),t>=1){h.push(t),e.pos+=t;continue}}c=e.parser.tokenizeSingle(e),c?d=!1:(d=e.src.charCodeAt(e.pos)===m,e.pending+=e.src[e.pos],e.pos++)}return e.tokens.length=i,e.pending=o,e.validateInsideEm=l,a?(e.posMax=e.pos,e.pos=b+r,(2===r||3===r)&&e.push({type:"strong_open",level:e.level++}),(1===r||3===r)&&e.push({type:"em_open",level:e.level++}),e.parser.tokenize(e),(1===r||3===r)&&e.push({type:"em_close",level:--e.level}),(2===r||3===r)&&e.push({type:"strong_close",level:--e.level}),e.pos=e.posMax+r,e.posMax=g,!0):(e.pos=b,!1)}},{}],28:[function(e,r){"use strict";var t=e("../common/entities"),s=e("../helpers").escapeHtml,n=e("../helpers").isValidEntityCode,i=e("../helpers").fromCodePoint,o=/^((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,l=/^&([a-z][a-z0-9]{1,31});/i;r.exports=function(e){var r,a,c,u=e.pos,p=e.posMax;if(38!==e.src.charCodeAt(u))return!1;if(p>u+1)if(r=e.src.charCodeAt(u+1),35===r){if(c=e.src.slice(u).match(o))return a="x"===c[1][0].toLowerCase()?parseInt(c[1].slice(1),16):parseInt(c[1],10),e.pending+=n(a)?s(i(a)):i(65533),e.pos+=c[0].length,!0}else if(c=e.src.slice(u).match(l),c&&t.hasOwnProperty(c[1]))return e.pending+=s(t[c[1]]),e.pos+=c[0].length,!0;return e.pending+="&",e.pos++,!0}},{"../common/entities":1,"../helpers":6}],29:[function(e,r){var t="\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").map(function(e){return e.charCodeAt(0)});r.exports=function(e){var r,s=e.pos,n=e.posMax;if(92!==e.src.charCodeAt(s))return!1;if(s++,n>s){if(r=e.src.charCodeAt(s),t.indexOf(r)>=0)return e.pending+=38===r?"&":60===r?"<":62===r?">":34===r?""":e.src[s],e.pos+=2,!0;if(10===r){for(e.push({type:"hardbreak",level:e.level}),s++;n>s&&32===e.src.charCodeAt(s);)s++;return e.pos=s,!0}}return e.pending+="\\",e.pos++,!0}},{}],30:[function(e,r){r.exports=function(e){var r=e.src.charCodeAt(e.pos);if(60===r)e.pending+="<";else if(62===r)e.pending+=">";else{if(34!==r)return!1;e.pending+="""}return e.pos++,!0}},{}],31:[function(e,r){"use strict";function t(e){var r=32|e;return r>=97&&122>=r}var s=e("../common/html_re").HTML_TAG_RE;r.exports=function(e){var r,n,i,o=e.pos;return e.options.html?(i=e.posMax,60!==e.src.charCodeAt(o)||o+2>=i?!1:(r=e.src.charCodeAt(o+1),(33===r||63===r||47===r||t(r))&&(n=e.src.slice(o).match(s))?(e.push({type:"htmltag",content:e.src.slice(o,o+n[0].length),level:e.level}),e.pos+=n[0].length,!0):!1)):!1}},{"../common/html_re":3}],32:[function(e,r){"use strict";function t(e){var r,t,l,a,c,u,p,h,f=!1,d=e.posMax,g=e.pos,b=e.src.charCodeAt(g);if(33===b&&(f=!0,b=e.src.charCodeAt(++g)),91!==b)return!1;if(e.level>=e.options.maxLevel)return!1;if(r=g+1,t=s(e,g),0>t)return!1;if(u=t+1,d>u&&40===e.src.charCodeAt(u)){for(u++;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);if(u>=d)return!1;for(g=u,n(e,u)?(a=e.link_content,u=e.pos):a="",g=u;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);if(d>u&&g!==u&&i(e,u))for(c=e.link_content,u=e.pos;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);else c="";if(u>=d||41!==e.src.charCodeAt(u))return e.pos=r-1,!1;u++}else{for(;d>u&&(h=e.src.charCodeAt(u),32===h||10===h);u++);if(d>u&&91===e.src.charCodeAt(u)&&(g=u+1,u=s(e,u),u>=0?l=e.src.slice(g,u++):u=g-1),l||(l=e.src.slice(r,t)),p=e.env.references[o(l)],!p)return e.pos=r-1,!1;a=p.href,c=p.title}return e.pos=r,e.posMax=t,f?e.push({type:"image",src:a,title:c,alt:e.src.substr(r,t-r),level:e.level}):(e.push({type:"link_open",href:a,title:c,level:e.level++}),e.parser.tokenize(e),e.push({type:"link_close",level:--e.level})),e.pos=u,e.posMax=d,!0}var s=e("../links").parseLinkLabel,n=e("../links").parseLinkDestination,i=e("../links").parseLinkTitle,o=e("../links").normalizeReference;r.exports=t},{"../links":8}],33:[function(e,r){r.exports=function(e){var r,t,s=e.pos;if(10!==e.src.charCodeAt(s))return!1;for(r=e.pending.length-1,t=e.posMax,r>=0&&32===e.pending.charCodeAt(r)?r>=1&&32===e.pending.charCodeAt(r-1)?(e.pending=e.pending.replace(/ +$/,""),e.push({type:"hardbreak",level:e.level})):(e.pending=e.pending.slice(0,-1),e.push({type:"softbreak",level:e.level})):e.push({type:"softbreak",level:e.level}),s++;t>s&&32===e.src.charCodeAt(s);)s++;return e.pos=s,!0}},{}],34:[function(e,r){"use strict";function t(e,r,t,s){this.src=e,this.env=s,this.options=t,this.parser=r,this.tokens=[],this.pos=0,this.pending="",this.posMax=this.src.length,this.validateInsideEm=!1,this.validateInsideLink=!1,this.level=0,this.link_content="",this.pendingLevel=0}t.prototype.pushPending=function(){var e=this.pending;this.tokens.push({type:"text",content:e,level:this.pendingLevel}),this.pending=""},t.prototype.push=function(e){this.pending&&this.pushPending(),this.tokens.push(e),this.pendingLevel=this.level},r.exports=t},{}],35:[function(e,r){r.exports=function(e){var r=e.src.slice(e.pos).match(e.parser.textMatch);return r?(e.pending+=r[0],e.pos+=r[0].length,!0):!1}},{}],36:[function(e,r){"use strict";function t(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}r.exports=Object.assign||function(e){for(var r,s,n,i=t(e),o=1;o