- commit
- 19513bcb04998ba5cb2b01b0b006d6c7f75eb904
- parent
- 59efd0f53685a7059704db2f7a4751d0e22d0c8b
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2017-11-18 09:44
render markdown on the server also use a more django/mustache-like template syntax
Diffstat
| M | Makefile | 5 | +---- |
| M | app.js | 18 | +++++++++++++----- |
| M | package.json | 2 | +- |
| D | static/markdown.js | 7725 | ------------------------------------------------------------ |
| D | static/src/markdown.js | 5 | ----- |
| M | tpl/app.html | 4 | ++-- |
| M | tpl/markdown.html | 3 | +-- |
7 files changed, 18 insertions, 7744 deletions
diff --git a/Makefile b/Makefile
@@ -1,11 +1,8 @@1 -1 all: static/voterunner.js static/markdown.js static/style.css-1 1 all: static/voterunner.js static/style.css 2 2 3 3 static/voterunner.js: static/src/voterunner.js 4 4 browserify $< -o $@ 5 56 -1 static/markdown.js: static/src/markdown.js7 -1 browserify $< -o $@8 -19 6 static/style.css: static/scss/*.scss 10 7 node-sass static/scss/style.scss > $@ 11 8
diff --git a/app.js b/app.js
@@ -17,12 +17,14 @@ var io = require('socket.io').listen(server);
17 17 var anyDB = require('any-db');
18 18 var fs = require('fs');
19 19 var log4js = require('log4js');
-1 20 var MarkdownIt = require('markdown-it');
20 21
21 22 var DATABASE_URL = process.env.DATABASE_URL;
22 23 var PORT = process.env.PORT || 5000;
23 24 var HOST = process.env.HOST || 'localhost';
24 25
25 26 var log = log4js.getLogger();
-1 27 var md = new MarkdownIt();
26 28
27 29 app.use(express.static('static'));
28 30 server.listen(PORT, HOST, function() {
@@ -63,18 +65,24 @@ var escapeHTML = function(unsafe) {
63 65 };
64 66
65 67 var tpl = function(file, data, res) {
66 -1 // `<% key %>` in template `file` will be replaced by `data.key` as json
67 -1 // `<= key =>` in template `file` will be replaced by `data.key` as string
68 68 fs.readFile('tpl/' + file, 'utf8', function(err, html) {
69 -1 html = html.replace(/<% ([^>]*) %>/g, function(match, key) {
-1 69 html = html.replace(/{{{ ([^}]*)\|markdown }}}/g, function(match, key) {
70 70 if (data.hasOwnProperty(key)) {
71 -1 return '<div id="json-' + key + '" data-value="' + escapeHTML(JSON.stringify(data[key])) + '"></div>';
-1 71 return md.render(data[key]);
72 72 } else {
73 73 return '';
74 74 }
75 75 });
76 76
77 -1 html = html.replace(/<= ([^>]*) =>/g, function(match, key) {
-1 77 html = html.replace(/{{ ([^}]*)\|json }}/g, function(match, key) {
-1 78 if (data.hasOwnProperty(key)) {
-1 79 return '<div id="json-' + escapeHTML(key) + '" data-value="' + escapeHTML(JSON.stringify(data[key])) + '"></div>';
-1 80 } else {
-1 81 return '';
-1 82 }
-1 83 });
-1 84
-1 85 html = html.replace(/{{ ([^}]*) }}/g, function(match, key) {
78 86 if (data.hasOwnProperty(key)) {
79 87 return escapeHTML(data[key].toString());
80 88 } else {
diff --git a/package.json b/package.json
@@ -7,10 +7,10 @@ 7 7 "any-db-sqlite3": "^2.1.4", 8 8 "express": "^4.16.2", 9 9 "log4js": "^0.6.38", -1 10 "markdown-it": "^7.0.1", 10 11 "socket.io": "^1.7.4" 11 12 }, 12 13 "devDependencies": {13 -1 "markdown-it": "^7.0.1",14 14 "socket.io-client": "^1.7.4", 15 15 "virtual-dom": "^2.1.1" 16 16 },
diff --git a/static/markdown.js b/static/markdown.js
@@ -1,7725 +0,0 @@1 -1 (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){2 -1 (function (global){3 -1 /*! https://mths.be/punycode v1.4.1 by @mathias */4 -1 ;(function(root) {5 -16 -1 /** Detect free variables */7 -1 var freeExports = typeof exports == 'object' && exports &&8 -1 !exports.nodeType && exports;9 -1 var freeModule = typeof module == 'object' && module &&10 -1 !module.nodeType && module;11 -1 var freeGlobal = typeof global == 'object' && global;12 -1 if (13 -1 freeGlobal.global === freeGlobal ||14 -1 freeGlobal.window === freeGlobal ||15 -1 freeGlobal.self === freeGlobal16 -1 ) {17 -1 root = freeGlobal;18 -1 }19 -120 -1 /**21 -1 * The `punycode` object.22 -1 * @name punycode23 -1 * @type Object24 -1 */25 -1 var punycode,26 -127 -1 /** Highest positive signed 32-bit float value */28 -1 maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-129 -130 -1 /** Bootstring parameters */31 -1 base = 36,32 -1 tMin = 1,33 -1 tMax = 26,34 -1 skew = 38,35 -1 damp = 700,36 -1 initialBias = 72,37 -1 initialN = 128, // 0x8038 -1 delimiter = '-', // '\x2D'39 -140 -1 /** Regular expressions */41 -1 regexPunycode = /^xn--/,42 -1 regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars43 -1 regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators44 -145 -1 /** Error messages */46 -1 errors = {47 -1 'overflow': 'Overflow: input needs wider integers to process',48 -1 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',49 -1 'invalid-input': 'Invalid input'50 -1 },51 -152 -1 /** Convenience shortcuts */53 -1 baseMinusTMin = base - tMin,54 -1 floor = Math.floor,55 -1 stringFromCharCode = String.fromCharCode,56 -157 -1 /** Temporary variable */58 -1 key;59 -160 -1 /*--------------------------------------------------------------------------*/61 -162 -1 /**63 -1 * A generic error utility function.64 -1 * @private65 -1 * @param {String} type The error type.66 -1 * @returns {Error} Throws a `RangeError` with the applicable error message.67 -1 */68 -1 function error(type) {69 -1 throw new RangeError(errors[type]);70 -1 }71 -172 -1 /**73 -1 * A generic `Array#map` utility function.74 -1 * @private75 -1 * @param {Array} array The array to iterate over.76 -1 * @param {Function} callback The function that gets called for every array77 -1 * item.78 -1 * @returns {Array} A new array of values returned by the callback function.79 -1 */80 -1 function map(array, fn) {81 -1 var length = array.length;82 -1 var result = [];83 -1 while (length--) {84 -1 result[length] = fn(array[length]);85 -1 }86 -1 return result;87 -1 }88 -189 -1 /**90 -1 * A simple `Array#map`-like wrapper to work with domain name strings or email91 -1 * addresses.92 -1 * @private93 -1 * @param {String} domain The domain name or email address.94 -1 * @param {Function} callback The function that gets called for every95 -1 * character.96 -1 * @returns {Array} A new string of characters returned by the callback97 -1 * function.98 -1 */99 -1 function mapDomain(string, fn) {100 -1 var parts = string.split('@');101 -1 var result = '';102 -1 if (parts.length > 1) {103 -1 // In email addresses, only the domain name should be punycoded. Leave104 -1 // the local part (i.e. everything up to `@`) intact.105 -1 result = parts[0] + '@';106 -1 string = parts[1];107 -1 }108 -1 // Avoid `split(regex)` for IE8 compatibility. See #17.109 -1 string = string.replace(regexSeparators, '\x2E');110 -1 var labels = string.split('.');111 -1 var encoded = map(labels, fn).join('.');112 -1 return result + encoded;113 -1 }114 -1115 -1 /**116 -1 * Creates an array containing the numeric code points of each Unicode117 -1 * character in the string. While JavaScript uses UCS-2 internally,118 -1 * this function will convert a pair of surrogate halves (each of which119 -1 * UCS-2 exposes as separate characters) into a single code point,120 -1 * matching UTF-16.121 -1 * @see `punycode.ucs2.encode`122 -1 * @see <https://mathiasbynens.be/notes/javascript-encoding>123 -1 * @memberOf punycode.ucs2124 -1 * @name decode125 -1 * @param {String} string The Unicode input string (UCS-2).126 -1 * @returns {Array} The new array of code points.127 -1 */128 -1 function ucs2decode(string) {129 -1 var output = [],130 -1 counter = 0,131 -1 length = string.length,132 -1 value,133 -1 extra;134 -1 while (counter < length) {135 -1 value = string.charCodeAt(counter++);136 -1 if (value >= 0xD800 && value <= 0xDBFF && counter < length) {137 -1 // high surrogate, and there is a next character138 -1 extra = string.charCodeAt(counter++);139 -1 if ((extra & 0xFC00) == 0xDC00) { // low surrogate140 -1 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);141 -1 } else {142 -1 // unmatched surrogate; only append this code unit, in case the next143 -1 // code unit is the high surrogate of a surrogate pair144 -1 output.push(value);145 -1 counter--;146 -1 }147 -1 } else {148 -1 output.push(value);149 -1 }150 -1 }151 -1 return output;152 -1 }153 -1154 -1 /**155 -1 * Creates a string based on an array of numeric code points.156 -1 * @see `punycode.ucs2.decode`157 -1 * @memberOf punycode.ucs2158 -1 * @name encode159 -1 * @param {Array} codePoints The array of numeric code points.160 -1 * @returns {String} The new Unicode string (UCS-2).161 -1 */162 -1 function ucs2encode(array) {163 -1 return map(array, function(value) {164 -1 var output = '';165 -1 if (value > 0xFFFF) {166 -1 value -= 0x10000;167 -1 output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);168 -1 value = 0xDC00 | value & 0x3FF;169 -1 }170 -1 output += stringFromCharCode(value);171 -1 return output;172 -1 }).join('');173 -1 }174 -1175 -1 /**176 -1 * Converts a basic code point into a digit/integer.177 -1 * @see `digitToBasic()`178 -1 * @private179 -1 * @param {Number} codePoint The basic numeric code point value.180 -1 * @returns {Number} The numeric value of a basic code point (for use in181 -1 * representing integers) in the range `0` to `base - 1`, or `base` if182 -1 * the code point does not represent a value.183 -1 */184 -1 function basicToDigit(codePoint) {185 -1 if (codePoint - 48 < 10) {186 -1 return codePoint - 22;187 -1 }188 -1 if (codePoint - 65 < 26) {189 -1 return codePoint - 65;190 -1 }191 -1 if (codePoint - 97 < 26) {192 -1 return codePoint - 97;193 -1 }194 -1 return base;195 -1 }196 -1197 -1 /**198 -1 * Converts a digit/integer into a basic code point.199 -1 * @see `basicToDigit()`200 -1 * @private201 -1 * @param {Number} digit The numeric value of a basic code point.202 -1 * @returns {Number} The basic code point whose value (when used for203 -1 * representing integers) is `digit`, which needs to be in the range204 -1 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is205 -1 * used; else, the lowercase form is used. The behavior is undefined206 -1 * if `flag` is non-zero and `digit` has no uppercase form.207 -1 */208 -1 function digitToBasic(digit, flag) {209 -1 // 0..25 map to ASCII a..z or A..Z210 -1 // 26..35 map to ASCII 0..9211 -1 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);212 -1 }213 -1214 -1 /**215 -1 * Bias adaptation function as per section 3.4 of RFC 3492.216 -1 * https://tools.ietf.org/html/rfc3492#section-3.4217 -1 * @private218 -1 */219 -1 function adapt(delta, numPoints, firstTime) {220 -1 var k = 0;221 -1 delta = firstTime ? floor(delta / damp) : delta >> 1;222 -1 delta += floor(delta / numPoints);223 -1 for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {224 -1 delta = floor(delta / baseMinusTMin);225 -1 }226 -1 return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));227 -1 }228 -1229 -1 /**230 -1 * Converts a Punycode string of ASCII-only symbols to a string of Unicode231 -1 * symbols.232 -1 * @memberOf punycode233 -1 * @param {String} input The Punycode string of ASCII-only symbols.234 -1 * @returns {String} The resulting string of Unicode symbols.235 -1 */236 -1 function decode(input) {237 -1 // Don't use UCS-2238 -1 var output = [],239 -1 inputLength = input.length,240 -1 out,241 -1 i = 0,242 -1 n = initialN,243 -1 bias = initialBias,244 -1 basic,245 -1 j,246 -1 index,247 -1 oldi,248 -1 w,249 -1 k,250 -1 digit,251 -1 t,252 -1 /** Cached calculation results */253 -1 baseMinusT;254 -1255 -1 // Handle the basic code points: let `basic` be the number of input code256 -1 // points before the last delimiter, or `0` if there is none, then copy257 -1 // the first basic code points to the output.258 -1259 -1 basic = input.lastIndexOf(delimiter);260 -1 if (basic < 0) {261 -1 basic = 0;262 -1 }263 -1264 -1 for (j = 0; j < basic; ++j) {265 -1 // if it's not a basic code point266 -1 if (input.charCodeAt(j) >= 0x80) {267 -1 error('not-basic');268 -1 }269 -1 output.push(input.charCodeAt(j));270 -1 }271 -1272 -1 // Main decoding loop: start just after the last delimiter if any basic code273 -1 // points were copied; start at the beginning otherwise.274 -1275 -1 for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {276 -1277 -1 // `index` is the index of the next character to be consumed.278 -1 // Decode a generalized variable-length integer into `delta`,279 -1 // which gets added to `i`. The overflow checking is easier280 -1 // if we increase `i` as we go, then subtract off its starting281 -1 // value at the end to obtain `delta`.282 -1 for (oldi = i, w = 1, k = base; /* no condition */; k += base) {283 -1284 -1 if (index >= inputLength) {285 -1 error('invalid-input');286 -1 }287 -1288 -1 digit = basicToDigit(input.charCodeAt(index++));289 -1290 -1 if (digit >= base || digit > floor((maxInt - i) / w)) {291 -1 error('overflow');292 -1 }293 -1294 -1 i += digit * w;295 -1 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);296 -1297 -1 if (digit < t) {298 -1 break;299 -1 }300 -1301 -1 baseMinusT = base - t;302 -1 if (w > floor(maxInt / baseMinusT)) {303 -1 error('overflow');304 -1 }305 -1306 -1 w *= baseMinusT;307 -1308 -1 }309 -1310 -1 out = output.length + 1;311 -1 bias = adapt(i - oldi, out, oldi == 0);312 -1313 -1 // `i` was supposed to wrap around from `out` to `0`,314 -1 // incrementing `n` each time, so we'll fix that now:315 -1 if (floor(i / out) > maxInt - n) {316 -1 error('overflow');317 -1 }318 -1319 -1 n += floor(i / out);320 -1 i %= out;321 -1322 -1 // Insert `n` at position `i` of the output323 -1 output.splice(i++, 0, n);324 -1325 -1 }326 -1327 -1 return ucs2encode(output);328 -1 }329 -1330 -1 /**331 -1 * Converts a string of Unicode symbols (e.g. a domain name label) to a332 -1 * Punycode string of ASCII-only symbols.333 -1 * @memberOf punycode334 -1 * @param {String} input The string of Unicode symbols.335 -1 * @returns {String} The resulting Punycode string of ASCII-only symbols.336 -1 */337 -1 function encode(input) {338 -1 var n,339 -1 delta,340 -1 handledCPCount,341 -1 basicLength,342 -1 bias,343 -1 j,344 -1 m,345 -1 q,346 -1 k,347 -1 t,348 -1 currentValue,349 -1 output = [],350 -1 /** `inputLength` will hold the number of code points in `input`. */351 -1 inputLength,352 -1 /** Cached calculation results */353 -1 handledCPCountPlusOne,354 -1 baseMinusT,355 -1 qMinusT;356 -1357 -1 // Convert the input in UCS-2 to Unicode358 -1 input = ucs2decode(input);359 -1360 -1 // Cache the length361 -1 inputLength = input.length;362 -1363 -1 // Initialize the state364 -1 n = initialN;365 -1 delta = 0;366 -1 bias = initialBias;367 -1368 -1 // Handle the basic code points369 -1 for (j = 0; j < inputLength; ++j) {370 -1 currentValue = input[j];371 -1 if (currentValue < 0x80) {372 -1 output.push(stringFromCharCode(currentValue));373 -1 }374 -1 }375 -1376 -1 handledCPCount = basicLength = output.length;377 -1378 -1 // `handledCPCount` is the number of code points that have been handled;379 -1 // `basicLength` is the number of basic code points.380 -1381 -1 // Finish the basic string - if it is not empty - with a delimiter382 -1 if (basicLength) {383 -1 output.push(delimiter);384 -1 }385 -1386 -1 // Main encoding loop:387 -1 while (handledCPCount < inputLength) {388 -1389 -1 // All non-basic code points < n have been handled already. Find the next390 -1 // larger one:391 -1 for (m = maxInt, j = 0; j < inputLength; ++j) {392 -1 currentValue = input[j];393 -1 if (currentValue >= n && currentValue < m) {394 -1 m = currentValue;395 -1 }396 -1 }397 -1398 -1 // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,399 -1 // but guard against overflow400 -1 handledCPCountPlusOne = handledCPCount + 1;401 -1 if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {402 -1 error('overflow');403 -1 }404 -1405 -1 delta += (m - n) * handledCPCountPlusOne;406 -1 n = m;407 -1408 -1 for (j = 0; j < inputLength; ++j) {409 -1 currentValue = input[j];410 -1411 -1 if (currentValue < n && ++delta > maxInt) {412 -1 error('overflow');413 -1 }414 -1415 -1 if (currentValue == n) {416 -1 // Represent delta as a generalized variable-length integer417 -1 for (q = delta, k = base; /* no condition */; k += base) {418 -1 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);419 -1 if (q < t) {420 -1 break;421 -1 }422 -1 qMinusT = q - t;423 -1 baseMinusT = base - t;424 -1 output.push(425 -1 stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))426 -1 );427 -1 q = floor(qMinusT / baseMinusT);428 -1 }429 -1430 -1 output.push(stringFromCharCode(digitToBasic(q, 0)));431 -1 bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);432 -1 delta = 0;433 -1 ++handledCPCount;434 -1 }435 -1 }436 -1437 -1 ++delta;438 -1 ++n;439 -1440 -1 }441 -1 return output.join('');442 -1 }443 -1444 -1 /**445 -1 * Converts a Punycode string representing a domain name or an email address446 -1 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.447 -1 * it doesn't matter if you call it on a string that has already been448 -1 * converted to Unicode.449 -1 * @memberOf punycode450 -1 * @param {String} input The Punycoded domain name or email address to451 -1 * convert to Unicode.452 -1 * @returns {String} The Unicode representation of the given Punycode453 -1 * string.454 -1 */455 -1 function toUnicode(input) {456 -1 return mapDomain(input, function(string) {457 -1 return regexPunycode.test(string)458 -1 ? decode(string.slice(4).toLowerCase())459 -1 : string;460 -1 });461 -1 }462 -1463 -1 /**464 -1 * Converts a Unicode string representing a domain name or an email address to465 -1 * Punycode. Only the non-ASCII parts of the domain name will be converted,466 -1 * i.e. it doesn't matter if you call it with a domain that's already in467 -1 * ASCII.468 -1 * @memberOf punycode469 -1 * @param {String} input The domain name or email address to convert, as a470 -1 * Unicode string.471 -1 * @returns {String} The Punycode representation of the given domain name or472 -1 * email address.473 -1 */474 -1 function toASCII(input) {475 -1 return mapDomain(input, function(string) {476 -1 return regexNonASCII.test(string)477 -1 ? 'xn--' + encode(string)478 -1 : string;479 -1 });480 -1 }481 -1482 -1 /*--------------------------------------------------------------------------*/483 -1484 -1 /** Define the public API */485 -1 punycode = {486 -1 /**487 -1 * A string representing the current Punycode.js version number.488 -1 * @memberOf punycode489 -1 * @type String490 -1 */491 -1 'version': '1.4.1',492 -1 /**493 -1 * An object of methods to convert from JavaScript's internal character494 -1 * representation (UCS-2) to Unicode code points, and back.495 -1 * @see <https://mathiasbynens.be/notes/javascript-encoding>496 -1 * @memberOf punycode497 -1 * @type Object498 -1 */499 -1 'ucs2': {500 -1 'decode': ucs2decode,501 -1 'encode': ucs2encode502 -1 },503 -1 'decode': decode,504 -1 'encode': encode,505 -1 'toASCII': toASCII,506 -1 'toUnicode': toUnicode507 -1 };508 -1509 -1 /** Expose `punycode` */510 -1 // Some AMD build optimizers, like r.js, check for specific condition patterns511 -1 // like the following:512 -1 if (513 -1 typeof define == 'function' &&514 -1 typeof define.amd == 'object' &&515 -1 define.amd516 -1 ) {517 -1 define('punycode', function() {518 -1 return punycode;519 -1 });520 -1 } else if (freeExports && freeModule) {521 -1 if (module.exports == freeExports) {522 -1 // in Node.js, io.js, or RingoJS v0.8.0+523 -1 freeModule.exports = punycode;524 -1 } else {525 -1 // in Narwhal or RingoJS v0.7.0-526 -1 for (key in punycode) {527 -1 punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);528 -1 }529 -1 }530 -1 } else {531 -1 // in Rhino or a web browser532 -1 root.punycode = punycode;533 -1 }534 -1535 -1 }(this));536 -1537 -1 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})538 -1 },{}],2:[function(require,module,exports){539 -1 module.exports={"Aacute":"\u00C1","aacute":"\u00E1","Abreve":"\u0102","abreve":"\u0103","ac":"\u223E","acd":"\u223F","acE":"\u223E\u0333","Acirc":"\u00C2","acirc":"\u00E2","acute":"\u00B4","Acy":"\u0410","acy":"\u0430","AElig":"\u00C6","aelig":"\u00E6","af":"\u2061","Afr":"\uD835\uDD04","afr":"\uD835\uDD1E","Agrave":"\u00C0","agrave":"\u00E0","alefsym":"\u2135","aleph":"\u2135","Alpha":"\u0391","alpha":"\u03B1","Amacr":"\u0100","amacr":"\u0101","amalg":"\u2A3F","amp":"&","AMP":"&","andand":"\u2A55","And":"\u2A53","and":"\u2227","andd":"\u2A5C","andslope":"\u2A58","andv":"\u2A5A","ang":"\u2220","ange":"\u29A4","angle":"\u2220","angmsdaa":"\u29A8","angmsdab":"\u29A9","angmsdac":"\u29AA","angmsdad":"\u29AB","angmsdae":"\u29AC","angmsdaf":"\u29AD","angmsdag":"\u29AE","angmsdah":"\u29AF","angmsd":"\u2221","angrt":"\u221F","angrtvb":"\u22BE","angrtvbd":"\u299D","angsph":"\u2222","angst":"\u00C5","angzarr":"\u237C","Aogon":"\u0104","aogon":"\u0105","Aopf":"\uD835\uDD38","aopf":"\uD835\uDD52","apacir":"\u2A6F","ap":"\u2248","apE":"\u2A70","ape":"\u224A","apid":"\u224B","apos":"'","ApplyFunction":"\u2061","approx":"\u2248","approxeq":"\u224A","Aring":"\u00C5","aring":"\u00E5","Ascr":"\uD835\uDC9C","ascr":"\uD835\uDCB6","Assign":"\u2254","ast":"*","asymp":"\u2248","asympeq":"\u224D","Atilde":"\u00C3","atilde":"\u00E3","Auml":"\u00C4","auml":"\u00E4","awconint":"\u2233","awint":"\u2A11","backcong":"\u224C","backepsilon":"\u03F6","backprime":"\u2035","backsim":"\u223D","backsimeq":"\u22CD","Backslash":"\u2216","Barv":"\u2AE7","barvee":"\u22BD","barwed":"\u2305","Barwed":"\u2306","barwedge":"\u2305","bbrk":"\u23B5","bbrktbrk":"\u23B6","bcong":"\u224C","Bcy":"\u0411","bcy":"\u0431","bdquo":"\u201E","becaus":"\u2235","because":"\u2235","Because":"\u2235","bemptyv":"\u29B0","bepsi":"\u03F6","bernou":"\u212C","Bernoullis":"\u212C","Beta":"\u0392","beta":"\u03B2","beth":"\u2136","between":"\u226C","Bfr":"\uD835\uDD05","bfr":"\uD835\uDD1F","bigcap":"\u22C2","bigcirc":"\u25EF","bigcup":"\u22C3","bigodot":"\u2A00","bigoplus":"\u2A01","bigotimes":"\u2A02","bigsqcup":"\u2A06","bigstar":"\u2605","bigtriangledown":"\u25BD","bigtriangleup":"\u25B3","biguplus":"\u2A04","bigvee":"\u22C1","bigwedge":"\u22C0","bkarow":"\u290D","blacklozenge":"\u29EB","blacksquare":"\u25AA","blacktriangle":"\u25B4","blacktriangledown":"\u25BE","blacktriangleleft":"\u25C2","blacktriangleright":"\u25B8","blank":"\u2423","blk12":"\u2592","blk14":"\u2591","blk34":"\u2593","block":"\u2588","bne":"=\u20E5","bnequiv":"\u2261\u20E5","bNot":"\u2AED","bnot":"\u2310","Bopf":"\uD835\uDD39","bopf":"\uD835\uDD53","bot":"\u22A5","bottom":"\u22A5","bowtie":"\u22C8","boxbox":"\u29C9","boxdl":"\u2510","boxdL":"\u2555","boxDl":"\u2556","boxDL":"\u2557","boxdr":"\u250C","boxdR":"\u2552","boxDr":"\u2553","boxDR":"\u2554","boxh":"\u2500","boxH":"\u2550","boxhd":"\u252C","boxHd":"\u2564","boxhD":"\u2565","boxHD":"\u2566","boxhu":"\u2534","boxHu":"\u2567","boxhU":"\u2568","boxHU":"\u2569","boxminus":"\u229F","boxplus":"\u229E","boxtimes":"\u22A0","boxul":"\u2518","boxuL":"\u255B","boxUl":"\u255C","boxUL":"\u255D","boxur":"\u2514","boxuR":"\u2558","boxUr":"\u2559","boxUR":"\u255A","boxv":"\u2502","boxV":"\u2551","boxvh":"\u253C","boxvH":"\u256A","boxVh":"\u256B","boxVH":"\u256C","boxvl":"\u2524","boxvL":"\u2561","boxVl":"\u2562","boxVL":"\u2563","boxvr":"\u251C","boxvR":"\u255E","boxVr":"\u255F","boxVR":"\u2560","bprime":"\u2035","breve":"\u02D8","Breve":"\u02D8","brvbar":"\u00A6","bscr":"\uD835\uDCB7","Bscr":"\u212C","bsemi":"\u204F","bsim":"\u223D","bsime":"\u22CD","bsolb":"\u29C5","bsol":"\\","bsolhsub":"\u27C8","bull":"\u2022","bullet":"\u2022","bump":"\u224E","bumpE":"\u2AAE","bumpe":"\u224F","Bumpeq":"\u224E","bumpeq":"\u224F","Cacute":"\u0106","cacute":"\u0107","capand":"\u2A44","capbrcup":"\u2A49","capcap":"\u2A4B","cap":"\u2229","Cap":"\u22D2","capcup":"\u2A47","capdot":"\u2A40","CapitalDifferentialD":"\u2145","caps":"\u2229\uFE00","caret":"\u2041","caron":"\u02C7","Cayleys":"\u212D","ccaps":"\u2A4D","Ccaron":"\u010C","ccaron":"\u010D","Ccedil":"\u00C7","ccedil":"\u00E7","Ccirc":"\u0108","ccirc":"\u0109","Cconint":"\u2230","ccups":"\u2A4C","ccupssm":"\u2A50","Cdot":"\u010A","cdot":"\u010B","cedil":"\u00B8","Cedilla":"\u00B8","cemptyv":"\u29B2","cent":"\u00A2","centerdot":"\u00B7","CenterDot":"\u00B7","cfr":"\uD835\uDD20","Cfr":"\u212D","CHcy":"\u0427","chcy":"\u0447","check":"\u2713","checkmark":"\u2713","Chi":"\u03A7","chi":"\u03C7","circ":"\u02C6","circeq":"\u2257","circlearrowleft":"\u21BA","circlearrowright":"\u21BB","circledast":"\u229B","circledcirc":"\u229A","circleddash":"\u229D","CircleDot":"\u2299","circledR":"\u00AE","circledS":"\u24C8","CircleMinus":"\u2296","CirclePlus":"\u2295","CircleTimes":"\u2297","cir":"\u25CB","cirE":"\u29C3","cire":"\u2257","cirfnint":"\u2A10","cirmid":"\u2AEF","cirscir":"\u29C2","ClockwiseContourIntegral":"\u2232","CloseCurlyDoubleQuote":"\u201D","CloseCurlyQuote":"\u2019","clubs":"\u2663","clubsuit":"\u2663","colon":":","Colon":"\u2237","Colone":"\u2A74","colone":"\u2254","coloneq":"\u2254","comma":",","commat":"@","comp":"\u2201","compfn":"\u2218","complement":"\u2201","complexes":"\u2102","cong":"\u2245","congdot":"\u2A6D","Congruent":"\u2261","conint":"\u222E","Conint":"\u222F","ContourIntegral":"\u222E","copf":"\uD835\uDD54","Copf":"\u2102","coprod":"\u2210","Coproduct":"\u2210","copy":"\u00A9","COPY":"\u00A9","copysr":"\u2117","CounterClockwiseContourIntegral":"\u2233","crarr":"\u21B5","cross":"\u2717","Cross":"\u2A2F","Cscr":"\uD835\uDC9E","cscr":"\uD835\uDCB8","csub":"\u2ACF","csube":"\u2AD1","csup":"\u2AD0","csupe":"\u2AD2","ctdot":"\u22EF","cudarrl":"\u2938","cudarrr":"\u2935","cuepr":"\u22DE","cuesc":"\u22DF","cularr":"\u21B6","cularrp":"\u293D","cupbrcap":"\u2A48","cupcap":"\u2A46","CupCap":"\u224D","cup":"\u222A","Cup":"\u22D3","cupcup":"\u2A4A","cupdot":"\u228D","cupor":"\u2A45","cups":"\u222A\uFE00","curarr":"\u21B7","curarrm":"\u293C","curlyeqprec":"\u22DE","curlyeqsucc":"\u22DF","curlyvee":"\u22CE","curlywedge":"\u22CF","curren":"\u00A4","curvearrowleft":"\u21B6","curvearrowright":"\u21B7","cuvee":"\u22CE","cuwed":"\u22CF","cwconint":"\u2232","cwint":"\u2231","cylcty":"\u232D","dagger":"\u2020","Dagger":"\u2021","daleth":"\u2138","darr":"\u2193","Darr":"\u21A1","dArr":"\u21D3","dash":"\u2010","Dashv":"\u2AE4","dashv":"\u22A3","dbkarow":"\u290F","dblac":"\u02DD","Dcaron":"\u010E","dcaron":"\u010F","Dcy":"\u0414","dcy":"\u0434","ddagger":"\u2021","ddarr":"\u21CA","DD":"\u2145","dd":"\u2146","DDotrahd":"\u2911","ddotseq":"\u2A77","deg":"\u00B0","Del":"\u2207","Delta":"\u0394","delta":"\u03B4","demptyv":"\u29B1","dfisht":"\u297F","Dfr":"\uD835\uDD07","dfr":"\uD835\uDD21","dHar":"\u2965","dharl":"\u21C3","dharr":"\u21C2","DiacriticalAcute":"\u00B4","DiacriticalDot":"\u02D9","DiacriticalDoubleAcute":"\u02DD","DiacriticalGrave":"`","DiacriticalTilde":"\u02DC","diam":"\u22C4","diamond":"\u22C4","Diamond":"\u22C4","diamondsuit":"\u2666","diams":"\u2666","die":"\u00A8","DifferentialD":"\u2146","digamma":"\u03DD","disin":"\u22F2","div":"\u00F7","divide":"\u00F7","divideontimes":"\u22C7","divonx":"\u22C7","DJcy":"\u0402","djcy":"\u0452","dlcorn":"\u231E","dlcrop":"\u230D","dollar":"$","Dopf":"\uD835\uDD3B","dopf":"\uD835\uDD55","Dot":"\u00A8","dot":"\u02D9","DotDot":"\u20DC","doteq":"\u2250","doteqdot":"\u2251","DotEqual":"\u2250","dotminus":"\u2238","dotplus":"\u2214","dotsquare":"\u22A1","doublebarwedge":"\u2306","DoubleContourIntegral":"\u222F","DoubleDot":"\u00A8","DoubleDownArrow":"\u21D3","DoubleLeftArrow":"\u21D0","DoubleLeftRightArrow":"\u21D4","DoubleLeftTee":"\u2AE4","DoubleLongLeftArrow":"\u27F8","DoubleLongLeftRightArrow":"\u27FA","DoubleLongRightArrow":"\u27F9","DoubleRightArrow":"\u21D2","DoubleRightTee":"\u22A8","DoubleUpArrow":"\u21D1","DoubleUpDownArrow":"\u21D5","DoubleVerticalBar":"\u2225","DownArrowBar":"\u2913","downarrow":"\u2193","DownArrow":"\u2193","Downarrow":"\u21D3","DownArrowUpArrow":"\u21F5","DownBreve":"\u0311","downdownarrows":"\u21CA","downharpoonleft":"\u21C3","downharpoonright":"\u21C2","DownLeftRightVector":"\u2950","DownLeftTeeVector":"\u295E","DownLeftVectorBar":"\u2956","DownLeftVector":"\u21BD","DownRightTeeVector":"\u295F","DownRightVectorBar":"\u2957","DownRightVector":"\u21C1","DownTeeArrow":"\u21A7","DownTee":"\u22A4","drbkarow":"\u2910","drcorn":"\u231F","drcrop":"\u230C","Dscr":"\uD835\uDC9F","dscr":"\uD835\uDCB9","DScy":"\u0405","dscy":"\u0455","dsol":"\u29F6","Dstrok":"\u0110","dstrok":"\u0111","dtdot":"\u22F1","dtri":"\u25BF","dtrif":"\u25BE","duarr":"\u21F5","duhar":"\u296F","dwangle":"\u29A6","DZcy":"\u040F","dzcy":"\u045F","dzigrarr":"\u27FF","Eacute":"\u00C9","eacute":"\u00E9","easter":"\u2A6E","Ecaron":"\u011A","ecaron":"\u011B","Ecirc":"\u00CA","ecirc":"\u00EA","ecir":"\u2256","ecolon":"\u2255","Ecy":"\u042D","ecy":"\u044D","eDDot":"\u2A77","Edot":"\u0116","edot":"\u0117","eDot":"\u2251","ee":"\u2147","efDot":"\u2252","Efr":"\uD835\uDD08","efr":"\uD835\uDD22","eg":"\u2A9A","Egrave":"\u00C8","egrave":"\u00E8","egs":"\u2A96","egsdot":"\u2A98","el":"\u2A99","Element":"\u2208","elinters":"\u23E7","ell":"\u2113","els":"\u2A95","elsdot":"\u2A97","Emacr":"\u0112","emacr":"\u0113","empty":"\u2205","emptyset":"\u2205","EmptySmallSquare":"\u25FB","emptyv":"\u2205","EmptyVerySmallSquare":"\u25AB","emsp13":"\u2004","emsp14":"\u2005","emsp":"\u2003","ENG":"\u014A","eng":"\u014B","ensp":"\u2002","Eogon":"\u0118","eogon":"\u0119","Eopf":"\uD835\uDD3C","eopf":"\uD835\uDD56","epar":"\u22D5","eparsl":"\u29E3","eplus":"\u2A71","epsi":"\u03B5","Epsilon":"\u0395","epsilon":"\u03B5","epsiv":"\u03F5","eqcirc":"\u2256","eqcolon":"\u2255","eqsim":"\u2242","eqslantgtr":"\u2A96","eqslantless":"\u2A95","Equal":"\u2A75","equals":"=","EqualTilde":"\u2242","equest":"\u225F","Equilibrium":"\u21CC","equiv":"\u2261","equivDD":"\u2A78","eqvparsl":"\u29E5","erarr":"\u2971","erDot":"\u2253","escr":"\u212F","Escr":"\u2130","esdot":"\u2250","Esim":"\u2A73","esim":"\u2242","Eta":"\u0397","eta":"\u03B7","ETH":"\u00D0","eth":"\u00F0","Euml":"\u00CB","euml":"\u00EB","euro":"\u20AC","excl":"!","exist":"\u2203","Exists":"\u2203","expectation":"\u2130","exponentiale":"\u2147","ExponentialE":"\u2147","fallingdotseq":"\u2252","Fcy":"\u0424","fcy":"\u0444","female":"\u2640","ffilig":"\uFB03","fflig":"\uFB00","ffllig":"\uFB04","Ffr":"\uD835\uDD09","ffr":"\uD835\uDD23","filig":"\uFB01","FilledSmallSquare":"\u25FC","FilledVerySmallSquare":"\u25AA","fjlig":"fj","flat":"\u266D","fllig":"\uFB02","fltns":"\u25B1","fnof":"\u0192","Fopf":"\uD835\uDD3D","fopf":"\uD835\uDD57","forall":"\u2200","ForAll":"\u2200","fork":"\u22D4","forkv":"\u2AD9","Fouriertrf":"\u2131","fpartint":"\u2A0D","frac12":"\u00BD","frac13":"\u2153","frac14":"\u00BC","frac15":"\u2155","frac16":"\u2159","frac18":"\u215B","frac23":"\u2154","frac25":"\u2156","frac34":"\u00BE","frac35":"\u2157","frac38":"\u215C","frac45":"\u2158","frac56":"\u215A","frac58":"\u215D","frac78":"\u215E","frasl":"\u2044","frown":"\u2322","fscr":"\uD835\uDCBB","Fscr":"\u2131","gacute":"\u01F5","Gamma":"\u0393","gamma":"\u03B3","Gammad":"\u03DC","gammad":"\u03DD","gap":"\u2A86","Gbreve":"\u011E","gbreve":"\u011F","Gcedil":"\u0122","Gcirc":"\u011C","gcirc":"\u011D","Gcy":"\u0413","gcy":"\u0433","Gdot":"\u0120","gdot":"\u0121","ge":"\u2265","gE":"\u2267","gEl":"\u2A8C","gel":"\u22DB","geq":"\u2265","geqq":"\u2267","geqslant":"\u2A7E","gescc":"\u2AA9","ges":"\u2A7E","gesdot":"\u2A80","gesdoto":"\u2A82","gesdotol":"\u2A84","gesl":"\u22DB\uFE00","gesles":"\u2A94","Gfr":"\uD835\uDD0A","gfr":"\uD835\uDD24","gg":"\u226B","Gg":"\u22D9","ggg":"\u22D9","gimel":"\u2137","GJcy":"\u0403","gjcy":"\u0453","gla":"\u2AA5","gl":"\u2277","glE":"\u2A92","glj":"\u2AA4","gnap":"\u2A8A","gnapprox":"\u2A8A","gne":"\u2A88","gnE":"\u2269","gneq":"\u2A88","gneqq":"\u2269","gnsim":"\u22E7","Gopf":"\uD835\uDD3E","gopf":"\uD835\uDD58","grave":"`","GreaterEqual":"\u2265","GreaterEqualLess":"\u22DB","GreaterFullEqual":"\u2267","GreaterGreater":"\u2AA2","GreaterLess":"\u2277","GreaterSlantEqual":"\u2A7E","GreaterTilde":"\u2273","Gscr":"\uD835\uDCA2","gscr":"\u210A","gsim":"\u2273","gsime":"\u2A8E","gsiml":"\u2A90","gtcc":"\u2AA7","gtcir":"\u2A7A","gt":">","GT":">","Gt":"\u226B","gtdot":"\u22D7","gtlPar":"\u2995","gtquest":"\u2A7C","gtrapprox":"\u2A86","gtrarr":"\u2978","gtrdot":"\u22D7","gtreqless":"\u22DB","gtreqqless":"\u2A8C","gtrless":"\u2277","gtrsim":"\u2273","gvertneqq":"\u2269\uFE00","gvnE":"\u2269\uFE00","Hacek":"\u02C7","hairsp":"\u200A","half":"\u00BD","hamilt":"\u210B","HARDcy":"\u042A","hardcy":"\u044A","harrcir":"\u2948","harr":"\u2194","hArr":"\u21D4","harrw":"\u21AD","Hat":"^","hbar":"\u210F","Hcirc":"\u0124","hcirc":"\u0125","hearts":"\u2665","heartsuit":"\u2665","hellip":"\u2026","hercon":"\u22B9","hfr":"\uD835\uDD25","Hfr":"\u210C","HilbertSpace":"\u210B","hksearow":"\u2925","hkswarow":"\u2926","hoarr":"\u21FF","homtht":"\u223B","hookleftarrow":"\u21A9","hookrightarrow":"\u21AA","hopf":"\uD835\uDD59","Hopf":"\u210D","horbar":"\u2015","HorizontalLine":"\u2500","hscr":"\uD835\uDCBD","Hscr":"\u210B","hslash":"\u210F","Hstrok":"\u0126","hstrok":"\u0127","HumpDownHump":"\u224E","HumpEqual":"\u224F","hybull":"\u2043","hyphen":"\u2010","Iacute":"\u00CD","iacute":"\u00ED","ic":"\u2063","Icirc":"\u00CE","icirc":"\u00EE","Icy":"\u0418","icy":"\u0438","Idot":"\u0130","IEcy":"\u0415","iecy":"\u0435","iexcl":"\u00A1","iff":"\u21D4","ifr":"\uD835\uDD26","Ifr":"\u2111","Igrave":"\u00CC","igrave":"\u00EC","ii":"\u2148","iiiint":"\u2A0C","iiint":"\u222D","iinfin":"\u29DC","iiota":"\u2129","IJlig":"\u0132","ijlig":"\u0133","Imacr":"\u012A","imacr":"\u012B","image":"\u2111","ImaginaryI":"\u2148","imagline":"\u2110","imagpart":"\u2111","imath":"\u0131","Im":"\u2111","imof":"\u22B7","imped":"\u01B5","Implies":"\u21D2","incare":"\u2105","in":"\u2208","infin":"\u221E","infintie":"\u29DD","inodot":"\u0131","intcal":"\u22BA","int":"\u222B","Int":"\u222C","integers":"\u2124","Integral":"\u222B","intercal":"\u22BA","Intersection":"\u22C2","intlarhk":"\u2A17","intprod":"\u2A3C","InvisibleComma":"\u2063","InvisibleTimes":"\u2062","IOcy":"\u0401","iocy":"\u0451","Iogon":"\u012E","iogon":"\u012F","Iopf":"\uD835\uDD40","iopf":"\uD835\uDD5A","Iota":"\u0399","iota":"\u03B9","iprod":"\u2A3C","iquest":"\u00BF","iscr":"\uD835\uDCBE","Iscr":"\u2110","isin":"\u2208","isindot":"\u22F5","isinE":"\u22F9","isins":"\u22F4","isinsv":"\u22F3","isinv":"\u2208","it":"\u2062","Itilde":"\u0128","itilde":"\u0129","Iukcy":"\u0406","iukcy":"\u0456","Iuml":"\u00CF","iuml":"\u00EF","Jcirc":"\u0134","jcirc":"\u0135","Jcy":"\u0419","jcy":"\u0439","Jfr":"\uD835\uDD0D","jfr":"\uD835\uDD27","jmath":"\u0237","Jopf":"\uD835\uDD41","jopf":"\uD835\uDD5B","Jscr":"\uD835\uDCA5","jscr":"\uD835\uDCBF","Jsercy":"\u0408","jsercy":"\u0458","Jukcy":"\u0404","jukcy":"\u0454","Kappa":"\u039A","kappa":"\u03BA","kappav":"\u03F0","Kcedil":"\u0136","kcedil":"\u0137","Kcy":"\u041A","kcy":"\u043A","Kfr":"\uD835\uDD0E","kfr":"\uD835\uDD28","kgreen":"\u0138","KHcy":"\u0425","khcy":"\u0445","KJcy":"\u040C","kjcy":"\u045C","Kopf":"\uD835\uDD42","kopf":"\uD835\uDD5C","Kscr":"\uD835\uDCA6","kscr":"\uD835\uDCC0","lAarr":"\u21DA","Lacute":"\u0139","lacute":"\u013A","laemptyv":"\u29B4","lagran":"\u2112","Lambda":"\u039B","lambda":"\u03BB","lang":"\u27E8","Lang":"\u27EA","langd":"\u2991","langle":"\u27E8","lap":"\u2A85","Laplacetrf":"\u2112","laquo":"\u00AB","larrb":"\u21E4","larrbfs":"\u291F","larr":"\u2190","Larr":"\u219E","lArr":"\u21D0","larrfs":"\u291D","larrhk":"\u21A9","larrlp":"\u21AB","larrpl":"\u2939","larrsim":"\u2973","larrtl":"\u21A2","latail":"\u2919","lAtail":"\u291B","lat":"\u2AAB","late":"\u2AAD","lates":"\u2AAD\uFE00","lbarr":"\u290C","lBarr":"\u290E","lbbrk":"\u2772","lbrace":"{","lbrack":"[","lbrke":"\u298B","lbrksld":"\u298F","lbrkslu":"\u298D","Lcaron":"\u013D","lcaron":"\u013E","Lcedil":"\u013B","lcedil":"\u013C","lceil":"\u2308","lcub":"{","Lcy":"\u041B","lcy":"\u043B","ldca":"\u2936","ldquo":"\u201C","ldquor":"\u201E","ldrdhar":"\u2967","ldrushar":"\u294B","ldsh":"\u21B2","le":"\u2264","lE":"\u2266","LeftAngleBracket":"\u27E8","LeftArrowBar":"\u21E4","leftarrow":"\u2190","LeftArrow":"\u2190","Leftarrow":"\u21D0","LeftArrowRightArrow":"\u21C6","leftarrowtail":"\u21A2","LeftCeiling":"\u2308","LeftDoubleBracket":"\u27E6","LeftDownTeeVector":"\u2961","LeftDownVectorBar":"\u2959","LeftDownVector":"\u21C3","LeftFloor":"\u230A","leftharpoondown":"\u21BD","leftharpoonup":"\u21BC","leftleftarrows":"\u21C7","leftrightarrow":"\u2194","LeftRightArrow":"\u2194","Leftrightarrow":"\u21D4","leftrightarrows":"\u21C6","leftrightharpoons":"\u21CB","leftrightsquigarrow":"\u21AD","LeftRightVector":"\u294E","LeftTeeArrow":"\u21A4","LeftTee":"\u22A3","LeftTeeVector":"\u295A","leftthreetimes":"\u22CB","LeftTriangleBar":"\u29CF","LeftTriangle":"\u22B2","LeftTriangleEqual":"\u22B4","LeftUpDownVector":"\u2951","LeftUpTeeVector":"\u2960","LeftUpVectorBar":"\u2958","LeftUpVector":"\u21BF","LeftVectorBar":"\u2952","LeftVector":"\u21BC","lEg":"\u2A8B","leg":"\u22DA","leq":"\u2264","leqq":"\u2266","leqslant":"\u2A7D","lescc":"\u2AA8","les":"\u2A7D","lesdot":"\u2A7F","lesdoto":"\u2A81","lesdotor":"\u2A83","lesg":"\u22DA\uFE00","lesges":"\u2A93","lessapprox":"\u2A85","lessdot":"\u22D6","lesseqgtr":"\u22DA","lesseqqgtr":"\u2A8B","LessEqualGreater":"\u22DA","LessFullEqual":"\u2266","LessGreater":"\u2276","lessgtr":"\u2276","LessLess":"\u2AA1","lesssim":"\u2272","LessSlantEqual":"\u2A7D","LessTilde":"\u2272","lfisht":"\u297C","lfloor":"\u230A","Lfr":"\uD835\uDD0F","lfr":"\uD835\uDD29","lg":"\u2276","lgE":"\u2A91","lHar":"\u2962","lhard":"\u21BD","lharu":"\u21BC","lharul":"\u296A","lhblk":"\u2584","LJcy":"\u0409","ljcy":"\u0459","llarr":"\u21C7","ll":"\u226A","Ll":"\u22D8","llcorner":"\u231E","Lleftarrow":"\u21DA","llhard":"\u296B","lltri":"\u25FA","Lmidot":"\u013F","lmidot":"\u0140","lmoustache":"\u23B0","lmoust":"\u23B0","lnap":"\u2A89","lnapprox":"\u2A89","lne":"\u2A87","lnE":"\u2268","lneq":"\u2A87","lneqq":"\u2268","lnsim":"\u22E6","loang":"\u27EC","loarr":"\u21FD","lobrk":"\u27E6","longleftarrow":"\u27F5","LongLeftArrow":"\u27F5","Longleftarrow":"\u27F8","longleftrightarrow":"\u27F7","LongLeftRightArrow":"\u27F7","Longleftrightarrow":"\u27FA","longmapsto":"\u27FC","longrightarrow":"\u27F6","LongRightArrow":"\u27F6","Longrightarrow":"\u27F9","looparrowleft":"\u21AB","looparrowright":"\u21AC","lopar":"\u2985","Lopf":"\uD835\uDD43","lopf":"\uD835\uDD5D","loplus":"\u2A2D","lotimes":"\u2A34","lowast":"\u2217","lowbar":"_","LowerLeftArrow":"\u2199","LowerRightArrow":"\u2198","loz":"\u25CA","lozenge":"\u25CA","lozf":"\u29EB","lpar":"(","lparlt":"\u2993","lrarr":"\u21C6","lrcorner":"\u231F","lrhar":"\u21CB","lrhard":"\u296D","lrm":"\u200E","lrtri":"\u22BF","lsaquo":"\u2039","lscr":"\uD835\uDCC1","Lscr":"\u2112","lsh":"\u21B0","Lsh":"\u21B0","lsim":"\u2272","lsime":"\u2A8D","lsimg":"\u2A8F","lsqb":"[","lsquo":"\u2018","lsquor":"\u201A","Lstrok":"\u0141","lstrok":"\u0142","ltcc":"\u2AA6","ltcir":"\u2A79","lt":"<","LT":"<","Lt":"\u226A","ltdot":"\u22D6","lthree":"\u22CB","ltimes":"\u22C9","ltlarr":"\u2976","ltquest":"\u2A7B","ltri":"\u25C3","ltrie":"\u22B4","ltrif":"\u25C2","ltrPar":"\u2996","lurdshar":"\u294A","luruhar":"\u2966","lvertneqq":"\u2268\uFE00","lvnE":"\u2268\uFE00","macr":"\u00AF","male":"\u2642","malt":"\u2720","maltese":"\u2720","Map":"\u2905","map":"\u21A6","mapsto":"\u21A6","mapstodown":"\u21A7","mapstoleft":"\u21A4","mapstoup":"\u21A5","marker":"\u25AE","mcomma":"\u2A29","Mcy":"\u041C","mcy":"\u043C","mdash":"\u2014","mDDot":"\u223A","measuredangle":"\u2221","MediumSpace":"\u205F","Mellintrf":"\u2133","Mfr":"\uD835\uDD10","mfr":"\uD835\uDD2A","mho":"\u2127","micro":"\u00B5","midast":"*","midcir":"\u2AF0","mid":"\u2223","middot":"\u00B7","minusb":"\u229F","minus":"\u2212","minusd":"\u2238","minusdu":"\u2A2A","MinusPlus":"\u2213","mlcp":"\u2ADB","mldr":"\u2026","mnplus":"\u2213","models":"\u22A7","Mopf":"\uD835\uDD44","mopf":"\uD835\uDD5E","mp":"\u2213","mscr":"\uD835\uDCC2","Mscr":"\u2133","mstpos":"\u223E","Mu":"\u039C","mu":"\u03BC","multimap":"\u22B8","mumap":"\u22B8","nabla":"\u2207","Nacute":"\u0143","nacute":"\u0144","nang":"\u2220\u20D2","nap":"\u2249","napE":"\u2A70\u0338","napid":"\u224B\u0338","napos":"\u0149","napprox":"\u2249","natural":"\u266E","naturals":"\u2115","natur":"\u266E","nbsp":"\u00A0","nbump":"\u224E\u0338","nbumpe":"\u224F\u0338","ncap":"\u2A43","Ncaron":"\u0147","ncaron":"\u0148","Ncedil":"\u0145","ncedil":"\u0146","ncong":"\u2247","ncongdot":"\u2A6D\u0338","ncup":"\u2A42","Ncy":"\u041D","ncy":"\u043D","ndash":"\u2013","nearhk":"\u2924","nearr":"\u2197","neArr":"\u21D7","nearrow":"\u2197","ne":"\u2260","nedot":"\u2250\u0338","NegativeMediumSpace":"\u200B","NegativeThickSpace":"\u200B","NegativeThinSpace":"\u200B","NegativeVeryThinSpace":"\u200B","nequiv":"\u2262","nesear":"\u2928","nesim":"\u2242\u0338","NestedGreaterGreater":"\u226B","NestedLessLess":"\u226A","NewLine":"\n","nexist":"\u2204","nexists":"\u2204","Nfr":"\uD835\uDD11","nfr":"\uD835\uDD2B","ngE":"\u2267\u0338","nge":"\u2271","ngeq":"\u2271","ngeqq":"\u2267\u0338","ngeqslant":"\u2A7E\u0338","nges":"\u2A7E\u0338","nGg":"\u22D9\u0338","ngsim":"\u2275","nGt":"\u226B\u20D2","ngt":"\u226F","ngtr":"\u226F","nGtv":"\u226B\u0338","nharr":"\u21AE","nhArr":"\u21CE","nhpar":"\u2AF2","ni":"\u220B","nis":"\u22FC","nisd":"\u22FA","niv":"\u220B","NJcy":"\u040A","njcy":"\u045A","nlarr":"\u219A","nlArr":"\u21CD","nldr":"\u2025","nlE":"\u2266\u0338","nle":"\u2270","nleftarrow":"\u219A","nLeftarrow":"\u21CD","nleftrightarrow":"\u21AE","nLeftrightarrow":"\u21CE","nleq":"\u2270","nleqq":"\u2266\u0338","nleqslant":"\u2A7D\u0338","nles":"\u2A7D\u0338","nless":"\u226E","nLl":"\u22D8\u0338","nlsim":"\u2274","nLt":"\u226A\u20D2","nlt":"\u226E","nltri":"\u22EA","nltrie":"\u22EC","nLtv":"\u226A\u0338","nmid":"\u2224","NoBreak":"\u2060","NonBreakingSpace":"\u00A0","nopf":"\uD835\uDD5F","Nopf":"\u2115","Not":"\u2AEC","not":"\u00AC","NotCongruent":"\u2262","NotCupCap":"\u226D","NotDoubleVerticalBar":"\u2226","NotElement":"\u2209","NotEqual":"\u2260","NotEqualTilde":"\u2242\u0338","NotExists":"\u2204","NotGreater":"\u226F","NotGreaterEqual":"\u2271","NotGreaterFullEqual":"\u2267\u0338","NotGreaterGreater":"\u226B\u0338","NotGreaterLess":"\u2279","NotGreaterSlantEqual":"\u2A7E\u0338","NotGreaterTilde":"\u2275","NotHumpDownHump":"\u224E\u0338","NotHumpEqual":"\u224F\u0338","notin":"\u2209","notindot":"\u22F5\u0338","notinE":"\u22F9\u0338","notinva":"\u2209","notinvb":"\u22F7","notinvc":"\u22F6","NotLeftTriangleBar":"\u29CF\u0338","NotLeftTriangle":"\u22EA","NotLeftTriangleEqual":"\u22EC","NotLess":"\u226E","NotLessEqual":"\u2270","NotLessGreater":"\u2278","NotLessLess":"\u226A\u0338","NotLessSlantEqual":"\u2A7D\u0338","NotLessTilde":"\u2274","NotNestedGreaterGreater":"\u2AA2\u0338","NotNestedLessLess":"\u2AA1\u0338","notni":"\u220C","notniva":"\u220C","notnivb":"\u22FE","notnivc":"\u22FD","NotPrecedes":"\u2280","NotPrecedesEqual":"\u2AAF\u0338","NotPrecedesSlantEqual":"\u22E0","NotReverseElement":"\u220C","NotRightTriangleBar":"\u29D0\u0338","NotRightTriangle":"\u22EB","NotRightTriangleEqual":"\u22ED","NotSquareSubset":"\u228F\u0338","NotSquareSubsetEqual":"\u22E2","NotSquareSuperset":"\u2290\u0338","NotSquareSupersetEqual":"\u22E3","NotSubset":"\u2282\u20D2","NotSubsetEqual":"\u2288","NotSucceeds":"\u2281","NotSucceedsEqual":"\u2AB0\u0338","NotSucceedsSlantEqual":"\u22E1","NotSucceedsTilde":"\u227F\u0338","NotSuperset":"\u2283\u20D2","NotSupersetEqual":"\u2289","NotTilde":"\u2241","NotTildeEqual":"\u2244","NotTildeFullEqual":"\u2247","NotTildeTilde":"\u2249","NotVerticalBar":"\u2224","nparallel":"\u2226","npar":"\u2226","nparsl":"\u2AFD\u20E5","npart":"\u2202\u0338","npolint":"\u2A14","npr":"\u2280","nprcue":"\u22E0","nprec":"\u2280","npreceq":"\u2AAF\u0338","npre":"\u2AAF\u0338","nrarrc":"\u2933\u0338","nrarr":"\u219B","nrArr":"\u21CF","nrarrw":"\u219D\u0338","nrightarrow":"\u219B","nRightarrow":"\u21CF","nrtri":"\u22EB","nrtrie":"\u22ED","nsc":"\u2281","nsccue":"\u22E1","nsce":"\u2AB0\u0338","Nscr":"\uD835\uDCA9","nscr":"\uD835\uDCC3","nshortmid":"\u2224","nshortparallel":"\u2226","nsim":"\u2241","nsime":"\u2244","nsimeq":"\u2244","nsmid":"\u2224","nspar":"\u2226","nsqsube":"\u22E2","nsqsupe":"\u22E3","nsub":"\u2284","nsubE":"\u2AC5\u0338","nsube":"\u2288","nsubset":"\u2282\u20D2","nsubseteq":"\u2288","nsubseteqq":"\u2AC5\u0338","nsucc":"\u2281","nsucceq":"\u2AB0\u0338","nsup":"\u2285","nsupE":"\u2AC6\u0338","nsupe":"\u2289","nsupset":"\u2283\u20D2","nsupseteq":"\u2289","nsupseteqq":"\u2AC6\u0338","ntgl":"\u2279","Ntilde":"\u00D1","ntilde":"\u00F1","ntlg":"\u2278","ntriangleleft":"\u22EA","ntrianglelefteq":"\u22EC","ntriangleright":"\u22EB","ntrianglerighteq":"\u22ED","Nu":"\u039D","nu":"\u03BD","num":"#","numero":"\u2116","numsp":"\u2007","nvap":"\u224D\u20D2","nvdash":"\u22AC","nvDash":"\u22AD","nVdash":"\u22AE","nVDash":"\u22AF","nvge":"\u2265\u20D2","nvgt":">\u20D2","nvHarr":"\u2904","nvinfin":"\u29DE","nvlArr":"\u2902","nvle":"\u2264\u20D2","nvlt":"<\u20D2","nvltrie":"\u22B4\u20D2","nvrArr":"\u2903","nvrtrie":"\u22B5\u20D2","nvsim":"\u223C\u20D2","nwarhk":"\u2923","nwarr":"\u2196","nwArr":"\u21D6","nwarrow":"\u2196","nwnear":"\u2927","Oacute":"\u00D3","oacute":"\u00F3","oast":"\u229B","Ocirc":"\u00D4","ocirc":"\u00F4","ocir":"\u229A","Ocy":"\u041E","ocy":"\u043E","odash":"\u229D","Odblac":"\u0150","odblac":"\u0151","odiv":"\u2A38","odot":"\u2299","odsold":"\u29BC","OElig":"\u0152","oelig":"\u0153","ofcir":"\u29BF","Ofr":"\uD835\uDD12","ofr":"\uD835\uDD2C","ogon":"\u02DB","Ograve":"\u00D2","ograve":"\u00F2","ogt":"\u29C1","ohbar":"\u29B5","ohm":"\u03A9","oint":"\u222E","olarr":"\u21BA","olcir":"\u29BE","olcross":"\u29BB","oline":"\u203E","olt":"\u29C0","Omacr":"\u014C","omacr":"\u014D","Omega":"\u03A9","omega":"\u03C9","Omicron":"\u039F","omicron":"\u03BF","omid":"\u29B6","ominus":"\u2296","Oopf":"\uD835\uDD46","oopf":"\uD835\uDD60","opar":"\u29B7","OpenCurlyDoubleQuote":"\u201C","OpenCurlyQuote":"\u2018","operp":"\u29B9","oplus":"\u2295","orarr":"\u21BB","Or":"\u2A54","or":"\u2228","ord":"\u2A5D","order":"\u2134","orderof":"\u2134","ordf":"\u00AA","ordm":"\u00BA","origof":"\u22B6","oror":"\u2A56","orslope":"\u2A57","orv":"\u2A5B","oS":"\u24C8","Oscr":"\uD835\uDCAA","oscr":"\u2134","Oslash":"\u00D8","oslash":"\u00F8","osol":"\u2298","Otilde":"\u00D5","otilde":"\u00F5","otimesas":"\u2A36","Otimes":"\u2A37","otimes":"\u2297","Ouml":"\u00D6","ouml":"\u00F6","ovbar":"\u233D","OverBar":"\u203E","OverBrace":"\u23DE","OverBracket":"\u23B4","OverParenthesis":"\u23DC","para":"\u00B6","parallel":"\u2225","par":"\u2225","parsim":"\u2AF3","parsl":"\u2AFD","part":"\u2202","PartialD":"\u2202","Pcy":"\u041F","pcy":"\u043F","percnt":"%","period":".","permil":"\u2030","perp":"\u22A5","pertenk":"\u2031","Pfr":"\uD835\uDD13","pfr":"\uD835\uDD2D","Phi":"\u03A6","phi":"\u03C6","phiv":"\u03D5","phmmat":"\u2133","phone":"\u260E","Pi":"\u03A0","pi":"\u03C0","pitchfork":"\u22D4","piv":"\u03D6","planck":"\u210F","planckh":"\u210E","plankv":"\u210F","plusacir":"\u2A23","plusb":"\u229E","pluscir":"\u2A22","plus":"+","plusdo":"\u2214","plusdu":"\u2A25","pluse":"\u2A72","PlusMinus":"\u00B1","plusmn":"\u00B1","plussim":"\u2A26","plustwo":"\u2A27","pm":"\u00B1","Poincareplane":"\u210C","pointint":"\u2A15","popf":"\uD835\uDD61","Popf":"\u2119","pound":"\u00A3","prap":"\u2AB7","Pr":"\u2ABB","pr":"\u227A","prcue":"\u227C","precapprox":"\u2AB7","prec":"\u227A","preccurlyeq":"\u227C","Precedes":"\u227A","PrecedesEqual":"\u2AAF","PrecedesSlantEqual":"\u227C","PrecedesTilde":"\u227E","preceq":"\u2AAF","precnapprox":"\u2AB9","precneqq":"\u2AB5","precnsim":"\u22E8","pre":"\u2AAF","prE":"\u2AB3","precsim":"\u227E","prime":"\u2032","Prime":"\u2033","primes":"\u2119","prnap":"\u2AB9","prnE":"\u2AB5","prnsim":"\u22E8","prod":"\u220F","Product":"\u220F","profalar":"\u232E","profline":"\u2312","profsurf":"\u2313","prop":"\u221D","Proportional":"\u221D","Proportion":"\u2237","propto":"\u221D","prsim":"\u227E","prurel":"\u22B0","Pscr":"\uD835\uDCAB","pscr":"\uD835\uDCC5","Psi":"\u03A8","psi":"\u03C8","puncsp":"\u2008","Qfr":"\uD835\uDD14","qfr":"\uD835\uDD2E","qint":"\u2A0C","qopf":"\uD835\uDD62","Qopf":"\u211A","qprime":"\u2057","Qscr":"\uD835\uDCAC","qscr":"\uD835\uDCC6","quaternions":"\u210D","quatint":"\u2A16","quest":"?","questeq":"\u225F","quot":"\"","QUOT":"\"","rAarr":"\u21DB","race":"\u223D\u0331","Racute":"\u0154","racute":"\u0155","radic":"\u221A","raemptyv":"\u29B3","rang":"\u27E9","Rang":"\u27EB","rangd":"\u2992","range":"\u29A5","rangle":"\u27E9","raquo":"\u00BB","rarrap":"\u2975","rarrb":"\u21E5","rarrbfs":"\u2920","rarrc":"\u2933","rarr":"\u2192","Rarr":"\u21A0","rArr":"\u21D2","rarrfs":"\u291E","rarrhk":"\u21AA","rarrlp":"\u21AC","rarrpl":"\u2945","rarrsim":"\u2974","Rarrtl":"\u2916","rarrtl":"\u21A3","rarrw":"\u219D","ratail":"\u291A","rAtail":"\u291C","ratio":"\u2236","rationals":"\u211A","rbarr":"\u290D","rBarr":"\u290F","RBarr":"\u2910","rbbrk":"\u2773","rbrace":"}","rbrack":"]","rbrke":"\u298C","rbrksld":"\u298E","rbrkslu":"\u2990","Rcaron":"\u0158","rcaron":"\u0159","Rcedil":"\u0156","rcedil":"\u0157","rceil":"\u2309","rcub":"}","Rcy":"\u0420","rcy":"\u0440","rdca":"\u2937","rdldhar":"\u2969","rdquo":"\u201D","rdquor":"\u201D","rdsh":"\u21B3","real":"\u211C","realine":"\u211B","realpart":"\u211C","reals":"\u211D","Re":"\u211C","rect":"\u25AD","reg":"\u00AE","REG":"\u00AE","ReverseElement":"\u220B","ReverseEquilibrium":"\u21CB","ReverseUpEquilibrium":"\u296F","rfisht":"\u297D","rfloor":"\u230B","rfr":"\uD835\uDD2F","Rfr":"\u211C","rHar":"\u2964","rhard":"\u21C1","rharu":"\u21C0","rharul":"\u296C","Rho":"\u03A1","rho":"\u03C1","rhov":"\u03F1","RightAngleBracket":"\u27E9","RightArrowBar":"\u21E5","rightarrow":"\u2192","RightArrow":"\u2192","Rightarrow":"\u21D2","RightArrowLeftArrow":"\u21C4","rightarrowtail":"\u21A3","RightCeiling":"\u2309","RightDoubleBracket":"\u27E7","RightDownTeeVector":"\u295D","RightDownVectorBar":"\u2955","RightDownVector":"\u21C2","RightFloor":"\u230B","rightharpoondown":"\u21C1","rightharpoonup":"\u21C0","rightleftarrows":"\u21C4","rightleftharpoons":"\u21CC","rightrightarrows":"\u21C9","rightsquigarrow":"\u219D","RightTeeArrow":"\u21A6","RightTee":"\u22A2","RightTeeVector":"\u295B","rightthreetimes":"\u22CC","RightTriangleBar":"\u29D0","RightTriangle":"\u22B3","RightTriangleEqual":"\u22B5","RightUpDownVector":"\u294F","RightUpTeeVector":"\u295C","RightUpVectorBar":"\u2954","RightUpVector":"\u21BE","RightVectorBar":"\u2953","RightVector":"\u21C0","ring":"\u02DA","risingdotseq":"\u2253","rlarr":"\u21C4","rlhar":"\u21CC","rlm":"\u200F","rmoustache":"\u23B1","rmoust":"\u23B1","rnmid":"\u2AEE","roang":"\u27ED","roarr":"\u21FE","robrk":"\u27E7","ropar":"\u2986","ropf":"\uD835\uDD63","Ropf":"\u211D","roplus":"\u2A2E","rotimes":"\u2A35","RoundImplies":"\u2970","rpar":")","rpargt":"\u2994","rppolint":"\u2A12","rrarr":"\u21C9","Rrightarrow":"\u21DB","rsaquo":"\u203A","rscr":"\uD835\uDCC7","Rscr":"\u211B","rsh":"\u21B1","Rsh":"\u21B1","rsqb":"]","rsquo":"\u2019","rsquor":"\u2019","rthree":"\u22CC","rtimes":"\u22CA","rtri":"\u25B9","rtrie":"\u22B5","rtrif":"\u25B8","rtriltri":"\u29CE","RuleDelayed":"\u29F4","ruluhar":"\u2968","rx":"\u211E","Sacute":"\u015A","sacute":"\u015B","sbquo":"\u201A","scap":"\u2AB8","Scaron":"\u0160","scaron":"\u0161","Sc":"\u2ABC","sc":"\u227B","sccue":"\u227D","sce":"\u2AB0","scE":"\u2AB4","Scedil":"\u015E","scedil":"\u015F","Scirc":"\u015C","scirc":"\u015D","scnap":"\u2ABA","scnE":"\u2AB6","scnsim":"\u22E9","scpolint":"\u2A13","scsim":"\u227F","Scy":"\u0421","scy":"\u0441","sdotb":"\u22A1","sdot":"\u22C5","sdote":"\u2A66","searhk":"\u2925","searr":"\u2198","seArr":"\u21D8","searrow":"\u2198","sect":"\u00A7","semi":";","seswar":"\u2929","setminus":"\u2216","setmn":"\u2216","sext":"\u2736","Sfr":"\uD835\uDD16","sfr":"\uD835\uDD30","sfrown":"\u2322","sharp":"\u266F","SHCHcy":"\u0429","shchcy":"\u0449","SHcy":"\u0428","shcy":"\u0448","ShortDownArrow":"\u2193","ShortLeftArrow":"\u2190","shortmid":"\u2223","shortparallel":"\u2225","ShortRightArrow":"\u2192","ShortUpArrow":"\u2191","shy":"\u00AD","Sigma":"\u03A3","sigma":"\u03C3","sigmaf":"\u03C2","sigmav":"\u03C2","sim":"\u223C","simdot":"\u2A6A","sime":"\u2243","simeq":"\u2243","simg":"\u2A9E","simgE":"\u2AA0","siml":"\u2A9D","simlE":"\u2A9F","simne":"\u2246","simplus":"\u2A24","simrarr":"\u2972","slarr":"\u2190","SmallCircle":"\u2218","smallsetminus":"\u2216","smashp":"\u2A33","smeparsl":"\u29E4","smid":"\u2223","smile":"\u2323","smt":"\u2AAA","smte":"\u2AAC","smtes":"\u2AAC\uFE00","SOFTcy":"\u042C","softcy":"\u044C","solbar":"\u233F","solb":"\u29C4","sol":"/","Sopf":"\uD835\uDD4A","sopf":"\uD835\uDD64","spades":"\u2660","spadesuit":"\u2660","spar":"\u2225","sqcap":"\u2293","sqcaps":"\u2293\uFE00","sqcup":"\u2294","sqcups":"\u2294\uFE00","Sqrt":"\u221A","sqsub":"\u228F","sqsube":"\u2291","sqsubset":"\u228F","sqsubseteq":"\u2291","sqsup":"\u2290","sqsupe":"\u2292","sqsupset":"\u2290","sqsupseteq":"\u2292","square":"\u25A1","Square":"\u25A1","SquareIntersection":"\u2293","SquareSubset":"\u228F","SquareSubsetEqual":"\u2291","SquareSuperset":"\u2290","SquareSupersetEqual":"\u2292","SquareUnion":"\u2294","squarf":"\u25AA","squ":"\u25A1","squf":"\u25AA","srarr":"\u2192","Sscr":"\uD835\uDCAE","sscr":"\uD835\uDCC8","ssetmn":"\u2216","ssmile":"\u2323","sstarf":"\u22C6","Star":"\u22C6","star":"\u2606","starf":"\u2605","straightepsilon":"\u03F5","straightphi":"\u03D5","strns":"\u00AF","sub":"\u2282","Sub":"\u22D0","subdot":"\u2ABD","subE":"\u2AC5","sube":"\u2286","subedot":"\u2AC3","submult":"\u2AC1","subnE":"\u2ACB","subne":"\u228A","subplus":"\u2ABF","subrarr":"\u2979","subset":"\u2282","Subset":"\u22D0","subseteq":"\u2286","subseteqq":"\u2AC5","SubsetEqual":"\u2286","subsetneq":"\u228A","subsetneqq":"\u2ACB","subsim":"\u2AC7","subsub":"\u2AD5","subsup":"\u2AD3","succapprox":"\u2AB8","succ":"\u227B","succcurlyeq":"\u227D","Succeeds":"\u227B","SucceedsEqual":"\u2AB0","SucceedsSlantEqual":"\u227D","SucceedsTilde":"\u227F","succeq":"\u2AB0","succnapprox":"\u2ABA","succneqq":"\u2AB6","succnsim":"\u22E9","succsim":"\u227F","SuchThat":"\u220B","sum":"\u2211","Sum":"\u2211","sung":"\u266A","sup1":"\u00B9","sup2":"\u00B2","sup3":"\u00B3","sup":"\u2283","Sup":"\u22D1","supdot":"\u2ABE","supdsub":"\u2AD8","supE":"\u2AC6","supe":"\u2287","supedot":"\u2AC4","Superset":"\u2283","SupersetEqual":"\u2287","suphsol":"\u27C9","suphsub":"\u2AD7","suplarr":"\u297B","supmult":"\u2AC2","supnE":"\u2ACC","supne":"\u228B","supplus":"\u2AC0","supset":"\u2283","Supset":"\u22D1","supseteq":"\u2287","supseteqq":"\u2AC6","supsetneq":"\u228B","supsetneqq":"\u2ACC","supsim":"\u2AC8","supsub":"\u2AD4","supsup":"\u2AD6","swarhk":"\u2926","swarr":"\u2199","swArr":"\u21D9","swarrow":"\u2199","swnwar":"\u292A","szlig":"\u00DF","Tab":"\t","target":"\u2316","Tau":"\u03A4","tau":"\u03C4","tbrk":"\u23B4","Tcaron":"\u0164","tcaron":"\u0165","Tcedil":"\u0162","tcedil":"\u0163","Tcy":"\u0422","tcy":"\u0442","tdot":"\u20DB","telrec":"\u2315","Tfr":"\uD835\uDD17","tfr":"\uD835\uDD31","there4":"\u2234","therefore":"\u2234","Therefore":"\u2234","Theta":"\u0398","theta":"\u03B8","thetasym":"\u03D1","thetav":"\u03D1","thickapprox":"\u2248","thicksim":"\u223C","ThickSpace":"\u205F\u200A","ThinSpace":"\u2009","thinsp":"\u2009","thkap":"\u2248","thksim":"\u223C","THORN":"\u00DE","thorn":"\u00FE","tilde":"\u02DC","Tilde":"\u223C","TildeEqual":"\u2243","TildeFullEqual":"\u2245","TildeTilde":"\u2248","timesbar":"\u2A31","timesb":"\u22A0","times":"\u00D7","timesd":"\u2A30","tint":"\u222D","toea":"\u2928","topbot":"\u2336","topcir":"\u2AF1","top":"\u22A4","Topf":"\uD835\uDD4B","topf":"\uD835\uDD65","topfork":"\u2ADA","tosa":"\u2929","tprime":"\u2034","trade":"\u2122","TRADE":"\u2122","triangle":"\u25B5","triangledown":"\u25BF","triangleleft":"\u25C3","trianglelefteq":"\u22B4","triangleq":"\u225C","triangleright":"\u25B9","trianglerighteq":"\u22B5","tridot":"\u25EC","trie":"\u225C","triminus":"\u2A3A","TripleDot":"\u20DB","triplus":"\u2A39","trisb":"\u29CD","tritime":"\u2A3B","trpezium":"\u23E2","Tscr":"\uD835\uDCAF","tscr":"\uD835\uDCC9","TScy":"\u0426","tscy":"\u0446","TSHcy":"\u040B","tshcy":"\u045B","Tstrok":"\u0166","tstrok":"\u0167","twixt":"\u226C","twoheadleftarrow":"\u219E","twoheadrightarrow":"\u21A0","Uacute":"\u00DA","uacute":"\u00FA","uarr":"\u2191","Uarr":"\u219F","uArr":"\u21D1","Uarrocir":"\u2949","Ubrcy":"\u040E","ubrcy":"\u045E","Ubreve":"\u016C","ubreve":"\u016D","Ucirc":"\u00DB","ucirc":"\u00FB","Ucy":"\u0423","ucy":"\u0443","udarr":"\u21C5","Udblac":"\u0170","udblac":"\u0171","udhar":"\u296E","ufisht":"\u297E","Ufr":"\uD835\uDD18","ufr":"\uD835\uDD32","Ugrave":"\u00D9","ugrave":"\u00F9","uHar":"\u2963","uharl":"\u21BF","uharr":"\u21BE","uhblk":"\u2580","ulcorn":"\u231C","ulcorner":"\u231C","ulcrop":"\u230F","ultri":"\u25F8","Umacr":"\u016A","umacr":"\u016B","uml":"\u00A8","UnderBar":"_","UnderBrace":"\u23DF","UnderBracket":"\u23B5","UnderParenthesis":"\u23DD","Union":"\u22C3","UnionPlus":"\u228E","Uogon":"\u0172","uogon":"\u0173","Uopf":"\uD835\uDD4C","uopf":"\uD835\uDD66","UpArrowBar":"\u2912","uparrow":"\u2191","UpArrow":"\u2191","Uparrow":"\u21D1","UpArrowDownArrow":"\u21C5","updownarrow":"\u2195","UpDownArrow":"\u2195","Updownarrow":"\u21D5","UpEquilibrium":"\u296E","upharpoonleft":"\u21BF","upharpoonright":"\u21BE","uplus":"\u228E","UpperLeftArrow":"\u2196","UpperRightArrow":"\u2197","upsi":"\u03C5","Upsi":"\u03D2","upsih":"\u03D2","Upsilon":"\u03A5","upsilon":"\u03C5","UpTeeArrow":"\u21A5","UpTee":"\u22A5","upuparrows":"\u21C8","urcorn":"\u231D","urcorner":"\u231D","urcrop":"\u230E","Uring":"\u016E","uring":"\u016F","urtri":"\u25F9","Uscr":"\uD835\uDCB0","uscr":"\uD835\uDCCA","utdot":"\u22F0","Utilde":"\u0168","utilde":"\u0169","utri":"\u25B5","utrif":"\u25B4","uuarr":"\u21C8","Uuml":"\u00DC","uuml":"\u00FC","uwangle":"\u29A7","vangrt":"\u299C","varepsilon":"\u03F5","varkappa":"\u03F0","varnothing":"\u2205","varphi":"\u03D5","varpi":"\u03D6","varpropto":"\u221D","varr":"\u2195","vArr":"\u21D5","varrho":"\u03F1","varsigma":"\u03C2","varsubsetneq":"\u228A\uFE00","varsubsetneqq":"\u2ACB\uFE00","varsupsetneq":"\u228B\uFE00","varsupsetneqq":"\u2ACC\uFE00","vartheta":"\u03D1","vartriangleleft":"\u22B2","vartriangleright":"\u22B3","vBar":"\u2AE8","Vbar":"\u2AEB","vBarv":"\u2AE9","Vcy":"\u0412","vcy":"\u0432","vdash":"\u22A2","vDash":"\u22A8","Vdash":"\u22A9","VDash":"\u22AB","Vdashl":"\u2AE6","veebar":"\u22BB","vee":"\u2228","Vee":"\u22C1","veeeq":"\u225A","vellip":"\u22EE","verbar":"|","Verbar":"\u2016","vert":"|","Vert":"\u2016","VerticalBar":"\u2223","VerticalLine":"|","VerticalSeparator":"\u2758","VerticalTilde":"\u2240","VeryThinSpace":"\u200A","Vfr":"\uD835\uDD19","vfr":"\uD835\uDD33","vltri":"\u22B2","vnsub":"\u2282\u20D2","vnsup":"\u2283\u20D2","Vopf":"\uD835\uDD4D","vopf":"\uD835\uDD67","vprop":"\u221D","vrtri":"\u22B3","Vscr":"\uD835\uDCB1","vscr":"\uD835\uDCCB","vsubnE":"\u2ACB\uFE00","vsubne":"\u228A\uFE00","vsupnE":"\u2ACC\uFE00","vsupne":"\u228B\uFE00","Vvdash":"\u22AA","vzigzag":"\u299A","Wcirc":"\u0174","wcirc":"\u0175","wedbar":"\u2A5F","wedge":"\u2227","Wedge":"\u22C0","wedgeq":"\u2259","weierp":"\u2118","Wfr":"\uD835\uDD1A","wfr":"\uD835\uDD34","Wopf":"\uD835\uDD4E","wopf":"\uD835\uDD68","wp":"\u2118","wr":"\u2240","wreath":"\u2240","Wscr":"\uD835\uDCB2","wscr":"\uD835\uDCCC","xcap":"\u22C2","xcirc":"\u25EF","xcup":"\u22C3","xdtri":"\u25BD","Xfr":"\uD835\uDD1B","xfr":"\uD835\uDD35","xharr":"\u27F7","xhArr":"\u27FA","Xi":"\u039E","xi":"\u03BE","xlarr":"\u27F5","xlArr":"\u27F8","xmap":"\u27FC","xnis":"\u22FB","xodot":"\u2A00","Xopf":"\uD835\uDD4F","xopf":"\uD835\uDD69","xoplus":"\u2A01","xotime":"\u2A02","xrarr":"\u27F6","xrArr":"\u27F9","Xscr":"\uD835\uDCB3","xscr":"\uD835\uDCCD","xsqcup":"\u2A06","xuplus":"\u2A04","xutri":"\u25B3","xvee":"\u22C1","xwedge":"\u22C0","Yacute":"\u00DD","yacute":"\u00FD","YAcy":"\u042F","yacy":"\u044F","Ycirc":"\u0176","ycirc":"\u0177","Ycy":"\u042B","ycy":"\u044B","yen":"\u00A5","Yfr":"\uD835\uDD1C","yfr":"\uD835\uDD36","YIcy":"\u0407","yicy":"\u0457","Yopf":"\uD835\uDD50","yopf":"\uD835\uDD6A","Yscr":"\uD835\uDCB4","yscr":"\uD835\uDCCE","YUcy":"\u042E","yucy":"\u044E","yuml":"\u00FF","Yuml":"\u0178","Zacute":"\u0179","zacute":"\u017A","Zcaron":"\u017D","zcaron":"\u017E","Zcy":"\u0417","zcy":"\u0437","Zdot":"\u017B","zdot":"\u017C","zeetrf":"\u2128","ZeroWidthSpace":"\u200B","Zeta":"\u0396","zeta":"\u03B6","zfr":"\uD835\uDD37","Zfr":"\u2128","ZHcy":"\u0416","zhcy":"\u0436","zigrarr":"\u21DD","zopf":"\uD835\uDD6B","Zopf":"\u2124","Zscr":"\uD835\uDCB5","zscr":"\uD835\uDCCF","zwj":"\u200D","zwnj":"\u200C"}540 -1 },{}],3:[function(require,module,exports){541 -1 'use strict';542 -1543 -1544 -1 ////////////////////////////////////////////////////////////////////////////////545 -1 // Helpers546 -1547 -1 // Merge objects548 -1 //549 -1 function assign(obj /*from1, from2, from3, ...*/) {550 -1 var sources = Array.prototype.slice.call(arguments, 1);551 -1552 -1 sources.forEach(function (source) {553 -1 if (!source) { return; }554 -1555 -1 Object.keys(source).forEach(function (key) {556 -1 obj[key] = source[key];557 -1 });558 -1 });559 -1560 -1 return obj;561 -1 }562 -1563 -1 function _class(obj) { return Object.prototype.toString.call(obj); }564 -1 function isString(obj) { return _class(obj) === '[object String]'; }565 -1 function isObject(obj) { return _class(obj) === '[object Object]'; }566 -1 function isRegExp(obj) { return _class(obj) === '[object RegExp]'; }567 -1 function isFunction(obj) { return _class(obj) === '[object Function]'; }568 -1569 -1570 -1 function escapeRE(str) { return str.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&'); }571 -1572 -1 ////////////////////////////////////////////////////////////////////////////////573 -1574 -1575 -1 var defaultOptions = {576 -1 fuzzyLink: true,577 -1 fuzzyEmail: true,578 -1 fuzzyIP: false579 -1 };580 -1581 -1582 -1 function isOptionsObj(obj) {583 -1 return Object.keys(obj || {}).reduce(function (acc, k) {584 -1 return acc || defaultOptions.hasOwnProperty(k);585 -1 }, false);586 -1 }587 -1588 -1589 -1 var defaultSchemas = {590 -1 'http:': {591 -1 validate: function (text, pos, self) {592 -1 var tail = text.slice(pos);593 -1594 -1 if (!self.re.http) {595 -1 // compile lazily, because "host"-containing variables can change on tlds update.596 -1 self.re.http = new RegExp(597 -1 '^\\/\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'598 -1 );599 -1 }600 -1 if (self.re.http.test(tail)) {601 -1 return tail.match(self.re.http)[0].length;602 -1 }603 -1 return 0;604 -1 }605 -1 },606 -1 'https:': 'http:',607 -1 'ftp:': 'http:',608 -1 '//': {609 -1 validate: function (text, pos, self) {610 -1 var tail = text.slice(pos);611 -1612 -1 if (!self.re.no_http) {613 -1 // compile lazily, because "host"-containing variables can change on tlds update.614 -1 self.re.no_http = new RegExp(615 -1 '^' +616 -1 self.re.src_auth +617 -1 // Don't allow single-level domains, because of false positives like '//test'618 -1 // with code comments619 -1 '(?:localhost|(?:(?:' + self.re.src_domain + ')\\.)+' + self.re.src_domain_root + ')' +620 -1 self.re.src_port +621 -1 self.re.src_host_terminator +622 -1 self.re.src_path,623 -1624 -1 'i'625 -1 );626 -1 }627 -1628 -1 if (self.re.no_http.test(tail)) {629 -1 // should not be `://` & `///`, that protects from errors in protocol name630 -1 if (pos >= 3 && text[pos - 3] === ':') { return 0; }631 -1 if (pos >= 3 && text[pos - 3] === '/') { return 0; }632 -1 return tail.match(self.re.no_http)[0].length;633 -1 }634 -1 return 0;635 -1 }636 -1 },637 -1 'mailto:': {638 -1 validate: function (text, pos, self) {639 -1 var tail = text.slice(pos);640 -1641 -1 if (!self.re.mailto) {642 -1 self.re.mailto = new RegExp(643 -1 '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'644 -1 );645 -1 }646 -1 if (self.re.mailto.test(tail)) {647 -1 return tail.match(self.re.mailto)[0].length;648 -1 }649 -1 return 0;650 -1 }651 -1 }652 -1 };653 -1654 -1 /*eslint-disable max-len*/655 -1656 -1 // RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)657 -1 var tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';658 -1659 -1 // DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead660 -1 var tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');661 -1662 -1 /*eslint-enable max-len*/663 -1664 -1 ////////////////////////////////////////////////////////////////////////////////665 -1666 -1 function resetScanCache(self) {667 -1 self.__index__ = -1;668 -1 self.__text_cache__ = '';669 -1 }670 -1671 -1 function createValidator(re) {672 -1 return function (text, pos) {673 -1 var tail = text.slice(pos);674 -1675 -1 if (re.test(tail)) {676 -1 return tail.match(re)[0].length;677 -1 }678 -1 return 0;679 -1 };680 -1 }681 -1682 -1 function createNormalizer() {683 -1 return function (match, self) {684 -1 self.normalize(match);685 -1 };686 -1 }687 -1688 -1 // Schemas compiler. Build regexps.689 -1 //690 -1 function compile(self) {691 -1692 -1 // Load & clone RE patterns.693 -1 var re = self.re = require('./lib/re')(self.__opts__);694 -1695 -1 // Define dynamic patterns696 -1 var tlds = self.__tlds__.slice();697 -1698 -1 self.onCompile();699 -1700 -1 if (!self.__tlds_replaced__) {701 -1 tlds.push(tlds_2ch_src_re);702 -1 }703 -1 tlds.push(re.src_xn);704 -1705 -1 re.src_tlds = tlds.join('|');706 -1707 -1 function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }708 -1709 -1 re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');710 -1 re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');711 -1 re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');712 -1 re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');713 -1714 -1 //715 -1 // Compile each schema716 -1 //717 -1718 -1 var aliases = [];719 -1720 -1 self.__compiled__ = {}; // Reset compiled data721 -1722 -1 function schemaError(name, val) {723 -1 throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);724 -1 }725 -1726 -1 Object.keys(self.__schemas__).forEach(function (name) {727 -1 var val = self.__schemas__[name];728 -1729 -1 // skip disabled methods730 -1 if (val === null) { return; }731 -1732 -1 var compiled = { validate: null, link: null };733 -1734 -1 self.__compiled__[name] = compiled;735 -1736 -1 if (isObject(val)) {737 -1 if (isRegExp(val.validate)) {738 -1 compiled.validate = createValidator(val.validate);739 -1 } else if (isFunction(val.validate)) {740 -1 compiled.validate = val.validate;741 -1 } else {742 -1 schemaError(name, val);743 -1 }744 -1745 -1 if (isFunction(val.normalize)) {746 -1 compiled.normalize = val.normalize;747 -1 } else if (!val.normalize) {748 -1 compiled.normalize = createNormalizer();749 -1 } else {750 -1 schemaError(name, val);751 -1 }752 -1753 -1 return;754 -1 }755 -1756 -1 if (isString(val)) {757 -1 aliases.push(name);758 -1 return;759 -1 }760 -1761 -1 schemaError(name, val);762 -1 });763 -1764 -1 //765 -1 // Compile postponed aliases766 -1 //767 -1768 -1 aliases.forEach(function (alias) {769 -1 if (!self.__compiled__[self.__schemas__[alias]]) {770 -1 // Silently fail on missed schemas to avoid errons on disable.771 -1 // schemaError(alias, self.__schemas__[alias]);772 -1 return;773 -1 }774 -1775 -1 self.__compiled__[alias].validate =776 -1 self.__compiled__[self.__schemas__[alias]].validate;777 -1 self.__compiled__[alias].normalize =778 -1 self.__compiled__[self.__schemas__[alias]].normalize;779 -1 });780 -1781 -1 //782 -1 // Fake record for guessed links783 -1 //784 -1 self.__compiled__[''] = { validate: null, normalize: createNormalizer() };785 -1786 -1 //787 -1 // Build schema condition788 -1 //789 -1 var slist = Object.keys(self.__compiled__)790 -1 .filter(function (name) {791 -1 // Filter disabled & fake schemas792 -1 return name.length > 0 && self.__compiled__[name];793 -1 })794 -1 .map(escapeRE)795 -1 .join('|');796 -1 // (?!_) cause 1.5x slowdown797 -1 self.re.schema_test = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'i');798 -1 self.re.schema_search = RegExp('(^|(?!_)(?:[><]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');799 -1800 -1 self.re.pretest = RegExp(801 -1 '(' + self.re.schema_test.source + ')|' +802 -1 '(' + self.re.host_fuzzy_test.source + ')|' +803 -1 '@',804 -1 'i');805 -1806 -1 //807 -1 // Cleanup808 -1 //809 -1810 -1 resetScanCache(self);811 -1 }812 -1813 -1 /**814 -1 * class Match815 -1 *816 -1 * Match result. Single element of array, returned by [[LinkifyIt#match]]817 -1 **/818 -1 function Match(self, shift) {819 -1 var start = self.__index__,820 -1 end = self.__last_index__,821 -1 text = self.__text_cache__.slice(start, end);822 -1823 -1 /**824 -1 * Match#schema -> String825 -1 *826 -1 * Prefix (protocol) for matched string.827 -1 **/828 -1 this.schema = self.__schema__.toLowerCase();829 -1 /**830 -1 * Match#index -> Number831 -1 *832 -1 * First position of matched string.833 -1 **/834 -1 this.index = start + shift;835 -1 /**836 -1 * Match#lastIndex -> Number837 -1 *838 -1 * Next position after matched string.839 -1 **/840 -1 this.lastIndex = end + shift;841 -1 /**842 -1 * Match#raw -> String843 -1 *844 -1 * Matched string.845 -1 **/846 -1 this.raw = text;847 -1 /**848 -1 * Match#text -> String849 -1 *850 -1 * Notmalized text of matched string.851 -1 **/852 -1 this.text = text;853 -1 /**854 -1 * Match#url -> String855 -1 *856 -1 * Normalized url of matched string.857 -1 **/858 -1 this.url = text;859 -1 }860 -1861 -1 function createMatch(self, shift) {862 -1 var match = new Match(self, shift);863 -1864 -1 self.__compiled__[match.schema].normalize(match, self);865 -1866 -1 return match;867 -1 }868 -1869 -1870 -1 /**871 -1 * class LinkifyIt872 -1 **/873 -1874 -1 /**875 -1 * new LinkifyIt(schemas, options)876 -1 * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)877 -1 * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }878 -1 *879 -1 * Creates new linkifier instance with optional additional schemas.880 -1 * Can be called without `new` keyword for convenience.881 -1 *882 -1 * By default understands:883 -1 *884 -1 * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links885 -1 * - "fuzzy" links and emails (example.com, foo@bar.com).886 -1 *887 -1 * `schemas` is an object, where each key/value describes protocol/rule:888 -1 *889 -1 * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`890 -1 * for example). `linkify-it` makes shure that prefix is not preceeded with891 -1 * alphanumeric char and symbols. Only whitespaces and punctuation allowed.892 -1 * - __value__ - rule to check tail after link prefix893 -1 * - _String_ - just alias to existing rule894 -1 * - _Object_895 -1 * - _validate_ - validator function (should return matched length on success),896 -1 * or `RegExp`.897 -1 * - _normalize_ - optional function to normalize text & url of matched result898 -1 * (for example, for @twitter mentions).899 -1 *900 -1 * `options`:901 -1 *902 -1 * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.903 -1 * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts904 -1 * like version numbers. Default `false`.905 -1 * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.906 -1 *907 -1 **/908 -1 function LinkifyIt(schemas, options) {909 -1 if (!(this instanceof LinkifyIt)) {910 -1 return new LinkifyIt(schemas, options);911 -1 }912 -1913 -1 if (!options) {914 -1 if (isOptionsObj(schemas)) {915 -1 options = schemas;916 -1 schemas = {};917 -1 }918 -1 }919 -1920 -1 this.__opts__ = assign({}, defaultOptions, options);921 -1922 -1 // Cache last tested result. Used to skip repeating steps on next `match` call.923 -1 this.__index__ = -1;924 -1 this.__last_index__ = -1; // Next scan position925 -1 this.__schema__ = '';926 -1 this.__text_cache__ = '';927 -1928 -1 this.__schemas__ = assign({}, defaultSchemas, schemas);929 -1 this.__compiled__ = {};930 -1931 -1 this.__tlds__ = tlds_default;932 -1 this.__tlds_replaced__ = false;933 -1934 -1 this.re = {};935 -1936 -1 compile(this);937 -1 }938 -1939 -1940 -1 /** chainable941 -1 * LinkifyIt#add(schema, definition)942 -1 * - schema (String): rule name (fixed pattern prefix)943 -1 * - definition (String|RegExp|Object): schema definition944 -1 *945 -1 * Add new rule definition. See constructor description for details.946 -1 **/947 -1 LinkifyIt.prototype.add = function add(schema, definition) {948 -1 this.__schemas__[schema] = definition;949 -1 compile(this);950 -1 return this;951 -1 };952 -1953 -1954 -1 /** chainable955 -1 * LinkifyIt#set(options)956 -1 * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }957 -1 *958 -1 * Set recognition options for links without schema.959 -1 **/960 -1 LinkifyIt.prototype.set = function set(options) {961 -1 this.__opts__ = assign(this.__opts__, options);962 -1 return this;963 -1 };964 -1965 -1966 -1 /**967 -1 * LinkifyIt#test(text) -> Boolean968 -1 *969 -1 * Searches linkifiable pattern and returns `true` on success or `false` on fail.970 -1 **/971 -1 LinkifyIt.prototype.test = function test(text) {972 -1 // Reset scan cache973 -1 this.__text_cache__ = text;974 -1 this.__index__ = -1;975 -1976 -1 if (!text.length) { return false; }977 -1978 -1 var m, ml, me, len, shift, next, re, tld_pos, at_pos;979 -1980 -1 // try to scan for link with schema - that's the most simple rule981 -1 if (this.re.schema_test.test(text)) {982 -1 re = this.re.schema_search;983 -1 re.lastIndex = 0;984 -1 while ((m = re.exec(text)) !== null) {985 -1 len = this.testSchemaAt(text, m[2], re.lastIndex);986 -1 if (len) {987 -1 this.__schema__ = m[2];988 -1 this.__index__ = m.index + m[1].length;989 -1 this.__last_index__ = m.index + m[0].length + len;990 -1 break;991 -1 }992 -1 }993 -1 }994 -1995 -1 if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {996 -1 // guess schemaless links997 -1 tld_pos = text.search(this.re.host_fuzzy_test);998 -1 if (tld_pos >= 0) {999 -1 // if tld is located after found link - no need to check fuzzy pattern1000 -1 if (this.__index__ < 0 || tld_pos < this.__index__) {1001 -1 if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {1002 -11003 -1 shift = ml.index + ml[1].length;1004 -11005 -1 if (this.__index__ < 0 || shift < this.__index__) {1006 -1 this.__schema__ = '';1007 -1 this.__index__ = shift;1008 -1 this.__last_index__ = ml.index + ml[0].length;1009 -1 }1010 -1 }1011 -1 }1012 -1 }1013 -1 }1014 -11015 -1 if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {1016 -1 // guess schemaless emails1017 -1 at_pos = text.indexOf('@');1018 -1 if (at_pos >= 0) {1019 -1 // We can't skip this check, because this cases are possible:1020 -1 // 192.168.1.1@gmail.com, my.in@example.com1021 -1 if ((me = text.match(this.re.email_fuzzy)) !== null) {1022 -11023 -1 shift = me.index + me[1].length;1024 -1 next = me.index + me[0].length;1025 -11026 -1 if (this.__index__ < 0 || shift < this.__index__ ||1027 -1 (shift === this.__index__ && next > this.__last_index__)) {1028 -1 this.__schema__ = 'mailto:';1029 -1 this.__index__ = shift;1030 -1 this.__last_index__ = next;1031 -1 }1032 -1 }1033 -1 }1034 -1 }1035 -11036 -1 return this.__index__ >= 0;1037 -1 };1038 -11039 -11040 -1 /**1041 -1 * LinkifyIt#pretest(text) -> Boolean1042 -1 *1043 -1 * Very quick check, that can give false positives. Returns true if link MAY BE1044 -1 * can exists. Can be used for speed optimization, when you need to check that1045 -1 * link NOT exists.1046 -1 **/1047 -1 LinkifyIt.prototype.pretest = function pretest(text) {1048 -1 return this.re.pretest.test(text);1049 -1 };1050 -11051 -11052 -1 /**1053 -1 * LinkifyIt#testSchemaAt(text, name, position) -> Number1054 -1 * - text (String): text to scan1055 -1 * - name (String): rule (schema) name1056 -1 * - position (Number): text offset to check from1057 -1 *1058 -1 * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly1059 -1 * at given position. Returns length of found pattern (0 on fail).1060 -1 **/1061 -1 LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {1062 -1 // If not supported schema check requested - terminate1063 -1 if (!this.__compiled__[schema.toLowerCase()]) {1064 -1 return 0;1065 -1 }1066 -1 return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);1067 -1 };1068 -11069 -11070 -1 /**1071 -1 * LinkifyIt#match(text) -> Array|null1072 -1 *1073 -1 * Returns array of found link descriptions or `null` on fail. We strongly1074 -1 * recommend to use [[LinkifyIt#test]] first, for best speed.1075 -1 *1076 -1 * ##### Result match description1077 -1 *1078 -1 * - __schema__ - link schema, can be empty for fuzzy links, or `//` for1079 -1 * protocol-neutral links.1080 -1 * - __index__ - offset of matched text1081 -1 * - __lastIndex__ - index of next char after mathch end1082 -1 * - __raw__ - matched text1083 -1 * - __text__ - normalized text1084 -1 * - __url__ - link, generated from matched text1085 -1 **/1086 -1 LinkifyIt.prototype.match = function match(text) {1087 -1 var shift = 0, result = [];1088 -11089 -1 // Try to take previous element from cache, if .test() called before1090 -1 if (this.__index__ >= 0 && this.__text_cache__ === text) {1091 -1 result.push(createMatch(this, shift));1092 -1 shift = this.__last_index__;1093 -1 }1094 -11095 -1 // Cut head if cache was used1096 -1 var tail = shift ? text.slice(shift) : text;1097 -11098 -1 // Scan string until end reached1099 -1 while (this.test(tail)) {1100 -1 result.push(createMatch(this, shift));1101 -11102 -1 tail = tail.slice(this.__last_index__);1103 -1 shift += this.__last_index__;1104 -1 }1105 -11106 -1 if (result.length) {1107 -1 return result;1108 -1 }1109 -11110 -1 return null;1111 -1 };1112 -11113 -11114 -1 /** chainable1115 -1 * LinkifyIt#tlds(list [, keepOld]) -> this1116 -1 * - list (Array): list of tlds1117 -1 * - keepOld (Boolean): merge with current list if `true` (`false` by default)1118 -1 *1119 -1 * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)1120 -1 * to avoid false positives. By default this algorythm used:1121 -1 *1122 -1 * - hostname with any 2-letter root zones are ok.1123 -1 * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф1124 -1 * are ok.1125 -1 * - encoded (`xn--...`) root zones are ok.1126 -1 *1127 -1 * If list is replaced, then exact match for 2-chars root zones will be checked.1128 -1 **/1129 -1 LinkifyIt.prototype.tlds = function tlds(list, keepOld) {1130 -1 list = Array.isArray(list) ? list : [ list ];1131 -11132 -1 if (!keepOld) {1133 -1 this.__tlds__ = list.slice();1134 -1 this.__tlds_replaced__ = true;1135 -1 compile(this);1136 -1 return this;1137 -1 }1138 -11139 -1 this.__tlds__ = this.__tlds__.concat(list)1140 -1 .sort()1141 -1 .filter(function (el, idx, arr) {1142 -1 return el !== arr[idx - 1];1143 -1 })1144 -1 .reverse();1145 -11146 -1 compile(this);1147 -1 return this;1148 -1 };1149 -11150 -1 /**1151 -1 * LinkifyIt#normalize(match)1152 -1 *1153 -1 * Default normalizer (if schema does not define it's own).1154 -1 **/1155 -1 LinkifyIt.prototype.normalize = function normalize(match) {1156 -11157 -1 // Do minimal possible changes by default. Need to collect feedback prior1158 -1 // to move forward https://github.com/markdown-it/linkify-it/issues/11159 -11160 -1 if (!match.schema) { match.url = 'http://' + match.url; }1161 -11162 -1 if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {1163 -1 match.url = 'mailto:' + match.url;1164 -1 }1165 -1 };1166 -11167 -11168 -1 /**1169 -1 * LinkifyIt#onCompile()1170 -1 *1171 -1 * Override to modify basic RegExp-s.1172 -1 **/1173 -1 LinkifyIt.prototype.onCompile = function onCompile() {1174 -1 };1175 -11176 -11177 -1 module.exports = LinkifyIt;1178 -11179 -1 },{"./lib/re":4}],4:[function(require,module,exports){1180 -1 'use strict';1181 -11182 -11183 -1 module.exports = function (opts) {1184 -1 var re = {};1185 -11186 -1 // Use direct extract instead of `regenerate` to reduse browserified size1187 -1 re.src_Any = require('uc.micro/properties/Any/regex').source;1188 -1 re.src_Cc = require('uc.micro/categories/Cc/regex').source;1189 -1 re.src_Z = require('uc.micro/categories/Z/regex').source;1190 -1 re.src_P = require('uc.micro/categories/P/regex').source;1191 -11192 -1 // \p{\Z\P\Cc\CF} (white spaces + control + format + punctuation)1193 -1 re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');1194 -11195 -1 // \p{\Z\Cc} (white spaces + control)1196 -1 re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');1197 -11198 -1 // All possible word characters (everything without punctuation, spaces & controls)1199 -1 // Defined via punctuation & spaces to save space1200 -1 // Should be something like \p{\L\N\S\M} (\w but without `_`)1201 -1 re.src_pseudo_letter = '(?:(?!>|<|' + re.src_ZPCc + ')' + re.src_Any + ')';1202 -1 // The same as abothe but without [0-9]1203 -1 // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';1204 -11205 -1 ////////////////////////////////////////////////////////////////////////////////1206 -11207 -1 re.src_ip4 =1208 -11209 -1 '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';1210 -11211 -1 // Prohibit [@/] in user/pass to avoid wrong domain fetch.1212 -1 re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/]).)+@)?';1213 -11214 -1 re.src_port =1215 -11216 -1 '(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?';1217 -11218 -1 re.src_host_terminator =1219 -11220 -1 '(?=$|>|<|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';1221 -11222 -1 re.src_path =1223 -11224 -1 '(?:' +1225 -1 '[/?#]' +1226 -1 '(?:' +1227 -1 '(?!' + re.src_ZCc + '|[()[\\]{}.,"\'?!\\-<>]).|' +1228 -1 '\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +1229 -1 '\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +1230 -1 '\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +1231 -1 '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' +1232 -1 "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" +1233 -1 "\\'(?=" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found1234 -1 '\\.{2,3}[a-zA-Z0-9%/]|' + // github has ... in commit range links. Restrict to1235 -1 // - english1236 -1 // - percent-encoded1237 -1 // - parts of file path1238 -1 // until more examples found.1239 -1 '\\.(?!' + re.src_ZCc + '|[.]).|' +1240 -1 (opts && opts['---'] ?1241 -1 '\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate1242 -1 :1243 -1 '\\-+|'1244 -1 ) +1245 -1 '\\,(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths1246 -1 '\\!(?!' + re.src_ZCc + '|[!]).|' +1247 -1 '\\?(?!' + re.src_ZCc + '|[?]).' +1248 -1 ')+' +1249 -1 '|\\/' +1250 -1 ')?';1251 -11252 -1 re.src_email_name =1253 -11254 -1 '[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+';1255 -11256 -1 re.src_xn =1257 -11258 -1 'xn--[a-z0-9\\-]{1,59}';1259 -11260 -1 // More to read about domain names1261 -1 // http://serverfault.com/questions/638260/1262 -11263 -1 re.src_domain_root =1264 -11265 -1 // Allow letters & digits (http://test1)1266 -1 '(?:' +1267 -1 re.src_xn +1268 -1 '|' +1269 -1 re.src_pseudo_letter + '{1,63}' +1270 -1 ')';1271 -11272 -1 re.src_domain =1273 -11274 -1 '(?:' +1275 -1 re.src_xn +1276 -1 '|' +1277 -1 '(?:' + re.src_pseudo_letter + ')' +1278 -1 '|' +1279 -1 // don't allow `--` in domain names, because:1280 -1 // - that can conflict with markdown — / –1281 -1 // - nobody use those anyway1282 -1 '(?:' + re.src_pseudo_letter + '(?:-(?!-)|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +1283 -1 ')';1284 -11285 -1 re.src_host =1286 -11287 -1 '(?:' +1288 -1 // Don't need IP check, because digits are already allowed in normal domain names1289 -1 // src_ip4 +1290 -1 // '|' +1291 -1 '(?:(?:(?:' + re.src_domain + ')\\.)*' + re.src_domain_root + ')' +1292 -1 ')';1293 -11294 -1 re.tpl_host_fuzzy =1295 -11296 -1 '(?:' +1297 -1 re.src_ip4 +1298 -1 '|' +1299 -1 '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))' +1300 -1 ')';1301 -11302 -1 re.tpl_host_no_ip_fuzzy =1303 -11304 -1 '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))';1305 -11306 -1 re.src_host_strict =1307 -11308 -1 re.src_host + re.src_host_terminator;1309 -11310 -1 re.tpl_host_fuzzy_strict =1311 -11312 -1 re.tpl_host_fuzzy + re.src_host_terminator;1313 -11314 -1 re.src_host_port_strict =1315 -11316 -1 re.src_host + re.src_port + re.src_host_terminator;1317 -11318 -1 re.tpl_host_port_fuzzy_strict =1319 -11320 -1 re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;1321 -11322 -1 re.tpl_host_port_no_ip_fuzzy_strict =1323 -11324 -1 re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;1325 -11326 -11327 -1 ////////////////////////////////////////////////////////////////////////////////1328 -1 // Main rules1329 -11330 -1 // Rude test fuzzy links by host, for quick deny1331 -1 re.tpl_host_fuzzy_test =1332 -11333 -1 'localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';1334 -11335 -1 re.tpl_email_fuzzy =1336 -11337 -1 '(^|<|>|\\(|' + re.src_ZCc + ')(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';1338 -11339 -1 re.tpl_link_fuzzy =1340 -1 // Fuzzy link can't be prepended with .:/\- and non punctuation.1341 -1 // but can start with > (markdown blockquote)1342 -1 '(^|(?![.:/\\-_@])(?:[$+<=>^`|]|' + re.src_ZPCc + '))' +1343 -1 '((?![$+<=>^`|])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';1344 -11345 -1 re.tpl_link_no_ip_fuzzy =1346 -1 // Fuzzy link can't be prepended with .:/\- and non punctuation.1347 -1 // but can start with > (markdown blockquote)1348 -1 '(^|(?![.:/\\-_@])(?:[$+<=>^`|]|' + re.src_ZPCc + '))' +1349 -1 '((?![$+<=>^`|])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';1350 -11351 -1 return re;1352 -1 };1353 -11354 -1 },{"uc.micro/categories/Cc/regex":62,"uc.micro/categories/P/regex":64,"uc.micro/categories/Z/regex":65,"uc.micro/properties/Any/regex":67}],5:[function(require,module,exports){1355 -1 'use strict';1356 -11357 -11358 -1 module.exports = require('./lib/');1359 -11360 -1 },{"./lib/":14}],6:[function(require,module,exports){1361 -1 // HTML5 entities map: { name -> utf16string }1362 -1 //1363 -1 'use strict';1364 -11365 -1 /*eslint quotes:0*/1366 -1 module.exports = require('entities/maps/entities.json');1367 -11368 -1 },{"entities/maps/entities.json":2}],7:[function(require,module,exports){1369 -1 // List of valid html blocks names, accorting to commonmark spec1370 -1 // http://jgm.github.io/CommonMark/spec.html#html-blocks1371 -11372 -1 'use strict';1373 -11374 -11375 -1 module.exports = [1376 -1 'address',1377 -1 'article',1378 -1 'aside',1379 -1 'base',1380 -1 'basefont',1381 -1 'blockquote',1382 -1 'body',1383 -1 'caption',1384 -1 'center',1385 -1 'col',1386 -1 'colgroup',1387 -1 'dd',1388 -1 'details',1389 -1 'dialog',1390 -1 'dir',1391 -1 'div',1392 -1 'dl',1393 -1 'dt',1394 -1 'fieldset',1395 -1 'figcaption',1396 -1 'figure',1397 -1 'footer',1398 -1 'form',1399 -1 'frame',1400 -1 'frameset',1401 -1 'h1',1402 -1 'head',1403 -1 'header',1404 -1 'hr',1405 -1 'html',1406 -1 'iframe',1407 -1 'legend',1408 -1 'li',1409 -1 'link',1410 -1 'main',1411 -1 'menu',1412 -1 'menuitem',1413 -1 'meta',1414 -1 'nav',1415 -1 'noframes',1416 -1 'ol',1417 -1 'optgroup',1418 -1 'option',1419 -1 'p',1420 -1 'param',1421 -1 'pre',1422 -1 'section',1423 -1 'source',1424 -1 'title',1425 -1 'summary',1426 -1 'table',1427 -1 'tbody',1428 -1 'td',1429 -1 'tfoot',1430 -1 'th',1431 -1 'thead',1432 -1 'title',1433 -1 'tr',1434 -1 'track',1435 -1 'ul'1436 -1 ];1437 -11438 -1 },{}],8:[function(require,module,exports){1439 -1 // Regexps to match html elements1440 -11441 -1 'use strict';1442 -11443 -1 var attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';1444 -11445 -1 var unquoted = '[^"\'=<>`\\x00-\\x20]+';1446 -1 var single_quoted = "'[^']*'";1447 -1 var double_quoted = '"[^"]*"';1448 -11449 -1 var attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';1450 -11451 -1 var attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';1452 -11453 -1 var open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';1454 -11455 -1 var close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';1456 -1 var comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';1457 -1 var processing = '<[?].*?[?]>';1458 -1 var declaration = '<![A-Z]+\\s+[^>]*>';1459 -1 var cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';1460 -11461 -1 var HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +1462 -1 '|' + processing + '|' + declaration + '|' + cdata + ')');1463 -1 var HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');1464 -11465 -1 module.exports.HTML_TAG_RE = HTML_TAG_RE;1466 -1 module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;1467 -11468 -1 },{}],9:[function(require,module,exports){1469 -1 // Utilities1470 -1 //1471 -1 'use strict';1472 -11473 -11474 -1 function _class(obj) { return Object.prototype.toString.call(obj); }1475 -11476 -1 function isString(obj) { return _class(obj) === '[object String]'; }1477 -11478 -1 var _hasOwnProperty = Object.prototype.hasOwnProperty;1479 -11480 -1 function has(object, key) {1481 -1 return _hasOwnProperty.call(object, key);1482 -1 }1483 -11484 -1 // Merge objects1485 -1 //1486 -1 function assign(obj /*from1, from2, from3, ...*/) {1487 -1 var sources = Array.prototype.slice.call(arguments, 1);1488 -11489 -1 sources.forEach(function (source) {1490 -1 if (!source) { return; }1491 -11492 -1 if (typeof source !== 'object') {1493 -1 throw new TypeError(source + 'must be object');1494 -1 }1495 -11496 -1 Object.keys(source).forEach(function (key) {1497 -1 obj[key] = source[key];1498 -1 });1499 -1 });1500 -11501 -1 return obj;1502 -1 }1503 -11504 -1 // Remove element from array and put another array at those position.1505 -1 // Useful for some operations with tokens1506 -1 function arrayReplaceAt(src, pos, newElements) {1507 -1 return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));1508 -1 }1509 -11510 -1 ////////////////////////////////////////////////////////////////////////////////1511 -11512 -1 function isValidEntityCode(c) {1513 -1 /*eslint no-bitwise:0*/1514 -1 // broken sequence1515 -1 if (c >= 0xD800 && c <= 0xDFFF) { return false; }1516 -1 // never used1517 -1 if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }1518 -1 if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }1519 -1 // control codes1520 -1 if (c >= 0x00 && c <= 0x08) { return false; }1521 -1 if (c === 0x0B) { return false; }1522 -1 if (c >= 0x0E && c <= 0x1F) { return false; }1523 -1 if (c >= 0x7F && c <= 0x9F) { return false; }1524 -1 // out of range1525 -1 if (c > 0x10FFFF) { return false; }1526 -1 return true;1527 -1 }1528 -11529 -1 function fromCodePoint(c) {1530 -1 /*eslint no-bitwise:0*/1531 -1 if (c > 0xffff) {1532 -1 c -= 0x10000;1533 -1 var surrogate1 = 0xd800 + (c >> 10),1534 -1 surrogate2 = 0xdc00 + (c & 0x3ff);1535 -11536 -1 return String.fromCharCode(surrogate1, surrogate2);1537 -1 }1538 -1 return String.fromCharCode(c);1539 -1 }1540 -11541 -11542 -1 var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g;1543 -1 var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;1544 -1 var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');1545 -11546 -1 var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;1547 -11548 -1 var entities = require('./entities');1549 -11550 -1 function replaceEntityPattern(match, name) {1551 -1 var code = 0;1552 -11553 -1 if (has(entities, name)) {1554 -1 return entities[name];1555 -1 }1556 -11557 -1 if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {1558 -1 code = name[1].toLowerCase() === 'x' ?1559 -1 parseInt(name.slice(2), 16)1560 -1 :1561 -1 parseInt(name.slice(1), 10);1562 -1 if (isValidEntityCode(code)) {1563 -1 return fromCodePoint(code);1564 -1 }1565 -1 }1566 -11567 -1 return match;1568 -1 }1569 -11570 -1 /*function replaceEntities(str) {1571 -1 if (str.indexOf('&') < 0) { return str; }1572 -11573 -1 return str.replace(ENTITY_RE, replaceEntityPattern);1574 -1 }*/1575 -11576 -1 function unescapeMd(str) {1577 -1 if (str.indexOf('\\') < 0) { return str; }1578 -1 return str.replace(UNESCAPE_MD_RE, '$1');1579 -1 }1580 -11581 -1 function unescapeAll(str) {1582 -1 if (str.indexOf('\\') < 0 && str.indexOf('&') < 0) { return str; }1583 -11584 -1 return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {1585 -1 if (escaped) { return escaped; }1586 -1 return replaceEntityPattern(match, entity);1587 -1 });1588 -1 }1589 -11590 -1 ////////////////////////////////////////////////////////////////////////////////1591 -11592 -1 var HTML_ESCAPE_TEST_RE = /[&<>"]/;1593 -1 var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;1594 -1 var HTML_REPLACEMENTS = {1595 -1 '&': '&',1596 -1 '<': '<',1597 -1 '>': '>',1598 -1 '"': '"'1599 -1 };1600 -11601 -1 function replaceUnsafeChar(ch) {1602 -1 return HTML_REPLACEMENTS[ch];1603 -1 }1604 -11605 -1 function escapeHtml(str) {1606 -1 if (HTML_ESCAPE_TEST_RE.test(str)) {1607 -1 return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);1608 -1 }1609 -1 return str;1610 -1 }1611 -11612 -1 ////////////////////////////////////////////////////////////////////////////////1613 -11614 -1 var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;1615 -11616 -1 function escapeRE(str) {1617 -1 return str.replace(REGEXP_ESCAPE_RE, '\\$&');1618 -1 }1619 -11620 -1 ////////////////////////////////////////////////////////////////////////////////1621 -11622 -1 function isSpace(code) {1623 -1 switch (code) {1624 -1 case 0x09:1625 -1 case 0x20:1626 -1 return true;1627 -1 }1628 -1 return false;1629 -1 }1630 -11631 -1 // Zs (unicode class) || [\t\f\v\r\n]1632 -1 function isWhiteSpace(code) {1633 -1 if (code >= 0x2000 && code <= 0x200A) { return true; }1634 -1 switch (code) {1635 -1 case 0x09: // \t1636 -1 case 0x0A: // \n1637 -1 case 0x0B: // \v1638 -1 case 0x0C: // \f1639 -1 case 0x0D: // \r1640 -1 case 0x20:1641 -1 case 0xA0:1642 -1 case 0x1680:1643 -1 case 0x202F:1644 -1 case 0x205F:1645 -1 case 0x3000:1646 -1 return true;1647 -1 }1648 -1 return false;1649 -1 }1650 -11651 -1 ////////////////////////////////////////////////////////////////////////////////1652 -11653 -1 /*eslint-disable max-len*/1654 -1 var UNICODE_PUNCT_RE = require('uc.micro/categories/P/regex');1655 -11656 -1 // Currently without astral characters support.1657 -1 function isPunctChar(ch) {1658 -1 return UNICODE_PUNCT_RE.test(ch);1659 -1 }1660 -11661 -11662 -1 // Markdown ASCII punctuation characters.1663 -1 //1664 -1 // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~1665 -1 // http://spec.commonmark.org/0.15/#ascii-punctuation-character1666 -1 //1667 -1 // Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.1668 -1 //1669 -1 function isMdAsciiPunct(ch) {1670 -1 switch (ch) {1671 -1 case 0x21/* ! */:1672 -1 case 0x22/* " */:1673 -1 case 0x23/* # */:1674 -1 case 0x24/* $ */:1675 -1 case 0x25/* % */:1676 -1 case 0x26/* & */:1677 -1 case 0x27/* ' */:1678 -1 case 0x28/* ( */:1679 -1 case 0x29/* ) */:1680 -1 case 0x2A/* * */:1681 -1 case 0x2B/* + */:1682 -1 case 0x2C/* , */:1683 -1 case 0x2D/* - */:1684 -1 case 0x2E/* . */:1685 -1 case 0x2F/* / */:1686 -1 case 0x3A/* : */:1687 -1 case 0x3B/* ; */:1688 -1 case 0x3C/* < */:1689 -1 case 0x3D/* = */:1690 -1 case 0x3E/* > */:1691 -1 case 0x3F/* ? */:1692 -1 case 0x40/* @ */:1693 -1 case 0x5B/* [ */:1694 -1 case 0x5C/* \ */:1695 -1 case 0x5D/* ] */:1696 -1 case 0x5E/* ^ */:1697 -1 case 0x5F/* _ */:1698 -1 case 0x60/* ` */:1699 -1 case 0x7B/* { */:1700 -1 case 0x7C/* | */:1701 -1 case 0x7D/* } */:1702 -1 case 0x7E/* ~ */:1703 -1 return true;1704 -1 default:1705 -1 return false;1706 -1 }1707 -1 }1708 -11709 -1 // Hepler to unify [reference labels].1710 -1 //1711 -1 function normalizeReference(str) {1712 -1 // use .toUpperCase() instead of .toLowerCase()1713 -1 // here to avoid a conflict with Object.prototype1714 -1 // members (most notably, `__proto__`)1715 -1 return str.trim().replace(/\s+/g, ' ').toUpperCase();1716 -1 }1717 -11718 -1 ////////////////////////////////////////////////////////////////////////////////1719 -11720 -1 // Re-export libraries commonly used in both markdown-it and its plugins,1721 -1 // so plugins won't have to depend on them explicitly, which reduces their1722 -1 // bundled size (e.g. a browser build).1723 -1 //1724 -1 exports.lib = {};1725 -1 exports.lib.mdurl = require('mdurl');1726 -1 exports.lib.ucmicro = require('uc.micro');1727 -11728 -1 exports.assign = assign;1729 -1 exports.isString = isString;1730 -1 exports.has = has;1731 -1 exports.unescapeMd = unescapeMd;1732 -1 exports.unescapeAll = unescapeAll;1733 -1 exports.isValidEntityCode = isValidEntityCode;1734 -1 exports.fromCodePoint = fromCodePoint;1735 -1 // exports.replaceEntities = replaceEntities;1736 -1 exports.escapeHtml = escapeHtml;1737 -1 exports.arrayReplaceAt = arrayReplaceAt;1738 -1 exports.isSpace = isSpace;1739 -1 exports.isWhiteSpace = isWhiteSpace;1740 -1 exports.isMdAsciiPunct = isMdAsciiPunct;1741 -1 exports.isPunctChar = isPunctChar;1742 -1 exports.escapeRE = escapeRE;1743 -1 exports.normalizeReference = normalizeReference;1744 -11745 -1 },{"./entities":6,"mdurl":60,"uc.micro":66,"uc.micro/categories/P/regex":64}],10:[function(require,module,exports){1746 -1 // Just a shortcut for bulk export1747 -1 'use strict';1748 -11749 -11750 -1 exports.parseLinkLabel = require('./parse_link_label');1751 -1 exports.parseLinkDestination = require('./parse_link_destination');1752 -1 exports.parseLinkTitle = require('./parse_link_title');1753 -11754 -1 },{"./parse_link_destination":11,"./parse_link_label":12,"./parse_link_title":13}],11:[function(require,module,exports){1755 -1 // Parse link destination1756 -1 //1757 -1 'use strict';1758 -11759 -11760 -1 var isSpace = require('../common/utils').isSpace;1761 -1 var unescapeAll = require('../common/utils').unescapeAll;1762 -11763 -11764 -1 module.exports = function parseLinkDestination(str, pos, max) {1765 -1 var code, level,1766 -1 lines = 0,1767 -1 start = pos,1768 -1 result = {1769 -1 ok: false,1770 -1 pos: 0,1771 -1 lines: 0,1772 -1 str: ''1773 -1 };1774 -11775 -1 if (str.charCodeAt(pos) === 0x3C /* < */) {1776 -1 pos++;1777 -1 while (pos < max) {1778 -1 code = str.charCodeAt(pos);1779 -1 if (code === 0x0A /* \n */ || isSpace(code)) { return result; }1780 -1 if (code === 0x3E /* > */) {1781 -1 result.pos = pos + 1;1782 -1 result.str = unescapeAll(str.slice(start + 1, pos));1783 -1 result.ok = true;1784 -1 return result;1785 -1 }1786 -1 if (code === 0x5C /* \ */ && pos + 1 < max) {1787 -1 pos += 2;1788 -1 continue;1789 -1 }1790 -11791 -1 pos++;1792 -1 }1793 -11794 -1 // no closing '>'1795 -1 return result;1796 -1 }1797 -11798 -1 // this should be ... } else { ... branch1799 -11800 -1 level = 0;1801 -1 while (pos < max) {1802 -1 code = str.charCodeAt(pos);1803 -11804 -1 if (code === 0x20) { break; }1805 -11806 -1 // ascii control characters1807 -1 if (code < 0x20 || code === 0x7F) { break; }1808 -11809 -1 if (code === 0x5C /* \ */ && pos + 1 < max) {1810 -1 pos += 2;1811 -1 continue;1812 -1 }1813 -11814 -1 if (code === 0x28 /* ( */) {1815 -1 level++;1816 -1 if (level > 1) { break; }1817 -1 }1818 -11819 -1 if (code === 0x29 /* ) */) {1820 -1 level--;1821 -1 if (level < 0) { break; }1822 -1 }1823 -11824 -1 pos++;1825 -1 }1826 -11827 -1 if (start === pos) { return result; }1828 -11829 -1 result.str = unescapeAll(str.slice(start, pos));1830 -1 result.lines = lines;1831 -1 result.pos = pos;1832 -1 result.ok = true;1833 -1 return result;1834 -1 };1835 -11836 -1 },{"../common/utils":9}],12:[function(require,module,exports){1837 -1 // Parse link label1838 -1 //1839 -1 // this function assumes that first character ("[") already matches;1840 -1 // returns the end of the label1841 -1 //1842 -1 'use strict';1843 -11844 -1 module.exports = function parseLinkLabel(state, start, disableNested) {1845 -1 var level, found, marker, prevPos,1846 -1 labelEnd = -1,1847 -1 max = state.posMax,1848 -1 oldPos = state.pos;1849 -11850 -1 state.pos = start + 1;1851 -1 level = 1;1852 -11853 -1 while (state.pos < max) {1854 -1 marker = state.src.charCodeAt(state.pos);1855 -1 if (marker === 0x5D /* ] */) {1856 -1 level--;1857 -1 if (level === 0) {1858 -1 found = true;1859 -1 break;1860 -1 }1861 -1 }1862 -11863 -1 prevPos = state.pos;1864 -1 state.md.inline.skipToken(state);1865 -1 if (marker === 0x5B /* [ */) {1866 -1 if (prevPos === state.pos - 1) {1867 -1 // increase level if we find text `[`, which is not a part of any token1868 -1 level++;1869 -1 } else if (disableNested) {1870 -1 state.pos = oldPos;1871 -1 return -1;1872 -1 }1873 -1 }1874 -1 }1875 -11876 -1 if (found) {1877 -1 labelEnd = state.pos;1878 -1 }1879 -11880 -1 // restore old state1881 -1 state.pos = oldPos;1882 -11883 -1 return labelEnd;1884 -1 };1885 -11886 -1 },{}],13:[function(require,module,exports){1887 -1 // Parse link title1888 -1 //1889 -1 'use strict';1890 -11891 -11892 -1 var unescapeAll = require('../common/utils').unescapeAll;1893 -11894 -11895 -1 module.exports = function parseLinkTitle(str, pos, max) {1896 -1 var code,1897 -1 marker,1898 -1 lines = 0,1899 -1 start = pos,1900 -1 result = {1901 -1 ok: false,1902 -1 pos: 0,1903 -1 lines: 0,1904 -1 str: ''1905 -1 };1906 -11907 -1 if (pos >= max) { return result; }1908 -11909 -1 marker = str.charCodeAt(pos);1910 -11911 -1 if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }1912 -11913 -1 pos++;1914 -11915 -1 // if opening marker is "(", switch it to closing marker ")"1916 -1 if (marker === 0x28) { marker = 0x29; }1917 -11918 -1 while (pos < max) {1919 -1 code = str.charCodeAt(pos);1920 -1 if (code === marker) {1921 -1 result.pos = pos + 1;1922 -1 result.lines = lines;1923 -1 result.str = unescapeAll(str.slice(start + 1, pos));1924 -1 result.ok = true;1925 -1 return result;1926 -1 } else if (code === 0x0A) {1927 -1 lines++;1928 -1 } else if (code === 0x5C /* \ */ && pos + 1 < max) {1929 -1 pos++;1930 -1 if (str.charCodeAt(pos) === 0x0A) {1931 -1 lines++;1932 -1 }1933 -1 }1934 -11935 -1 pos++;1936 -1 }1937 -11938 -1 return result;1939 -1 };1940 -11941 -1 },{"../common/utils":9}],14:[function(require,module,exports){1942 -1 // Main parser class1943 -11944 -1 'use strict';1945 -11946 -11947 -1 var utils = require('./common/utils');1948 -1 var helpers = require('./helpers');1949 -1 var Renderer = require('./renderer');1950 -1 var ParserCore = require('./parser_core');1951 -1 var ParserBlock = require('./parser_block');1952 -1 var ParserInline = require('./parser_inline');1953 -1 var LinkifyIt = require('linkify-it');1954 -1 var mdurl = require('mdurl');1955 -1 var punycode = require('punycode');1956 -11957 -11958 -1 var config = {1959 -1 'default': require('./presets/default'),1960 -1 zero: require('./presets/zero'),1961 -1 commonmark: require('./presets/commonmark')1962 -1 };1963 -11964 -1 ////////////////////////////////////////////////////////////////////////////////1965 -1 //1966 -1 // This validator can prohibit more than really needed to prevent XSS. It's a1967 -1 // tradeoff to keep code simple and to be secure by default.1968 -1 //1969 -1 // If you need different setup - override validator method as you wish. Or1970 -1 // replace it with dummy function and use external sanitizer.1971 -1 //1972 -11973 -1 var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;1974 -1 var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;1975 -11976 -1 function validateLink(url) {1977 -1 // url should be normalized at this point, and existing entities are decoded1978 -1 var str = url.trim().toLowerCase();1979 -11980 -1 return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;1981 -1 }1982 -11983 -1 ////////////////////////////////////////////////////////////////////////////////1984 -11985 -11986 -1 var RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];1987 -11988 -1 function normalizeLink(url) {1989 -1 var parsed = mdurl.parse(url, true);1990 -11991 -1 if (parsed.hostname) {1992 -1 // Encode hostnames in urls like:1993 -1 // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`1994 -1 //1995 -1 // We don't encode unknown schemas, because it's likely that we encode1996 -1 // something we shouldn't (e.g. `skype:name` treated as `skype:host`)1997 -1 //1998 -1 if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {1999 -1 try {2000 -1 parsed.hostname = punycode.toASCII(parsed.hostname);2001 -1 } catch (er) { /**/ }2002 -1 }2003 -1 }2004 -12005 -1 return mdurl.encode(mdurl.format(parsed));2006 -1 }2007 -12008 -1 function normalizeLinkText(url) {2009 -1 var parsed = mdurl.parse(url, true);2010 -12011 -1 if (parsed.hostname) {2012 -1 // Encode hostnames in urls like:2013 -1 // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`2014 -1 //2015 -1 // We don't encode unknown schemas, because it's likely that we encode2016 -1 // something we shouldn't (e.g. `skype:name` treated as `skype:host`)2017 -1 //2018 -1 if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {2019 -1 try {2020 -1 parsed.hostname = punycode.toUnicode(parsed.hostname);2021 -1 } catch (er) { /**/ }2022 -1 }2023 -1 }2024 -12025 -1 return mdurl.decode(mdurl.format(parsed));2026 -1 }2027 -12028 -12029 -1 /**2030 -1 * class MarkdownIt2031 -1 *2032 -1 * Main parser/renderer class.2033 -1 *2034 -1 * ##### Usage2035 -1 *2036 -1 * ```javascript2037 -1 * // node.js, "classic" way:2038 -1 * var MarkdownIt = require('markdown-it'),2039 -1 * md = new MarkdownIt();2040 -1 * var result = md.render('# markdown-it rulezz!');2041 -1 *2042 -1 * // node.js, the same, but with sugar:2043 -1 * var md = require('markdown-it')();2044 -1 * var result = md.render('# markdown-it rulezz!');2045 -1 *2046 -1 * // browser without AMD, added to "window" on script load2047 -1 * // Note, there are no dash.2048 -1 * var md = window.markdownit();2049 -1 * var result = md.render('# markdown-it rulezz!');2050 -1 * ```2051 -1 *2052 -1 * Single line rendering, without paragraph wrap:2053 -1 *2054 -1 * ```javascript2055 -1 * var md = require('markdown-it')();2056 -1 * var result = md.renderInline('__markdown-it__ rulezz!');2057 -1 * ```2058 -1 **/2059 -12060 -1 /**2061 -1 * new MarkdownIt([presetName, options])2062 -1 * - presetName (String): optional, `commonmark` / `zero`2063 -1 * - options (Object)2064 -1 *2065 -1 * Creates parser instanse with given config. Can be called without `new`.2066 -1 *2067 -1 * ##### presetName2068 -1 *2069 -1 * MarkdownIt provides named presets as a convenience to quickly2070 -1 * enable/disable active syntax rules and options for common use cases.2071 -1 *2072 -1 * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -2073 -1 * configures parser to strict [CommonMark](http://commonmark.org/) mode.2074 -1 * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -2075 -1 * similar to GFM, used when no preset name given. Enables all available rules,2076 -1 * but still without html, typographer & autolinker.2077 -1 * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -2078 -1 * all rules disabled. Useful to quickly setup your config via `.enable()`.2079 -1 * For example, when you need only `bold` and `italic` markup and nothing else.2080 -1 *2081 -1 * ##### options:2082 -1 *2083 -1 * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!2084 -1 * That's not safe! You may need external sanitizer to protect output from XSS.2085 -1 * It's better to extend features via plugins, instead of enabling HTML.2086 -1 * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags2087 -1 * (`<br />`). This is needed only for full CommonMark compatibility. In real2088 -1 * world you will need HTML output.2089 -1 * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `<br>`.2090 -1 * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.2091 -1 * Can be useful for external highlighters.2092 -1 * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.2093 -1 * - __typographer__ - `false`. Set `true` to enable [some language-neutral2094 -1 * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +2095 -1 * quotes beautification (smartquotes).2096 -1 * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement2097 -1 * pairs, when typographer enabled and smartquotes on. For example, you can2098 -1 * use `'«»„“'` for Russian, `'„“‚‘'` for German, and2099 -1 * `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).2100 -1 * - __highlight__ - `null`. Highlighter function for fenced code blocks.2101 -1 * Highlighter `function (str, lang)` should return escaped HTML. It can also2102 -1 * return empty string if the source was not changed and should be escaped2103 -1 * externaly. If result starts with <pre... internal wrapper is skipped.2104 -1 *2105 -1 * ##### Example2106 -1 *2107 -1 * ```javascript2108 -1 * // commonmark mode2109 -1 * var md = require('markdown-it')('commonmark');2110 -1 *2111 -1 * // default mode2112 -1 * var md = require('markdown-it')();2113 -1 *2114 -1 * // enable everything2115 -1 * var md = require('markdown-it')({2116 -1 * html: true,2117 -1 * linkify: true,2118 -1 * typographer: true2119 -1 * });2120 -1 * ```2121 -1 *2122 -1 * ##### Syntax highlighting2123 -1 *2124 -1 * ```js2125 -1 * var hljs = require('highlight.js') // https://highlightjs.org/2126 -1 *2127 -1 * var md = require('markdown-it')({2128 -1 * highlight: function (str, lang) {2129 -1 * if (lang && hljs.getLanguage(lang)) {2130 -1 * try {2131 -1 * return hljs.highlight(lang, str, true).value;2132 -1 * } catch (__) {}2133 -1 * }2134 -1 *2135 -1 * return ''; // use external default escaping2136 -1 * }2137 -1 * });2138 -1 * ```2139 -1 *2140 -1 * Or with full wrapper override (if you need assign class to `<pre>`):2141 -1 *2142 -1 * ```javascript2143 -1 * var hljs = require('highlight.js') // https://highlightjs.org/2144 -1 *2145 -1 * // Actual default values2146 -1 * var md = require('markdown-it')({2147 -1 * highlight: function (str, lang) {2148 -1 * if (lang && hljs.getLanguage(lang)) {2149 -1 * try {2150 -1 * return '<pre class="hljs"><code>' +2151 -1 * hljs.highlight(lang, str, true).value +2152 -1 * '</code></pre>';2153 -1 * } catch (__) {}2154 -1 * }2155 -1 *2156 -1 * return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';2157 -1 * }2158 -1 * });2159 -1 * ```2160 -1 *2161 -1 **/2162 -1 function MarkdownIt(presetName, options) {2163 -1 if (!(this instanceof MarkdownIt)) {2164 -1 return new MarkdownIt(presetName, options);2165 -1 }2166 -12167 -1 if (!options) {2168 -1 if (!utils.isString(presetName)) {2169 -1 options = presetName || {};2170 -1 presetName = 'default';2171 -1 }2172 -1 }2173 -12174 -1 /**2175 -1 * MarkdownIt#inline -> ParserInline2176 -1 *2177 -1 * Instance of [[ParserInline]]. You may need it to add new rules when2178 -1 * writing plugins. For simple rules control use [[MarkdownIt.disable]] and2179 -1 * [[MarkdownIt.enable]].2180 -1 **/2181 -1 this.inline = new ParserInline();2182 -12183 -1 /**2184 -1 * MarkdownIt#block -> ParserBlock2185 -1 *2186 -1 * Instance of [[ParserBlock]]. You may need it to add new rules when2187 -1 * writing plugins. For simple rules control use [[MarkdownIt.disable]] and2188 -1 * [[MarkdownIt.enable]].2189 -1 **/2190 -1 this.block = new ParserBlock();2191 -12192 -1 /**2193 -1 * MarkdownIt#core -> Core2194 -1 *2195 -1 * Instance of [[Core]] chain executor. You may need it to add new rules when2196 -1 * writing plugins. For simple rules control use [[MarkdownIt.disable]] and2197 -1 * [[MarkdownIt.enable]].2198 -1 **/2199 -1 this.core = new ParserCore();2200 -12201 -1 /**2202 -1 * MarkdownIt#renderer -> Renderer2203 -1 *2204 -1 * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering2205 -1 * rules for new token types, generated by plugins.2206 -1 *2207 -1 * ##### Example2208 -1 *2209 -1 * ```javascript2210 -1 * var md = require('markdown-it')();2211 -1 *2212 -1 * function myToken(tokens, idx, options, env, self) {2213 -1 * //...2214 -1 * return result;2215 -1 * };2216 -1 *2217 -1 * md.renderer.rules['my_token'] = myToken2218 -1 * ```2219 -1 *2220 -1 * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).2221 -1 **/2222 -1 this.renderer = new Renderer();2223 -12224 -1 /**2225 -1 * MarkdownIt#linkify -> LinkifyIt2226 -1 *2227 -1 * [linkify-it](https://github.com/markdown-it/linkify-it) instance.2228 -1 * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)2229 -1 * rule.2230 -1 **/2231 -1 this.linkify = new LinkifyIt();2232 -12233 -1 /**2234 -1 * MarkdownIt#validateLink(url) -> Boolean2235 -1 *2236 -1 * Link validation function. CommonMark allows too much in links. By default2237 -1 * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas2238 -1 * except some embedded image types.2239 -1 *2240 -1 * You can change this behaviour:2241 -1 *2242 -1 * ```javascript2243 -1 * var md = require('markdown-it')();2244 -1 * // enable everything2245 -1 * md.validateLink = function () { return true; }2246 -1 * ```2247 -1 **/2248 -1 this.validateLink = validateLink;2249 -12250 -1 /**2251 -1 * MarkdownIt#normalizeLink(url) -> String2252 -1 *2253 -1 * Function used to encode link url to a machine-readable format,2254 -1 * which includes url-encoding, punycode, etc.2255 -1 **/2256 -1 this.normalizeLink = normalizeLink;2257 -12258 -1 /**2259 -1 * MarkdownIt#normalizeLinkText(url) -> String2260 -1 *2261 -1 * Function used to decode link url to a human-readable format`2262 -1 **/2263 -1 this.normalizeLinkText = normalizeLinkText;2264 -12265 -12266 -1 // Expose utils & helpers for easy acces from plugins2267 -12268 -1 /**2269 -1 * MarkdownIt#utils -> utils2270 -1 *2271 -1 * Assorted utility functions, useful to write plugins. See details2272 -1 * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).2273 -1 **/2274 -1 this.utils = utils;2275 -12276 -1 /**2277 -1 * MarkdownIt#helpers -> helpers2278 -1 *2279 -1 * Link components parser functions, useful to write plugins. See details2280 -1 * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).2281 -1 **/2282 -1 this.helpers = helpers;2283 -12284 -12285 -1 this.options = {};2286 -1 this.configure(presetName);2287 -12288 -1 if (options) { this.set(options); }2289 -1 }2290 -12291 -12292 -1 /** chainable2293 -1 * MarkdownIt.set(options)2294 -1 *2295 -1 * Set parser options (in the same format as in constructor). Probably, you2296 -1 * will never need it, but you can change options after constructor call.2297 -1 *2298 -1 * ##### Example2299 -1 *2300 -1 * ```javascript2301 -1 * var md = require('markdown-it')()2302 -1 * .set({ html: true, breaks: true })2303 -1 * .set({ typographer, true });2304 -1 * ```2305 -1 *2306 -1 * __Note:__ To achieve the best possible performance, don't modify a2307 -1 * `markdown-it` instance options on the fly. If you need multiple configurations2308 -1 * it's best to create multiple instances and initialize each with separate2309 -1 * config.2310 -1 **/2311 -1 MarkdownIt.prototype.set = function (options) {2312 -1 utils.assign(this.options, options);2313 -1 return this;2314 -1 };2315 -12316 -12317 -1 /** chainable, internal2318 -1 * MarkdownIt.configure(presets)2319 -1 *2320 -1 * Batch load of all options and compenent settings. This is internal method,2321 -1 * and you probably will not need it. But if you with - see available presets2322 -1 * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)2323 -1 *2324 -1 * We strongly recommend to use presets instead of direct config loads. That2325 -1 * will give better compatibility with next versions.2326 -1 **/2327 -1 MarkdownIt.prototype.configure = function (presets) {2328 -1 var self = this, presetName;2329 -12330 -1 if (utils.isString(presets)) {2331 -1 presetName = presets;2332 -1 presets = config[presetName];2333 -1 if (!presets) { throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name'); }2334 -1 }2335 -12336 -1 if (!presets) { throw new Error('Wrong `markdown-it` preset, can\'t be empty'); }2337 -12338 -1 if (presets.options) { self.set(presets.options); }2339 -12340 -1 if (presets.components) {2341 -1 Object.keys(presets.components).forEach(function (name) {2342 -1 if (presets.components[name].rules) {2343 -1 self[name].ruler.enableOnly(presets.components[name].rules);2344 -1 }2345 -1 if (presets.components[name].rules2) {2346 -1 self[name].ruler2.enableOnly(presets.components[name].rules2);2347 -1 }2348 -1 });2349 -1 }2350 -1 return this;2351 -1 };2352 -12353 -12354 -1 /** chainable2355 -1 * MarkdownIt.enable(list, ignoreInvalid)2356 -1 * - list (String|Array): rule name or list of rule names to enable2357 -1 * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.2358 -1 *2359 -1 * Enable list or rules. It will automatically find appropriate components,2360 -1 * containing rules with given names. If rule not found, and `ignoreInvalid`2361 -1 * not set - throws exception.2362 -1 *2363 -1 * ##### Example2364 -1 *2365 -1 * ```javascript2366 -1 * var md = require('markdown-it')()2367 -1 * .enable(['sub', 'sup'])2368 -1 * .disable('smartquotes');2369 -1 * ```2370 -1 **/2371 -1 MarkdownIt.prototype.enable = function (list, ignoreInvalid) {2372 -1 var result = [];2373 -12374 -1 if (!Array.isArray(list)) { list = [ list ]; }2375 -12376 -1 [ 'core', 'block', 'inline' ].forEach(function (chain) {2377 -1 result = result.concat(this[chain].ruler.enable(list, true));2378 -1 }, this);2379 -12380 -1 result = result.concat(this.inline.ruler2.enable(list, true));2381 -12382 -1 var missed = list.filter(function (name) { return result.indexOf(name) < 0; });2383 -12384 -1 if (missed.length && !ignoreInvalid) {2385 -1 throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);2386 -1 }2387 -12388 -1 return this;2389 -1 };2390 -12391 -12392 -1 /** chainable2393 -1 * MarkdownIt.disable(list, ignoreInvalid)2394 -1 * - list (String|Array): rule name or list of rule names to disable.2395 -1 * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.2396 -1 *2397 -1 * The same as [[MarkdownIt.enable]], but turn specified rules off.2398 -1 **/2399 -1 MarkdownIt.prototype.disable = function (list, ignoreInvalid) {2400 -1 var result = [];2401 -12402 -1 if (!Array.isArray(list)) { list = [ list ]; }2403 -12404 -1 [ 'core', 'block', 'inline' ].forEach(function (chain) {2405 -1 result = result.concat(this[chain].ruler.disable(list, true));2406 -1 }, this);2407 -12408 -1 result = result.concat(this.inline.ruler2.disable(list, true));2409 -12410 -1 var missed = list.filter(function (name) { return result.indexOf(name) < 0; });2411 -12412 -1 if (missed.length && !ignoreInvalid) {2413 -1 throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);2414 -1 }2415 -1 return this;2416 -1 };2417 -12418 -12419 -1 /** chainable2420 -1 * MarkdownIt.use(plugin, params)2421 -1 *2422 -1 * Load specified plugin with given params into current parser instance.2423 -1 * It's just a sugar to call `plugin(md, params)` with curring.2424 -1 *2425 -1 * ##### Example2426 -1 *2427 -1 * ```javascript2428 -1 * var iterator = require('markdown-it-for-inline');2429 -1 * var md = require('markdown-it')()2430 -1 * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {2431 -1 * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');2432 -1 * });2433 -1 * ```2434 -1 **/2435 -1 MarkdownIt.prototype.use = function (plugin /*, params, ... */) {2436 -1 var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));2437 -1 plugin.apply(plugin, args);2438 -1 return this;2439 -1 };2440 -12441 -12442 -1 /** internal2443 -1 * MarkdownIt.parse(src, env) -> Array2444 -1 * - src (String): source string2445 -1 * - env (Object): environment sandbox2446 -1 *2447 -1 * Parse input string and returns list of block tokens (special token type2448 -1 * "inline" will contain list of inline tokens). You should not call this2449 -1 * method directly, until you write custom renderer (for example, to produce2450 -1 * AST).2451 -1 *2452 -1 * `env` is used to pass data between "distributed" rules and return additional2453 -1 * metadata like reference info, needed for the renderer. It also can be used to2454 -1 * inject data in specific cases. Usually, you will be ok to pass `{}`,2455 -1 * and then pass updated object to renderer.2456 -1 **/2457 -1 MarkdownIt.prototype.parse = function (src, env) {2458 -1 var state = new this.core.State(src, this, env);2459 -12460 -1 this.core.process(state);2461 -12462 -1 return state.tokens;2463 -1 };2464 -12465 -12466 -1 /**2467 -1 * MarkdownIt.render(src [, env]) -> String2468 -1 * - src (String): source string2469 -1 * - env (Object): environment sandbox2470 -1 *2471 -1 * Render markdown string into html. It does all magic for you :).2472 -1 *2473 -1 * `env` can be used to inject additional metadata (`{}` by default).2474 -1 * But you will not need it with high probability. See also comment2475 -1 * in [[MarkdownIt.parse]].2476 -1 **/2477 -1 MarkdownIt.prototype.render = function (src, env) {2478 -1 env = env || {};2479 -12480 -1 return this.renderer.render(this.parse(src, env), this.options, env);2481 -1 };2482 -12483 -12484 -1 /** internal2485 -1 * MarkdownIt.parseInline(src, env) -> Array2486 -1 * - src (String): source string2487 -1 * - env (Object): environment sandbox2488 -1 *2489 -1 * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the2490 -1 * block tokens list with the single `inline` element, containing parsed inline2491 -1 * tokens in `children` property. Also updates `env` object.2492 -1 **/2493 -1 MarkdownIt.prototype.parseInline = function (src, env) {2494 -1 var state = new this.core.State(src, this, env);2495 -12496 -1 state.inlineMode = true;2497 -1 this.core.process(state);2498 -12499 -1 return state.tokens;2500 -1 };2501 -12502 -12503 -1 /**2504 -1 * MarkdownIt.renderInline(src [, env]) -> String2505 -1 * - src (String): source string2506 -1 * - env (Object): environment sandbox2507 -1 *2508 -1 * Similar to [[MarkdownIt.render]] but for single paragraph content. Result2509 -1 * will NOT be wrapped into `<p>` tags.2510 -1 **/2511 -1 MarkdownIt.prototype.renderInline = function (src, env) {2512 -1 env = env || {};2513 -12514 -1 return this.renderer.render(this.parseInline(src, env), this.options, env);2515 -1 };2516 -12517 -12518 -1 module.exports = MarkdownIt;2519 -12520 -1 },{"./common/utils":9,"./helpers":10,"./parser_block":15,"./parser_core":16,"./parser_inline":17,"./presets/commonmark":18,"./presets/default":19,"./presets/zero":20,"./renderer":21,"linkify-it":3,"mdurl":60,"punycode":1}],15:[function(require,module,exports){2521 -1 /** internal2522 -1 * class ParserBlock2523 -1 *2524 -1 * Block-level tokenizer.2525 -1 **/2526 -1 'use strict';2527 -12528 -12529 -1 var Ruler = require('./ruler');2530 -12531 -12532 -1 var _rules = [2533 -1 // First 2 params - rule name & source. Secondary array - list of rules,2534 -1 // which can be terminated by this one.2535 -1 [ 'table', require('./rules_block/table'), [ 'paragraph', 'reference' ] ],2536 -1 [ 'code', require('./rules_block/code') ],2537 -1 [ 'fence', require('./rules_block/fence'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],2538 -1 [ 'blockquote', require('./rules_block/blockquote'), [ 'paragraph', 'reference', 'list' ] ],2539 -1 [ 'hr', require('./rules_block/hr'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],2540 -1 [ 'list', require('./rules_block/list'), [ 'paragraph', 'reference', 'blockquote' ] ],2541 -1 [ 'reference', require('./rules_block/reference') ],2542 -1 [ 'heading', require('./rules_block/heading'), [ 'paragraph', 'reference', 'blockquote' ] ],2543 -1 [ 'lheading', require('./rules_block/lheading') ],2544 -1 [ 'html_block', require('./rules_block/html_block'), [ 'paragraph', 'reference', 'blockquote' ] ],2545 -1 [ 'paragraph', require('./rules_block/paragraph') ]2546 -1 ];2547 -12548 -12549 -1 /**2550 -1 * new ParserBlock()2551 -1 **/2552 -1 function ParserBlock() {2553 -1 /**2554 -1 * ParserBlock#ruler -> Ruler2555 -1 *2556 -1 * [[Ruler]] instance. Keep configuration of block rules.2557 -1 **/2558 -1 this.ruler = new Ruler();2559 -12560 -1 for (var i = 0; i < _rules.length; i++) {2561 -1 this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });2562 -1 }2563 -1 }2564 -12565 -12566 -1 // Generate tokens for input range2567 -1 //2568 -1 ParserBlock.prototype.tokenize = function (state, startLine, endLine) {2569 -1 var ok, i,2570 -1 rules = this.ruler.getRules(''),2571 -1 len = rules.length,2572 -1 line = startLine,2573 -1 hasEmptyLines = false,2574 -1 maxNesting = state.md.options.maxNesting;2575 -12576 -1 while (line < endLine) {2577 -1 state.line = line = state.skipEmptyLines(line);2578 -1 if (line >= endLine) { break; }2579 -12580 -1 // Termination condition for nested calls.2581 -1 // Nested calls currently used for blockquotes & lists2582 -1 if (state.sCount[line] < state.blkIndent) { break; }2583 -12584 -1 // If nesting level exceeded - skip tail to the end. That's not ordinary2585 -1 // situation and we should not care about content.2586 -1 if (state.level >= maxNesting) {2587 -1 state.line = endLine;2588 -1 break;2589 -1 }2590 -12591 -1 // Try all possible rules.2592 -1 // On success, rule should:2593 -1 //2594 -1 // - update `state.line`2595 -1 // - update `state.tokens`2596 -1 // - return true2597 -12598 -1 for (i = 0; i < len; i++) {2599 -1 ok = rules[i](state, line, endLine, false);2600 -1 if (ok) { break; }2601 -1 }2602 -12603 -1 // set state.tight iff we had an empty line before current tag2604 -1 // i.e. latest empty line should not count2605 -1 state.tight = !hasEmptyLines;2606 -12607 -1 // paragraph might "eat" one newline after it in nested lists2608 -1 if (state.isEmpty(state.line - 1)) {2609 -1 hasEmptyLines = true;2610 -1 }2611 -12612 -1 line = state.line;2613 -12614 -1 if (line < endLine && state.isEmpty(line)) {2615 -1 hasEmptyLines = true;2616 -1 line++;2617 -12618 -1 // two empty lines should stop the parser in list mode2619 -1 if (line < endLine && state.parentType === 'list' && state.isEmpty(line)) { break; }2620 -1 state.line = line;2621 -1 }2622 -1 }2623 -1 };2624 -12625 -12626 -1 /**2627 -1 * ParserBlock.parse(str, md, env, outTokens)2628 -1 *2629 -1 * Process input string and push block tokens into `outTokens`2630 -1 **/2631 -1 ParserBlock.prototype.parse = function (src, md, env, outTokens) {2632 -1 var state;2633 -12634 -1 if (!src) { return; }2635 -12636 -1 state = new this.State(src, md, env, outTokens);2637 -12638 -1 this.tokenize(state, state.line, state.lineMax);2639 -1 };2640 -12641 -12642 -1 ParserBlock.prototype.State = require('./rules_block/state_block');2643 -12644 -12645 -1 module.exports = ParserBlock;2646 -12647 -1 },{"./ruler":22,"./rules_block/blockquote":23,"./rules_block/code":24,"./rules_block/fence":25,"./rules_block/heading":26,"./rules_block/hr":27,"./rules_block/html_block":28,"./rules_block/lheading":29,"./rules_block/list":30,"./rules_block/paragraph":31,"./rules_block/reference":32,"./rules_block/state_block":33,"./rules_block/table":34}],16:[function(require,module,exports){2648 -1 /** internal2649 -1 * class Core2650 -1 *2651 -1 * Top-level rules executor. Glues block/inline parsers and does intermediate2652 -1 * transformations.2653 -1 **/2654 -1 'use strict';2655 -12656 -12657 -1 var Ruler = require('./ruler');2658 -12659 -12660 -1 var _rules = [2661 -1 [ 'normalize', require('./rules_core/normalize') ],2662 -1 [ 'block', require('./rules_core/block') ],2663 -1 [ 'inline', require('./rules_core/inline') ],2664 -1 [ 'linkify', require('./rules_core/linkify') ],2665 -1 [ 'replacements', require('./rules_core/replacements') ],2666 -1 [ 'smartquotes', require('./rules_core/smartquotes') ]2667 -1 ];2668 -12669 -12670 -1 /**2671 -1 * new Core()2672 -1 **/2673 -1 function Core() {2674 -1 /**2675 -1 * Core#ruler -> Ruler2676 -1 *2677 -1 * [[Ruler]] instance. Keep configuration of core rules.2678 -1 **/2679 -1 this.ruler = new Ruler();2680 -12681 -1 for (var i = 0; i < _rules.length; i++) {2682 -1 this.ruler.push(_rules[i][0], _rules[i][1]);2683 -1 }2684 -1 }2685 -12686 -12687 -1 /**2688 -1 * Core.process(state)2689 -1 *2690 -1 * Executes core chain rules.2691 -1 **/2692 -1 Core.prototype.process = function (state) {2693 -1 var i, l, rules;2694 -12695 -1 rules = this.ruler.getRules('');2696 -12697 -1 for (i = 0, l = rules.length; i < l; i++) {2698 -1 rules[i](state);2699 -1 }2700 -1 };2701 -12702 -1 Core.prototype.State = require('./rules_core/state_core');2703 -12704 -12705 -1 module.exports = Core;2706 -12707 -1 },{"./ruler":22,"./rules_core/block":35,"./rules_core/inline":36,"./rules_core/linkify":37,"./rules_core/normalize":38,"./rules_core/replacements":39,"./rules_core/smartquotes":40,"./rules_core/state_core":41}],17:[function(require,module,exports){2708 -1 /** internal2709 -1 * class ParserInline2710 -1 *2711 -1 * Tokenizes paragraph content.2712 -1 **/2713 -1 'use strict';2714 -12715 -12716 -1 var Ruler = require('./ruler');2717 -12718 -12719 -1 ////////////////////////////////////////////////////////////////////////////////2720 -1 // Parser rules2721 -12722 -1 var _rules = [2723 -1 [ 'text', require('./rules_inline/text') ],2724 -1 [ 'newline', require('./rules_inline/newline') ],2725 -1 [ 'escape', require('./rules_inline/escape') ],2726 -1 [ 'backticks', require('./rules_inline/backticks') ],2727 -1 [ 'strikethrough', require('./rules_inline/strikethrough').tokenize ],2728 -1 [ 'emphasis', require('./rules_inline/emphasis').tokenize ],2729 -1 [ 'link', require('./rules_inline/link') ],2730 -1 [ 'image', require('./rules_inline/image') ],2731 -1 [ 'autolink', require('./rules_inline/autolink') ],2732 -1 [ 'html_inline', require('./rules_inline/html_inline') ],2733 -1 [ 'entity', require('./rules_inline/entity') ]2734 -1 ];2735 -12736 -1 var _rules2 = [2737 -1 [ 'balance_pairs', require('./rules_inline/balance_pairs') ],2738 -1 [ 'strikethrough', require('./rules_inline/strikethrough').postProcess ],2739 -1 [ 'emphasis', require('./rules_inline/emphasis').postProcess ],2740 -1 [ 'text_collapse', require('./rules_inline/text_collapse') ]2741 -1 ];2742 -12743 -12744 -1 /**2745 -1 * new ParserInline()2746 -1 **/2747 -1 function ParserInline() {2748 -1 var i;2749 -12750 -1 /**2751 -1 * ParserInline#ruler -> Ruler2752 -1 *2753 -1 * [[Ruler]] instance. Keep configuration of inline rules.2754 -1 **/2755 -1 this.ruler = new Ruler();2756 -12757 -1 for (i = 0; i < _rules.length; i++) {2758 -1 this.ruler.push(_rules[i][0], _rules[i][1]);2759 -1 }2760 -12761 -1 /**2762 -1 * ParserInline#ruler2 -> Ruler2763 -1 *2764 -1 * [[Ruler]] instance. Second ruler used for post-processing2765 -1 * (e.g. in emphasis-like rules).2766 -1 **/2767 -1 this.ruler2 = new Ruler();2768 -12769 -1 for (i = 0; i < _rules2.length; i++) {2770 -1 this.ruler2.push(_rules2[i][0], _rules2[i][1]);2771 -1 }2772 -1 }2773 -12774 -12775 -1 // Skip single token by running all rules in validation mode;2776 -1 // returns `true` if any rule reported success2777 -1 //2778 -1 ParserInline.prototype.skipToken = function (state) {2779 -1 var ok, i, pos = state.pos,2780 -1 rules = this.ruler.getRules(''),2781 -1 len = rules.length,2782 -1 maxNesting = state.md.options.maxNesting,2783 -1 cache = state.cache;2784 -12785 -12786 -1 if (typeof cache[pos] !== 'undefined') {2787 -1 state.pos = cache[pos];2788 -1 return;2789 -1 }2790 -12791 -1 if (state.level < maxNesting) {2792 -1 for (i = 0; i < len; i++) {2793 -1 // Increment state.level and decrement it later to limit recursion.2794 -1 // It's harmless to do here, because no tokens are created. But ideally,2795 -1 // we'd need a separate private state variable for this purpose.2796 -1 //2797 -1 state.level++;2798 -1 ok = rules[i](state, true);2799 -1 state.level--;2800 -12801 -1 if (ok) { break; }2802 -1 }2803 -1 } else {2804 -1 // Too much nesting, just skip until the end of the paragraph.2805 -1 //2806 -1 // NOTE: this will cause links to behave incorrectly in the following case,2807 -1 // when an amount of `[` is exactly equal to `maxNesting + 1`:2808 -1 //2809 -1 // [[[[[[[[[[[[[[[[[[[[[foo]()2810 -1 //2811 -1 // TODO: remove this workaround when CM standard will allow nested links2812 -1 // (we can replace it by preventing links from being parsed in2813 -1 // validation mode)2814 -1 //2815 -1 state.pos = state.posMax;2816 -1 }2817 -12818 -1 if (!ok) { state.pos++; }2819 -1 cache[pos] = state.pos;2820 -1 };2821 -12822 -12823 -1 // Generate tokens for input range2824 -1 //2825 -1 ParserInline.prototype.tokenize = function (state) {2826 -1 var ok, i,2827 -1 rules = this.ruler.getRules(''),2828 -1 len = rules.length,2829 -1 end = state.posMax,2830 -1 maxNesting = state.md.options.maxNesting;2831 -12832 -1 while (state.pos < end) {2833 -1 // Try all possible rules.2834 -1 // On success, rule should:2835 -1 //2836 -1 // - update `state.pos`2837 -1 // - update `state.tokens`2838 -1 // - return true2839 -12840 -1 if (state.level < maxNesting) {2841 -1 for (i = 0; i < len; i++) {2842 -1 ok = rules[i](state, false);2843 -1 if (ok) { break; }2844 -1 }2845 -1 }2846 -12847 -1 if (ok) {2848 -1 if (state.pos >= end) { break; }2849 -1 continue;2850 -1 }2851 -12852 -1 state.pending += state.src[state.pos++];2853 -1 }2854 -12855 -1 if (state.pending) {2856 -1 state.pushPending();2857 -1 }2858 -1 };2859 -12860 -12861 -1 /**2862 -1 * ParserInline.parse(str, md, env, outTokens)2863 -1 *2864 -1 * Process input string and push inline tokens into `outTokens`2865 -1 **/2866 -1 ParserInline.prototype.parse = function (str, md, env, outTokens) {2867 -1 var i, rules, len;2868 -1 var state = new this.State(str, md, env, outTokens);2869 -12870 -1 this.tokenize(state);2871 -12872 -1 rules = this.ruler2.getRules('');2873 -1 len = rules.length;2874 -12875 -1 for (i = 0; i < len; i++) {2876 -1 rules[i](state);2877 -1 }2878 -1 };2879 -12880 -12881 -1 ParserInline.prototype.State = require('./rules_inline/state_inline');2882 -12883 -12884 -1 module.exports = ParserInline;2885 -12886 -1 },{"./ruler":22,"./rules_inline/autolink":42,"./rules_inline/backticks":43,"./rules_inline/balance_pairs":44,"./rules_inline/emphasis":45,"./rules_inline/entity":46,"./rules_inline/escape":47,"./rules_inline/html_inline":48,"./rules_inline/image":49,"./rules_inline/link":50,"./rules_inline/newline":51,"./rules_inline/state_inline":52,"./rules_inline/strikethrough":53,"./rules_inline/text":54,"./rules_inline/text_collapse":55}],18:[function(require,module,exports){2887 -1 // Commonmark default options2888 -12889 -1 'use strict';2890 -12891 -12892 -1 module.exports = {2893 -1 options: {2894 -1 html: true, // Enable HTML tags in source2895 -1 xhtmlOut: true, // Use '/' to close single tags (<br />)2896 -1 breaks: false, // Convert '\n' in paragraphs into <br>2897 -1 langPrefix: 'language-', // CSS language prefix for fenced blocks2898 -1 linkify: false, // autoconvert URL-like texts to links2899 -12900 -1 // Enable some language-neutral replacements + quotes beautification2901 -1 typographer: false,2902 -12903 -1 // Double + single quotes replacement pairs, when typographer enabled,2904 -1 // and smartquotes on. Could be either a String or an Array.2905 -1 //2906 -1 // For example, you can use '«»„“' for Russian, '„“‚‘' for German,2907 -1 // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).2908 -1 quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */2909 -12910 -1 // Highlighter function. Should return escaped HTML,2911 -1 // or '' if the source string is not changed and should be escaped externaly.2912 -1 // If result starts with <pre... internal wrapper is skipped.2913 -1 //2914 -1 // function (/*str, lang*/) { return ''; }2915 -1 //2916 -1 highlight: null,2917 -12918 -1 maxNesting: 20 // Internal protection, recursion limit2919 -1 },2920 -12921 -1 components: {2922 -12923 -1 core: {2924 -1 rules: [2925 -1 'normalize',2926 -1 'block',2927 -1 'inline'2928 -1 ]2929 -1 },2930 -12931 -1 block: {2932 -1 rules: [2933 -1 'blockquote',2934 -1 'code',2935 -1 'fence',2936 -1 'heading',2937 -1 'hr',2938 -1 'html_block',2939 -1 'lheading',2940 -1 'list',2941 -1 'reference',2942 -1 'paragraph'2943 -1 ]2944 -1 },2945 -12946 -1 inline: {2947 -1 rules: [2948 -1 'autolink',2949 -1 'backticks',2950 -1 'emphasis',2951 -1 'entity',2952 -1 'escape',2953 -1 'html_inline',2954 -1 'image',2955 -1 'link',2956 -1 'newline',2957 -1 'text'2958 -1 ],2959 -1 rules2: [2960 -1 'balance_pairs',2961 -1 'emphasis',2962 -1 'text_collapse'2963 -1 ]2964 -1 }2965 -1 }2966 -1 };2967 -12968 -1 },{}],19:[function(require,module,exports){2969 -1 // markdown-it default options2970 -12971 -1 'use strict';2972 -12973 -12974 -1 module.exports = {2975 -1 options: {2976 -1 html: false, // Enable HTML tags in source2977 -1 xhtmlOut: false, // Use '/' to close single tags (<br />)2978 -1 breaks: false, // Convert '\n' in paragraphs into <br>2979 -1 langPrefix: 'language-', // CSS language prefix for fenced blocks2980 -1 linkify: false, // autoconvert URL-like texts to links2981 -12982 -1 // Enable some language-neutral replacements + quotes beautification2983 -1 typographer: false,2984 -12985 -1 // Double + single quotes replacement pairs, when typographer enabled,2986 -1 // and smartquotes on. Could be either a String or an Array.2987 -1 //2988 -1 // For example, you can use '«»„“' for Russian, '„“‚‘' for German,2989 -1 // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).2990 -1 quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */2991 -12992 -1 // Highlighter function. Should return escaped HTML,2993 -1 // or '' if the source string is not changed and should be escaped externaly.2994 -1 // If result starts with <pre... internal wrapper is skipped.2995 -1 //2996 -1 // function (/*str, lang*/) { return ''; }2997 -1 //2998 -1 highlight: null,2999 -13000 -1 maxNesting: 100 // Internal protection, recursion limit3001 -1 },3002 -13003 -1 components: {3004 -13005 -1 core: {},3006 -1 block: {},3007 -1 inline: {}3008 -1 }3009 -1 };3010 -13011 -1 },{}],20:[function(require,module,exports){3012 -1 // "Zero" preset, with nothing enabled. Useful for manual configuring of simple3013 -1 // modes. For example, to parse bold/italic only.3014 -13015 -1 'use strict';3016 -13017 -13018 -1 module.exports = {3019 -1 options: {3020 -1 html: false, // Enable HTML tags in source3021 -1 xhtmlOut: false, // Use '/' to close single tags (<br />)3022 -1 breaks: false, // Convert '\n' in paragraphs into <br>3023 -1 langPrefix: 'language-', // CSS language prefix for fenced blocks3024 -1 linkify: false, // autoconvert URL-like texts to links3025 -13026 -1 // Enable some language-neutral replacements + quotes beautification3027 -1 typographer: false,3028 -13029 -1 // Double + single quotes replacement pairs, when typographer enabled,3030 -1 // and smartquotes on. Could be either a String or an Array.3031 -1 //3032 -1 // For example, you can use '«»„“' for Russian, '„“‚‘' for German,3033 -1 // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).3034 -1 quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */3035 -13036 -1 // Highlighter function. Should return escaped HTML,3037 -1 // or '' if the source string is not changed and should be escaped externaly.3038 -1 // If result starts with <pre... internal wrapper is skipped.3039 -1 //3040 -1 // function (/*str, lang*/) { return ''; }3041 -1 //3042 -1 highlight: null,3043 -13044 -1 maxNesting: 20 // Internal protection, recursion limit3045 -1 },3046 -13047 -1 components: {3048 -13049 -1 core: {3050 -1 rules: [3051 -1 'normalize',3052 -1 'block',3053 -1 'inline'3054 -1 ]3055 -1 },3056 -13057 -1 block: {3058 -1 rules: [3059 -1 'paragraph'3060 -1 ]3061 -1 },3062 -13063 -1 inline: {3064 -1 rules: [3065 -1 'text'3066 -1 ],3067 -1 rules2: [3068 -1 'balance_pairs',3069 -1 'text_collapse'3070 -1 ]3071 -1 }3072 -1 }3073 -1 };3074 -13075 -1 },{}],21:[function(require,module,exports){3076 -1 /**3077 -1 * class Renderer3078 -1 *3079 -1 * Generates HTML from parsed token stream. Each instance has independent3080 -1 * copy of rules. Those can be rewritten with ease. Also, you can add new3081 -1 * rules if you create plugin and adds new token types.3082 -1 **/3083 -1 'use strict';3084 -13085 -13086 -1 var assign = require('./common/utils').assign;3087 -1 var unescapeAll = require('./common/utils').unescapeAll;3088 -1 var escapeHtml = require('./common/utils').escapeHtml;3089 -13090 -13091 -1 ////////////////////////////////////////////////////////////////////////////////3092 -13093 -1 var default_rules = {};3094 -13095 -13096 -1 default_rules.code_inline = function (tokens, idx, options, env, slf) {3097 -1 var token = tokens[idx],3098 -1 attrs = slf.renderAttrs(token);3099 -13100 -1 return '<code' + (attrs ? ' ' + attrs : '') + '>' +3101 -1 escapeHtml(tokens[idx].content) +3102 -1 '</code>';3103 -1 };3104 -13105 -13106 -1 default_rules.code_block = function (tokens, idx, options, env, slf) {3107 -1 var token = tokens[idx],3108 -1 attrs = slf.renderAttrs(token);3109 -13110 -1 return '<pre' + (attrs ? ' ' + attrs : '') + '><code>' +3111 -1 escapeHtml(tokens[idx].content) +3112 -1 '</code></pre>\n';3113 -1 };3114 -13115 -13116 -1 default_rules.fence = function (tokens, idx, options, env, slf) {3117 -1 var token = tokens[idx],3118 -1 info = token.info ? unescapeAll(token.info).trim() : '',3119 -1 langName = '',3120 -1 highlighted, i, tmpAttrs, tmpToken;3121 -13122 -1 if (info) {3123 -1 langName = info.split(/\s+/g)[0];3124 -1 }3125 -13126 -1 if (options.highlight) {3127 -1 highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);3128 -1 } else {3129 -1 highlighted = escapeHtml(token.content);3130 -1 }3131 -13132 -1 if (highlighted.indexOf('<pre') === 0) {3133 -1 return highlighted + '\n';3134 -1 }3135 -13136 -1 // If language exists, inject class gently, without mudofying original token.3137 -1 // May be, one day we will add .clone() for token and simplify this part, but3138 -1 // now we prefer to keep things local.3139 -1 if (info) {3140 -1 i = token.attrIndex('class');3141 -1 tmpAttrs = token.attrs ? token.attrs.slice() : [];3142 -13143 -1 if (i < 0) {3144 -1 tmpAttrs.push([ 'class', options.langPrefix + langName ]);3145 -1 } else {3146 -1 tmpAttrs[i] += ' ' + options.langPrefix + langName;3147 -1 }3148 -13149 -1 // Fake token just to render attributes3150 -1 tmpToken = {3151 -1 attrs: tmpAttrs3152 -1 };3153 -13154 -1 return '<pre><code' + slf.renderAttrs(tmpToken) + '>'3155 -1 + highlighted3156 -1 + '</code></pre>\n';3157 -1 }3158 -13159 -13160 -1 return '<pre><code' + slf.renderAttrs(token) + '>'3161 -1 + highlighted3162 -1 + '</code></pre>\n';3163 -1 };3164 -13165 -13166 -1 default_rules.image = function (tokens, idx, options, env, slf) {3167 -1 var token = tokens[idx];3168 -13169 -1 // "alt" attr MUST be set, even if empty. Because it's mandatory and3170 -1 // should be placed on proper position for tests.3171 -1 //3172 -1 // Replace content with actual value3173 -13174 -1 token.attrs[token.attrIndex('alt')][1] =3175 -1 slf.renderInlineAsText(token.children, options, env);3176 -13177 -1 return slf.renderToken(tokens, idx, options);3178 -1 };3179 -13180 -13181 -1 default_rules.hardbreak = function (tokens, idx, options /*, env */) {3182 -1 return options.xhtmlOut ? '<br />\n' : '<br>\n';3183 -1 };3184 -1 default_rules.softbreak = function (tokens, idx, options /*, env */) {3185 -1 return options.breaks ? (options.xhtmlOut ? '<br />\n' : '<br>\n') : '\n';3186 -1 };3187 -13188 -13189 -1 default_rules.text = function (tokens, idx /*, options, env */) {3190 -1 return escapeHtml(tokens[idx].content);3191 -1 };3192 -13193 -13194 -1 default_rules.html_block = function (tokens, idx /*, options, env */) {3195 -1 return tokens[idx].content;3196 -1 };3197 -1 default_rules.html_inline = function (tokens, idx /*, options, env */) {3198 -1 return tokens[idx].content;3199 -1 };3200 -13201 -13202 -1 /**3203 -1 * new Renderer()3204 -1 *3205 -1 * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.3206 -1 **/3207 -1 function Renderer() {3208 -13209 -1 /**3210 -1 * Renderer#rules -> Object3211 -1 *3212 -1 * Contains render rules for tokens. Can be updated and extended.3213 -1 *3214 -1 * ##### Example3215 -1 *3216 -1 * ```javascript3217 -1 * var md = require('markdown-it')();3218 -1 *3219 -1 * md.renderer.rules.strong_open = function () { return '<b>'; };3220 -1 * md.renderer.rules.strong_close = function () { return '</b>'; };3221 -1 *3222 -1 * var result = md.renderInline(...);3223 -1 * ```3224 -1 *3225 -1 * Each rule is called as independed static function with fixed signature:3226 -1 *3227 -1 * ```javascript3228 -1 * function my_token_render(tokens, idx, options, env, renderer) {3229 -1 * // ...3230 -1 * return renderedHTML;3231 -1 * }3232 -1 * ```3233 -1 *3234 -1 * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)3235 -1 * for more details and examples.3236 -1 **/3237 -1 this.rules = assign({}, default_rules);3238 -1 }3239 -13240 -13241 -1 /**3242 -1 * Renderer.renderAttrs(token) -> String3243 -1 *3244 -1 * Render token attributes to string.3245 -1 **/3246 -1 Renderer.prototype.renderAttrs = function renderAttrs(token) {3247 -1 var i, l, result;3248 -13249 -1 if (!token.attrs) { return ''; }3250 -13251 -1 result = '';3252 -13253 -1 for (i = 0, l = token.attrs.length; i < l; i++) {3254 -1 result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';3255 -1 }3256 -13257 -1 return result;3258 -1 };3259 -13260 -13261 -1 /**3262 -1 * Renderer.renderToken(tokens, idx, options) -> String3263 -1 * - tokens (Array): list of tokens3264 -1 * - idx (Numbed): token index to render3265 -1 * - options (Object): params of parser instance3266 -1 *3267 -1 * Default token renderer. Can be overriden by custom function3268 -1 * in [[Renderer#rules]].3269 -1 **/3270 -1 Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {3271 -1 var nextToken,3272 -1 result = '',3273 -1 needLf = false,3274 -1 token = tokens[idx];3275 -13276 -1 // Tight list paragraphs3277 -1 if (token.hidden) {3278 -1 return '';3279 -1 }3280 -13281 -1 // Insert a newline between hidden paragraph and subsequent opening3282 -1 // block-level tag.3283 -1 //3284 -1 // For example, here we should insert a newline before blockquote:3285 -1 // - a3286 -1 // >3287 -1 //3288 -1 if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {3289 -1 result += '\n';3290 -1 }3291 -13292 -1 // Add token name, e.g. `<img`3293 -1 result += (token.nesting === -1 ? '</' : '<') + token.tag;3294 -13295 -1 // Encode attributes, e.g. `<img src="foo"`3296 -1 result += this.renderAttrs(token);3297 -13298 -1 // Add a slash for self-closing tags, e.g. `<img src="foo" /`3299 -1 if (token.nesting === 0 && options.xhtmlOut) {3300 -1 result += ' /';3301 -1 }3302 -13303 -1 // Check if we need to add a newline after this tag3304 -1 if (token.block) {3305 -1 needLf = true;3306 -13307 -1 if (token.nesting === 1) {3308 -1 if (idx + 1 < tokens.length) {3309 -1 nextToken = tokens[idx + 1];3310 -13311 -1 if (nextToken.type === 'inline' || nextToken.hidden) {3312 -1 // Block-level tag containing an inline tag.3313 -1 //3314 -1 needLf = false;3315 -13316 -1 } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {3317 -1 // Opening tag + closing tag of the same type. E.g. `<li></li>`.3318 -1 //3319 -1 needLf = false;3320 -1 }3321 -1 }3322 -1 }3323 -1 }3324 -13325 -1 result += needLf ? '>\n' : '>';3326 -13327 -1 return result;3328 -1 };3329 -13330 -13331 -1 /**3332 -1 * Renderer.renderInline(tokens, options, env) -> String3333 -1 * - tokens (Array): list on block tokens to renter3334 -1 * - options (Object): params of parser instance3335 -1 * - env (Object): additional data from parsed input (references, for example)3336 -1 *3337 -1 * The same as [[Renderer.render]], but for single token of `inline` type.3338 -1 **/3339 -1 Renderer.prototype.renderInline = function (tokens, options, env) {3340 -1 var type,3341 -1 result = '',3342 -1 rules = this.rules;3343 -13344 -1 for (var i = 0, len = tokens.length; i < len; i++) {3345 -1 type = tokens[i].type;3346 -13347 -1 if (typeof rules[type] !== 'undefined') {3348 -1 result += rules[type](tokens, i, options, env, this);3349 -1 } else {3350 -1 result += this.renderToken(tokens, i, options);3351 -1 }3352 -1 }3353 -13354 -1 return result;3355 -1 };3356 -13357 -13358 -1 /** internal3359 -1 * Renderer.renderInlineAsText(tokens, options, env) -> String3360 -1 * - tokens (Array): list on block tokens to renter3361 -1 * - options (Object): params of parser instance3362 -1 * - env (Object): additional data from parsed input (references, for example)3363 -1 *3364 -1 * Special kludge for image `alt` attributes to conform CommonMark spec.3365 -1 * Don't try to use it! Spec requires to show `alt` content with stripped markup,3366 -1 * instead of simple escaping.3367 -1 **/3368 -1 Renderer.prototype.renderInlineAsText = function (tokens, options, env) {3369 -1 var result = '';3370 -13371 -1 for (var i = 0, len = tokens.length; i < len; i++) {3372 -1 if (tokens[i].type === 'text') {3373 -1 result += tokens[i].content;3374 -1 } else if (tokens[i].type === 'image') {3375 -1 result += this.renderInlineAsText(tokens[i].children, options, env);3376 -1 }3377 -1 }3378 -13379 -1 return result;3380 -1 };3381 -13382 -13383 -1 /**3384 -1 * Renderer.render(tokens, options, env) -> String3385 -1 * - tokens (Array): list on block tokens to renter3386 -1 * - options (Object): params of parser instance3387 -1 * - env (Object): additional data from parsed input (references, for example)3388 -1 *3389 -1 * Takes token stream and generates HTML. Probably, you will never need to call3390 -1 * this method directly.3391 -1 **/3392 -1 Renderer.prototype.render = function (tokens, options, env) {3393 -1 var i, len, type,3394 -1 result = '',3395 -1 rules = this.rules;3396 -13397 -1 for (i = 0, len = tokens.length; i < len; i++) {3398 -1 type = tokens[i].type;3399 -13400 -1 if (type === 'inline') {3401 -1 result += this.renderInline(tokens[i].children, options, env);3402 -1 } else if (typeof rules[type] !== 'undefined') {3403 -1 result += rules[tokens[i].type](tokens, i, options, env, this);3404 -1 } else {3405 -1 result += this.renderToken(tokens, i, options, env);3406 -1 }3407 -1 }3408 -13409 -1 return result;3410 -1 };3411 -13412 -1 module.exports = Renderer;3413 -13414 -1 },{"./common/utils":9}],22:[function(require,module,exports){3415 -1 /**3416 -1 * class Ruler3417 -1 *3418 -1 * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and3419 -1 * [[MarkdownIt#inline]] to manage sequences of functions (rules):3420 -1 *3421 -1 * - keep rules in defined order3422 -1 * - assign the name to each rule3423 -1 * - enable/disable rules3424 -1 * - add/replace rules3425 -1 * - allow assign rules to additional named chains (in the same)3426 -1 * - cacheing lists of active rules3427 -1 *3428 -1 * You will not need use this class directly until write plugins. For simple3429 -1 * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and3430 -1 * [[MarkdownIt.use]].3431 -1 **/3432 -1 'use strict';3433 -13434 -13435 -1 /**3436 -1 * new Ruler()3437 -1 **/3438 -1 function Ruler() {3439 -1 // List of added rules. Each element is:3440 -1 //3441 -1 // {3442 -1 // name: XXX,3443 -1 // enabled: Boolean,3444 -1 // fn: Function(),3445 -1 // alt: [ name2, name3 ]3446 -1 // }3447 -1 //3448 -1 this.__rules__ = [];3449 -13450 -1 // Cached rule chains.3451 -1 //3452 -1 // First level - chain name, '' for default.3453 -1 // Second level - diginal anchor for fast filtering by charcodes.3454 -1 //3455 -1 this.__cache__ = null;3456 -1 }3457 -13458 -1 ////////////////////////////////////////////////////////////////////////////////3459 -1 // Helper methods, should not be used directly3460 -13461 -13462 -1 // Find rule index by name3463 -1 //3464 -1 Ruler.prototype.__find__ = function (name) {3465 -1 for (var i = 0; i < this.__rules__.length; i++) {3466 -1 if (this.__rules__[i].name === name) {3467 -1 return i;3468 -1 }3469 -1 }3470 -1 return -1;3471 -1 };3472 -13473 -13474 -1 // Build rules lookup cache3475 -1 //3476 -1 Ruler.prototype.__compile__ = function () {3477 -1 var self = this;3478 -1 var chains = [ '' ];3479 -13480 -1 // collect unique names3481 -1 self.__rules__.forEach(function (rule) {3482 -1 if (!rule.enabled) { return; }3483 -13484 -1 rule.alt.forEach(function (altName) {3485 -1 if (chains.indexOf(altName) < 0) {3486 -1 chains.push(altName);3487 -1 }3488 -1 });3489 -1 });3490 -13491 -1 self.__cache__ = {};3492 -13493 -1 chains.forEach(function (chain) {3494 -1 self.__cache__[chain] = [];3495 -1 self.__rules__.forEach(function (rule) {3496 -1 if (!rule.enabled) { return; }3497 -13498 -1 if (chain && rule.alt.indexOf(chain) < 0) { return; }3499 -13500 -1 self.__cache__[chain].push(rule.fn);3501 -1 });3502 -1 });3503 -1 };3504 -13505 -13506 -1 /**3507 -1 * Ruler.at(name, fn [, options])3508 -1 * - name (String): rule name to replace.3509 -1 * - fn (Function): new rule function.3510 -1 * - options (Object): new rule options (not mandatory).3511 -1 *3512 -1 * Replace rule by name with new function & options. Throws error if name not3513 -1 * found.3514 -1 *3515 -1 * ##### Options:3516 -1 *3517 -1 * - __alt__ - array with names of "alternate" chains.3518 -1 *3519 -1 * ##### Example3520 -1 *3521 -1 * Replace existing typorgapher replacement rule with new one:3522 -1 *3523 -1 * ```javascript3524 -1 * var md = require('markdown-it')();3525 -1 *3526 -1 * md.core.ruler.at('replacements', function replace(state) {3527 -1 * //...3528 -1 * });3529 -1 * ```3530 -1 **/3531 -1 Ruler.prototype.at = function (name, fn, options) {3532 -1 var index = this.__find__(name);3533 -1 var opt = options || {};3534 -13535 -1 if (index === -1) { throw new Error('Parser rule not found: ' + name); }3536 -13537 -1 this.__rules__[index].fn = fn;3538 -1 this.__rules__[index].alt = opt.alt || [];3539 -1 this.__cache__ = null;3540 -1 };3541 -13542 -13543 -1 /**3544 -1 * Ruler.before(beforeName, ruleName, fn [, options])3545 -1 * - beforeName (String): new rule will be added before this one.3546 -1 * - ruleName (String): name of added rule.3547 -1 * - fn (Function): rule function.3548 -1 * - options (Object): rule options (not mandatory).3549 -1 *3550 -1 * Add new rule to chain before one with given name. See also3551 -1 * [[Ruler.after]], [[Ruler.push]].3552 -1 *3553 -1 * ##### Options:3554 -1 *3555 -1 * - __alt__ - array with names of "alternate" chains.3556 -1 *3557 -1 * ##### Example3558 -1 *3559 -1 * ```javascript3560 -1 * var md = require('markdown-it')();3561 -1 *3562 -1 * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {3563 -1 * //...3564 -1 * });3565 -1 * ```3566 -1 **/3567 -1 Ruler.prototype.before = function (beforeName, ruleName, fn, options) {3568 -1 var index = this.__find__(beforeName);3569 -1 var opt = options || {};3570 -13571 -1 if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }3572 -13573 -1 this.__rules__.splice(index, 0, {3574 -1 name: ruleName,3575 -1 enabled: true,3576 -1 fn: fn,3577 -1 alt: opt.alt || []3578 -1 });3579 -13580 -1 this.__cache__ = null;3581 -1 };3582 -13583 -13584 -1 /**3585 -1 * Ruler.after(afterName, ruleName, fn [, options])3586 -1 * - afterName (String): new rule will be added after this one.3587 -1 * - ruleName (String): name of added rule.3588 -1 * - fn (Function): rule function.3589 -1 * - options (Object): rule options (not mandatory).3590 -1 *3591 -1 * Add new rule to chain after one with given name. See also3592 -1 * [[Ruler.before]], [[Ruler.push]].3593 -1 *3594 -1 * ##### Options:3595 -1 *3596 -1 * - __alt__ - array with names of "alternate" chains.3597 -1 *3598 -1 * ##### Example3599 -1 *3600 -1 * ```javascript3601 -1 * var md = require('markdown-it')();3602 -1 *3603 -1 * md.inline.ruler.after('text', 'my_rule', function replace(state) {3604 -1 * //...3605 -1 * });3606 -1 * ```3607 -1 **/3608 -1 Ruler.prototype.after = function (afterName, ruleName, fn, options) {3609 -1 var index = this.__find__(afterName);3610 -1 var opt = options || {};3611 -13612 -1 if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }3613 -13614 -1 this.__rules__.splice(index + 1, 0, {3615 -1 name: ruleName,3616 -1 enabled: true,3617 -1 fn: fn,3618 -1 alt: opt.alt || []3619 -1 });3620 -13621 -1 this.__cache__ = null;3622 -1 };3623 -13624 -1 /**3625 -1 * Ruler.push(ruleName, fn [, options])3626 -1 * - ruleName (String): name of added rule.3627 -1 * - fn (Function): rule function.3628 -1 * - options (Object): rule options (not mandatory).3629 -1 *3630 -1 * Push new rule to the end of chain. See also3631 -1 * [[Ruler.before]], [[Ruler.after]].3632 -1 *3633 -1 * ##### Options:3634 -1 *3635 -1 * - __alt__ - array with names of "alternate" chains.3636 -1 *3637 -1 * ##### Example3638 -1 *3639 -1 * ```javascript3640 -1 * var md = require('markdown-it')();3641 -1 *3642 -1 * md.core.ruler.push('my_rule', function replace(state) {3643 -1 * //...3644 -1 * });3645 -1 * ```3646 -1 **/3647 -1 Ruler.prototype.push = function (ruleName, fn, options) {3648 -1 var opt = options || {};3649 -13650 -1 this.__rules__.push({3651 -1 name: ruleName,3652 -1 enabled: true,3653 -1 fn: fn,3654 -1 alt: opt.alt || []3655 -1 });3656 -13657 -1 this.__cache__ = null;3658 -1 };3659 -13660 -13661 -1 /**3662 -1 * Ruler.enable(list [, ignoreInvalid]) -> Array3663 -1 * - list (String|Array): list of rule names to enable.3664 -1 * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.3665 -1 *3666 -1 * Enable rules with given names. If any rule name not found - throw Error.3667 -1 * Errors can be disabled by second param.3668 -1 *3669 -1 * Returns list of found rule names (if no exception happened).3670 -1 *3671 -1 * See also [[Ruler.disable]], [[Ruler.enableOnly]].3672 -1 **/3673 -1 Ruler.prototype.enable = function (list, ignoreInvalid) {3674 -1 if (!Array.isArray(list)) { list = [ list ]; }3675 -13676 -1 var result = [];3677 -13678 -1 // Search by name and enable3679 -1 list.forEach(function (name) {3680 -1 var idx = this.__find__(name);3681 -13682 -1 if (idx < 0) {3683 -1 if (ignoreInvalid) { return; }3684 -1 throw new Error('Rules manager: invalid rule name ' + name);3685 -1 }3686 -1 this.__rules__[idx].enabled = true;3687 -1 result.push(name);3688 -1 }, this);3689 -13690 -1 this.__cache__ = null;3691 -1 return result;3692 -1 };3693 -13694 -13695 -1 /**3696 -1 * Ruler.enableOnly(list [, ignoreInvalid])3697 -1 * - list (String|Array): list of rule names to enable (whitelist).3698 -1 * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.3699 -1 *3700 -1 * Enable rules with given names, and disable everything else. If any rule name3701 -1 * not found - throw Error. Errors can be disabled by second param.3702 -1 *3703 -1 * See also [[Ruler.disable]], [[Ruler.enable]].3704 -1 **/3705 -1 Ruler.prototype.enableOnly = function (list, ignoreInvalid) {3706 -1 if (!Array.isArray(list)) { list = [ list ]; }3707 -13708 -1 this.__rules__.forEach(function (rule) { rule.enabled = false; });3709 -13710 -1 this.enable(list, ignoreInvalid);3711 -1 };3712 -13713 -13714 -1 /**3715 -1 * Ruler.disable(list [, ignoreInvalid]) -> Array3716 -1 * - list (String|Array): list of rule names to disable.3717 -1 * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.3718 -1 *3719 -1 * Disable rules with given names. If any rule name not found - throw Error.3720 -1 * Errors can be disabled by second param.3721 -1 *3722 -1 * Returns list of found rule names (if no exception happened).3723 -1 *3724 -1 * See also [[Ruler.enable]], [[Ruler.enableOnly]].3725 -1 **/3726 -1 Ruler.prototype.disable = function (list, ignoreInvalid) {3727 -1 if (!Array.isArray(list)) { list = [ list ]; }3728 -13729 -1 var result = [];3730 -13731 -1 // Search by name and disable3732 -1 list.forEach(function (name) {3733 -1 var idx = this.__find__(name);3734 -13735 -1 if (idx < 0) {3736 -1 if (ignoreInvalid) { return; }3737 -1 throw new Error('Rules manager: invalid rule name ' + name);3738 -1 }3739 -1 this.__rules__[idx].enabled = false;3740 -1 result.push(name);3741 -1 }, this);3742 -13743 -1 this.__cache__ = null;3744 -1 return result;3745 -1 };3746 -13747 -13748 -1 /**3749 -1 * Ruler.getRules(chainName) -> Array3750 -1 *3751 -1 * Return array of active functions (rules) for given chain name. It analyzes3752 -1 * rules configuration, compiles caches if not exists and returns result.3753 -1 *3754 -1 * Default chain name is `''` (empty string). It can't be skipped. That's3755 -1 * done intentionally, to keep signature monomorphic for high speed.3756 -1 **/3757 -1 Ruler.prototype.getRules = function (chainName) {3758 -1 if (this.__cache__ === null) {3759 -1 this.__compile__();3760 -1 }3761 -13762 -1 // Chain can be empty, if rules disabled. But we still have to return Array.3763 -1 return this.__cache__[chainName] || [];3764 -1 };3765 -13766 -1 module.exports = Ruler;3767 -13768 -1 },{}],23:[function(require,module,exports){3769 -1 // Block quotes3770 -13771 -1 'use strict';3772 -13773 -1 var isSpace = require('../common/utils').isSpace;3774 -13775 -13776 -1 module.exports = function blockquote(state, startLine, endLine, silent) {3777 -1 var nextLine, lastLineEmpty, oldTShift, oldSCount, oldBMarks, oldIndent, oldParentType, lines, initial, offset, ch,3778 -1 terminatorRules, token,3779 -1 i, l, terminate,3780 -1 pos = state.bMarks[startLine] + state.tShift[startLine],3781 -1 max = state.eMarks[startLine];3782 -13783 -1 // check the block quote marker3784 -1 if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }3785 -13786 -1 // we know that it's going to be a valid blockquote,3787 -1 // so no point trying to find the end of it in silent mode3788 -1 if (silent) { return true; }3789 -13790 -1 // skip one optional space (but not tab, check cmark impl) after '>'3791 -1 if (state.src.charCodeAt(pos) === 0x20) { pos++; }3792 -13793 -1 oldIndent = state.blkIndent;3794 -1 state.blkIndent = 0;3795 -13796 -1 // skip spaces after ">" and re-calculate offset3797 -1 initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);3798 -13799 -1 oldBMarks = [ state.bMarks[startLine] ];3800 -1 state.bMarks[startLine] = pos;3801 -13802 -1 while (pos < max) {3803 -1 ch = state.src.charCodeAt(pos);3804 -13805 -1 if (isSpace(ch)) {3806 -1 if (ch === 0x09) {3807 -1 offset += 4 - offset % 4;3808 -1 } else {3809 -1 offset++;3810 -1 }3811 -1 } else {3812 -1 break;3813 -1 }3814 -13815 -1 pos++;3816 -1 }3817 -13818 -1 lastLineEmpty = pos >= max;3819 -13820 -1 oldSCount = [ state.sCount[startLine] ];3821 -1 state.sCount[startLine] = offset - initial;3822 -13823 -1 oldTShift = [ state.tShift[startLine] ];3824 -1 state.tShift[startLine] = pos - state.bMarks[startLine];3825 -13826 -1 terminatorRules = state.md.block.ruler.getRules('blockquote');3827 -13828 -1 // Search the end of the block3829 -1 //3830 -1 // Block ends with either:3831 -1 // 1. an empty line outside:3832 -1 // ```3833 -1 // > test3834 -1 //3835 -1 // ```3836 -1 // 2. an empty line inside:3837 -1 // ```3838 -1 // >3839 -1 // test3840 -1 // ```3841 -1 // 3. another tag3842 -1 // ```3843 -1 // > test3844 -1 // - - -3845 -1 // ```3846 -1 for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {3847 -1 if (state.sCount[nextLine] < oldIndent) { break; }3848 -13849 -1 pos = state.bMarks[nextLine] + state.tShift[nextLine];3850 -1 max = state.eMarks[nextLine];3851 -13852 -1 if (pos >= max) {3853 -1 // Case 1: line is not inside the blockquote, and this line is empty.3854 -1 break;3855 -1 }3856 -13857 -1 if (state.src.charCodeAt(pos++) === 0x3E/* > */) {3858 -1 // This line is inside the blockquote.3859 -13860 -1 // skip one optional space (but not tab, check cmark impl) after '>'3861 -1 if (state.src.charCodeAt(pos) === 0x20) { pos++; }3862 -13863 -1 // skip spaces after ">" and re-calculate offset3864 -1 initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);3865 -13866 -1 oldBMarks.push(state.bMarks[nextLine]);3867 -1 state.bMarks[nextLine] = pos;3868 -13869 -1 while (pos < max) {3870 -1 ch = state.src.charCodeAt(pos);3871 -13872 -1 if (isSpace(ch)) {3873 -1 if (ch === 0x09) {3874 -1 offset += 4 - offset % 4;3875 -1 } else {3876 -1 offset++;3877 -1 }3878 -1 } else {3879 -1 break;3880 -1 }3881 -13882 -1 pos++;3883 -1 }3884 -13885 -1 lastLineEmpty = pos >= max;3886 -13887 -1 oldSCount.push(state.sCount[nextLine]);3888 -1 state.sCount[nextLine] = offset - initial;3889 -13890 -1 oldTShift.push(state.tShift[nextLine]);3891 -1 state.tShift[nextLine] = pos - state.bMarks[nextLine];3892 -1 continue;3893 -1 }3894 -13895 -1 // Case 2: line is not inside the blockquote, and the last line was empty.3896 -1 if (lastLineEmpty) { break; }3897 -13898 -1 // Case 3: another tag found.3899 -1 terminate = false;3900 -1 for (i = 0, l = terminatorRules.length; i < l; i++) {3901 -1 if (terminatorRules[i](state, nextLine, endLine, true)) {3902 -1 terminate = true;3903 -1 break;3904 -1 }3905 -1 }3906 -1 if (terminate) { break; }3907 -13908 -1 oldBMarks.push(state.bMarks[nextLine]);3909 -1 oldTShift.push(state.tShift[nextLine]);3910 -1 oldSCount.push(state.sCount[nextLine]);3911 -13912 -1 // A negative indentation means that this is a paragraph continuation3913 -1 //3914 -1 state.sCount[nextLine] = -1;3915 -1 }3916 -13917 -1 oldParentType = state.parentType;3918 -1 state.parentType = 'blockquote';3919 -13920 -1 token = state.push('blockquote_open', 'blockquote', 1);3921 -1 token.markup = '>';3922 -1 token.map = lines = [ startLine, 0 ];3923 -13924 -1 state.md.block.tokenize(state, startLine, nextLine);3925 -13926 -1 token = state.push('blockquote_close', 'blockquote', -1);3927 -1 token.markup = '>';3928 -13929 -1 state.parentType = oldParentType;3930 -1 lines[1] = state.line;3931 -13932 -1 // Restore original tShift; this might not be necessary since the parser3933 -1 // has already been here, but just to make sure we can do that.3934 -1 for (i = 0; i < oldTShift.length; i++) {3935 -1 state.bMarks[i + startLine] = oldBMarks[i];3936 -1 state.tShift[i + startLine] = oldTShift[i];3937 -1 state.sCount[i + startLine] = oldSCount[i];3938 -1 }3939 -1 state.blkIndent = oldIndent;3940 -13941 -1 return true;3942 -1 };3943 -13944 -1 },{"../common/utils":9}],24:[function(require,module,exports){3945 -1 // Code block (4 spaces padded)3946 -13947 -1 'use strict';3948 -13949 -13950 -1 module.exports = function code(state, startLine, endLine/*, silent*/) {3951 -1 var nextLine, last, token, emptyLines = 0;3952 -13953 -1 if (state.sCount[startLine] - state.blkIndent < 4) { return false; }3954 -13955 -1 last = nextLine = startLine + 1;3956 -13957 -1 while (nextLine < endLine) {3958 -1 if (state.isEmpty(nextLine)) {3959 -1 emptyLines++;3960 -13961 -1 // workaround for lists: 2 blank lines should terminate indented3962 -1 // code block, but not fenced code block3963 -1 if (emptyLines >= 2 && state.parentType === 'list') {3964 -1 break;3965 -1 }3966 -13967 -1 nextLine++;3968 -1 continue;3969 -1 }3970 -13971 -1 emptyLines = 0;3972 -13973 -1 if (state.sCount[nextLine] - state.blkIndent >= 4) {3974 -1 nextLine++;3975 -1 last = nextLine;3976 -1 continue;3977 -1 }3978 -1 break;3979 -1 }3980 -13981 -1 state.line = last;3982 -13983 -1 token = state.push('code_block', 'code', 0);3984 -1 token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);3985 -1 token.map = [ startLine, state.line ];3986 -13987 -1 return true;3988 -1 };3989 -13990 -1 },{}],25:[function(require,module,exports){3991 -1 // fences (``` lang, ~~~ lang)3992 -13993 -1 'use strict';3994 -13995 -13996 -1 module.exports = function fence(state, startLine, endLine, silent) {3997 -1 var marker, len, params, nextLine, mem, token, markup,3998 -1 haveEndMarker = false,3999 -1 pos = state.bMarks[startLine] + state.tShift[startLine],4000 -1 max = state.eMarks[startLine];4001 -14002 -1 if (pos + 3 > max) { return false; }4003 -14004 -1 marker = state.src.charCodeAt(pos);4005 -14006 -1 if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {4007 -1 return false;4008 -1 }4009 -14010 -1 // scan marker length4011 -1 mem = pos;4012 -1 pos = state.skipChars(pos, marker);4013 -14014 -1 len = pos - mem;4015 -14016 -1 if (len < 3) { return false; }4017 -14018 -1 markup = state.src.slice(mem, pos);4019 -1 params = state.src.slice(pos, max);4020 -14021 -1 if (params.indexOf('`') >= 0) { return false; }4022 -14023 -1 // Since start is found, we can report success here in validation mode4024 -1 if (silent) { return true; }4025 -14026 -1 // search end of block4027 -1 nextLine = startLine;4028 -14029 -1 for (;;) {4030 -1 nextLine++;4031 -1 if (nextLine >= endLine) {4032 -1 // unclosed block should be autoclosed by end of document.4033 -1 // also block seems to be autoclosed by end of parent4034 -1 break;4035 -1 }4036 -14037 -1 pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];4038 -1 max = state.eMarks[nextLine];4039 -14040 -1 if (pos < max && state.sCount[nextLine] < state.blkIndent) {4041 -1 // non-empty line with negative indent should stop the list:4042 -1 // - ```4043 -1 // test4044 -1 break;4045 -1 }4046 -14047 -1 if (state.src.charCodeAt(pos) !== marker) { continue; }4048 -14049 -1 if (state.sCount[nextLine] - state.blkIndent >= 4) {4050 -1 // closing fence should be indented less than 4 spaces4051 -1 continue;4052 -1 }4053 -14054 -1 pos = state.skipChars(pos, marker);4055 -14056 -1 // closing code fence must be at least as long as the opening one4057 -1 if (pos - mem < len) { continue; }4058 -14059 -1 // make sure tail has spaces only4060 -1 pos = state.skipSpaces(pos);4061 -14062 -1 if (pos < max) { continue; }4063 -14064 -1 haveEndMarker = true;4065 -1 // found!4066 -1 break;4067 -1 }4068 -14069 -1 // If a fence has heading spaces, they should be removed from its inner block4070 -1 len = state.sCount[startLine];4071 -14072 -1 state.line = nextLine + (haveEndMarker ? 1 : 0);4073 -14074 -1 token = state.push('fence', 'code', 0);4075 -1 token.info = params;4076 -1 token.content = state.getLines(startLine + 1, nextLine, len, true);4077 -1 token.markup = markup;4078 -1 token.map = [ startLine, state.line ];4079 -14080 -1 return true;4081 -1 };4082 -14083 -1 },{}],26:[function(require,module,exports){4084 -1 // heading (#, ##, ...)4085 -14086 -1 'use strict';4087 -14088 -1 var isSpace = require('../common/utils').isSpace;4089 -14090 -14091 -1 module.exports = function heading(state, startLine, endLine, silent) {4092 -1 var ch, level, tmp, token,4093 -1 pos = state.bMarks[startLine] + state.tShift[startLine],4094 -1 max = state.eMarks[startLine];4095 -14096 -1 ch = state.src.charCodeAt(pos);4097 -14098 -1 if (ch !== 0x23/* # */ || pos >= max) { return false; }4099 -14100 -1 // count heading level4101 -1 level = 1;4102 -1 ch = state.src.charCodeAt(++pos);4103 -1 while (ch === 0x23/* # */ && pos < max && level <= 6) {4104 -1 level++;4105 -1 ch = state.src.charCodeAt(++pos);4106 -1 }4107 -14108 -1 if (level > 6 || (pos < max && ch !== 0x20/* space */)) { return false; }4109 -14110 -1 if (silent) { return true; }4111 -14112 -1 // Let's cut tails like ' ### ' from the end of string4113 -14114 -1 max = state.skipSpacesBack(max, pos);4115 -1 tmp = state.skipCharsBack(max, 0x23, pos); // #4116 -1 if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {4117 -1 max = tmp;4118 -1 }4119 -14120 -1 state.line = startLine + 1;4121 -14122 -1 token = state.push('heading_open', 'h' + String(level), 1);4123 -1 token.markup = '########'.slice(0, level);4124 -1 token.map = [ startLine, state.line ];4125 -14126 -1 token = state.push('inline', '', 0);4127 -1 token.content = state.src.slice(pos, max).trim();4128 -1 token.map = [ startLine, state.line ];4129 -1 token.children = [];4130 -14131 -1 token = state.push('heading_close', 'h' + String(level), -1);4132 -1 token.markup = '########'.slice(0, level);4133 -14134 -1 return true;4135 -1 };4136 -14137 -1 },{"../common/utils":9}],27:[function(require,module,exports){4138 -1 // Horizontal rule4139 -14140 -1 'use strict';4141 -14142 -1 var isSpace = require('../common/utils').isSpace;4143 -14144 -14145 -1 module.exports = function hr(state, startLine, endLine, silent) {4146 -1 var marker, cnt, ch, token,4147 -1 pos = state.bMarks[startLine] + state.tShift[startLine],4148 -1 max = state.eMarks[startLine];4149 -14150 -1 marker = state.src.charCodeAt(pos++);4151 -14152 -1 // Check hr marker4153 -1 if (marker !== 0x2A/* * */ &&4154 -1 marker !== 0x2D/* - */ &&4155 -1 marker !== 0x5F/* _ */) {4156 -1 return false;4157 -1 }4158 -14159 -1 // markers can be mixed with spaces, but there should be at least 3 of them4160 -14161 -1 cnt = 1;4162 -1 while (pos < max) {4163 -1 ch = state.src.charCodeAt(pos++);4164 -1 if (ch !== marker && !isSpace(ch)) { return false; }4165 -1 if (ch === marker) { cnt++; }4166 -1 }4167 -14168 -1 if (cnt < 3) { return false; }4169 -14170 -1 if (silent) { return true; }4171 -14172 -1 state.line = startLine + 1;4173 -14174 -1 token = state.push('hr', 'hr', 0);4175 -1 token.map = [ startLine, state.line ];4176 -1 token.markup = Array(cnt + 1).join(String.fromCharCode(marker));4177 -14178 -1 return true;4179 -1 };4180 -14181 -1 },{"../common/utils":9}],28:[function(require,module,exports){4182 -1 // HTML block4183 -14184 -1 'use strict';4185 -14186 -14187 -1 var block_names = require('../common/html_blocks');4188 -1 var HTML_OPEN_CLOSE_TAG_RE = require('../common/html_re').HTML_OPEN_CLOSE_TAG_RE;4189 -14190 -1 // An array of opening and corresponding closing sequences for html tags,4191 -1 // last argument defines whether it can terminate a paragraph or not4192 -1 //4193 -1 var HTML_SEQUENCES = [4194 -1 [ /^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true ],4195 -1 [ /^<!--/, /-->/, true ],4196 -1 [ /^<\?/, /\?>/, true ],4197 -1 [ /^<![A-Z]/, />/, true ],4198 -1 [ /^<!\[CDATA\[/, /\]\]>/, true ],4199 -1 [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true ],4200 -1 [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false ]4201 -1 ];4202 -14203 -14204 -1 module.exports = function html_block(state, startLine, endLine, silent) {4205 -1 var i, nextLine, token, lineText,4206 -1 pos = state.bMarks[startLine] + state.tShift[startLine],4207 -1 max = state.eMarks[startLine];4208 -14209 -1 if (!state.md.options.html) { return false; }4210 -14211 -1 if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }4212 -14213 -1 lineText = state.src.slice(pos, max);4214 -14215 -1 for (i = 0; i < HTML_SEQUENCES.length; i++) {4216 -1 if (HTML_SEQUENCES[i][0].test(lineText)) { break; }4217 -1 }4218 -14219 -1 if (i === HTML_SEQUENCES.length) { return false; }4220 -14221 -1 if (silent) {4222 -1 // true if this sequence can be a terminator, false otherwise4223 -1 return HTML_SEQUENCES[i][2];4224 -1 }4225 -14226 -1 nextLine = startLine + 1;4227 -14228 -1 // If we are here - we detected HTML block.4229 -1 // Let's roll down till block end.4230 -1 if (!HTML_SEQUENCES[i][1].test(lineText)) {4231 -1 for (; nextLine < endLine; nextLine++) {4232 -1 if (state.sCount[nextLine] < state.blkIndent) { break; }4233 -14234 -1 pos = state.bMarks[nextLine] + state.tShift[nextLine];4235 -1 max = state.eMarks[nextLine];4236 -1 lineText = state.src.slice(pos, max);4237 -14238 -1 if (HTML_SEQUENCES[i][1].test(lineText)) {4239 -1 if (lineText.length !== 0) { nextLine++; }4240 -1 break;4241 -1 }4242 -1 }4243 -1 }4244 -14245 -1 state.line = nextLine;4246 -14247 -1 token = state.push('html_block', '', 0);4248 -1 token.map = [ startLine, nextLine ];4249 -1 token.content = state.getLines(startLine, nextLine, state.blkIndent, true);4250 -14251 -1 return true;4252 -1 };4253 -14254 -1 },{"../common/html_blocks":7,"../common/html_re":8}],29:[function(require,module,exports){4255 -1 // lheading (---, ===)4256 -14257 -1 'use strict';4258 -14259 -14260 -1 module.exports = function lheading(state, startLine, endLine/*, silent*/) {4261 -1 var content, terminate, i, l, token, pos, max, level, marker,4262 -1 nextLine = startLine + 1,4263 -1 terminatorRules = state.md.block.ruler.getRules('paragraph');4264 -14265 -1 // jump line-by-line until empty one or EOF4266 -1 for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {4267 -1 // this would be a code block normally, but after paragraph4268 -1 // it's considered a lazy continuation regardless of what's there4269 -1 if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }4270 -14271 -1 //4272 -1 // Check for underline in setext header4273 -1 //4274 -1 if (state.sCount[nextLine] >= state.blkIndent) {4275 -1 pos = state.bMarks[nextLine] + state.tShift[nextLine];4276 -1 max = state.eMarks[nextLine];4277 -14278 -1 if (pos < max) {4279 -1 marker = state.src.charCodeAt(pos);4280 -14281 -1 if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {4282 -1 pos = state.skipChars(pos, marker);4283 -1 pos = state.skipSpaces(pos);4284 -14285 -1 if (pos >= max) {4286 -1 level = (marker === 0x3D/* = */ ? 1 : 2);4287 -1 break;4288 -1 }4289 -1 }4290 -1 }4291 -1 }4292 -14293 -1 // quirk for blockquotes, this line should already be checked by that rule4294 -1 if (state.sCount[nextLine] < 0) { continue; }4295 -14296 -1 // Some tags can terminate paragraph without empty line.4297 -1 terminate = false;4298 -1 for (i = 0, l = terminatorRules.length; i < l; i++) {4299 -1 if (terminatorRules[i](state, nextLine, endLine, true)) {4300 -1 terminate = true;4301 -1 break;4302 -1 }4303 -1 }4304 -1 if (terminate) { break; }4305 -1 }4306 -14307 -1 if (!level) {4308 -1 // Didn't find valid underline4309 -1 return false;4310 -1 }4311 -14312 -1 content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();4313 -14314 -1 state.line = nextLine + 1;4315 -14316 -1 token = state.push('heading_open', 'h' + String(level), 1);4317 -1 token.markup = String.fromCharCode(marker);4318 -1 token.map = [ startLine, state.line ];4319 -14320 -1 token = state.push('inline', '', 0);4321 -1 token.content = content;4322 -1 token.map = [ startLine, state.line - 1 ];4323 -1 token.children = [];4324 -14325 -1 token = state.push('heading_close', 'h' + String(level), -1);4326 -1 token.markup = String.fromCharCode(marker);4327 -14328 -1 return true;4329 -1 };4330 -14331 -1 },{}],30:[function(require,module,exports){4332 -1 // Lists4333 -14334 -1 'use strict';4335 -14336 -1 var isSpace = require('../common/utils').isSpace;4337 -14338 -14339 -1 // Search `[-+*][\n ]`, returns next pos arter marker on success4340 -1 // or -1 on fail.4341 -1 function skipBulletListMarker(state, startLine) {4342 -1 var marker, pos, max, ch;4343 -14344 -1 pos = state.bMarks[startLine] + state.tShift[startLine];4345 -1 max = state.eMarks[startLine];4346 -14347 -1 marker = state.src.charCodeAt(pos++);4348 -1 // Check bullet4349 -1 if (marker !== 0x2A/* * */ &&4350 -1 marker !== 0x2D/* - */ &&4351 -1 marker !== 0x2B/* + */) {4352 -1 return -1;4353 -1 }4354 -14355 -1 if (pos < max) {4356 -1 ch = state.src.charCodeAt(pos);4357 -14358 -1 if (!isSpace(ch)) {4359 -1 // " -test " - is not a list item4360 -1 return -1;4361 -1 }4362 -1 }4363 -14364 -1 return pos;4365 -1 }4366 -14367 -1 // Search `\d+[.)][\n ]`, returns next pos arter marker on success4368 -1 // or -1 on fail.4369 -1 function skipOrderedListMarker(state, startLine) {4370 -1 var ch,4371 -1 start = state.bMarks[startLine] + state.tShift[startLine],4372 -1 pos = start,4373 -1 max = state.eMarks[startLine];4374 -14375 -1 // List marker should have at least 2 chars (digit + dot)4376 -1 if (pos + 1 >= max) { return -1; }4377 -14378 -1 ch = state.src.charCodeAt(pos++);4379 -14380 -1 if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }4381 -14382 -1 for (;;) {4383 -1 // EOL -> fail4384 -1 if (pos >= max) { return -1; }4385 -14386 -1 ch = state.src.charCodeAt(pos++);4387 -14388 -1 if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {4389 -14390 -1 // List marker should have no more than 9 digits4391 -1 // (prevents integer overflow in browsers)4392 -1 if (pos - start >= 10) { return -1; }4393 -14394 -1 continue;4395 -1 }4396 -14397 -1 // found valid marker4398 -1 if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {4399 -1 break;4400 -1 }4401 -14402 -1 return -1;4403 -1 }4404 -14405 -14406 -1 if (pos < max) {4407 -1 ch = state.src.charCodeAt(pos);4408 -14409 -1 if (!isSpace(ch)) {4410 -1 // " 1.test " - is not a list item4411 -1 return -1;4412 -1 }4413 -1 }4414 -1 return pos;4415 -1 }4416 -14417 -1 function markTightParagraphs(state, idx) {4418 -1 var i, l,4419 -1 level = state.level + 2;4420 -14421 -1 for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {4422 -1 if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {4423 -1 state.tokens[i + 2].hidden = true;4424 -1 state.tokens[i].hidden = true;4425 -1 i += 2;4426 -1 }4427 -1 }4428 -1 }4429 -14430 -14431 -1 module.exports = function list(state, startLine, endLine, silent) {4432 -1 var nextLine,4433 -1 initial,4434 -1 offset,4435 -1 indent,4436 -1 oldTShift,4437 -1 oldIndent,4438 -1 oldLIndent,4439 -1 oldTight,4440 -1 oldParentType,4441 -1 start,4442 -1 posAfterMarker,4443 -1 ch,4444 -1 pos,4445 -1 max,4446 -1 indentAfterMarker,4447 -1 markerValue,4448 -1 markerCharCode,4449 -1 isOrdered,4450 -1 contentStart,4451 -1 listTokIdx,4452 -1 prevEmptyEnd,4453 -1 listLines,4454 -1 itemLines,4455 -1 tight = true,4456 -1 terminatorRules,4457 -1 token,4458 -1 i, l, terminate;4459 -14460 -1 // Detect list type and position after marker4461 -1 if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {4462 -1 isOrdered = true;4463 -1 } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {4464 -1 isOrdered = false;4465 -1 } else {4466 -1 return false;4467 -1 }4468 -14469 -1 // We should terminate list on style change. Remember first one to compare.4470 -1 markerCharCode = state.src.charCodeAt(posAfterMarker - 1);4471 -14472 -1 // For validation mode we can terminate immediately4473 -1 if (silent) { return true; }4474 -14475 -1 // Start list4476 -1 listTokIdx = state.tokens.length;4477 -14478 -1 if (isOrdered) {4479 -1 start = state.bMarks[startLine] + state.tShift[startLine];4480 -1 markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));4481 -14482 -1 token = state.push('ordered_list_open', 'ol', 1);4483 -1 if (markerValue !== 1) {4484 -1 token.attrs = [ [ 'start', markerValue ] ];4485 -1 }4486 -14487 -1 } else {4488 -1 token = state.push('bullet_list_open', 'ul', 1);4489 -1 }4490 -14491 -1 token.map = listLines = [ startLine, 0 ];4492 -1 token.markup = String.fromCharCode(markerCharCode);4493 -14494 -1 //4495 -1 // Iterate list items4496 -1 //4497 -14498 -1 nextLine = startLine;4499 -1 prevEmptyEnd = false;4500 -1 terminatorRules = state.md.block.ruler.getRules('list');4501 -14502 -1 while (nextLine < endLine) {4503 -1 pos = posAfterMarker;4504 -1 max = state.eMarks[nextLine];4505 -14506 -1 initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);4507 -14508 -1 while (pos < max) {4509 -1 ch = state.src.charCodeAt(pos);4510 -14511 -1 if (isSpace(ch)) {4512 -1 if (ch === 0x09) {4513 -1 offset += 4 - offset % 4;4514 -1 } else {4515 -1 offset++;4516 -1 }4517 -1 } else {4518 -1 break;4519 -1 }4520 -14521 -1 pos++;4522 -1 }4523 -14524 -1 contentStart = pos;4525 -14526 -1 if (contentStart >= max) {4527 -1 // trimming space in "- \n 3" case, indent is 1 here4528 -1 indentAfterMarker = 1;4529 -1 } else {4530 -1 indentAfterMarker = offset - initial;4531 -1 }4532 -14533 -1 // If we have more than 4 spaces, the indent is 14534 -1 // (the rest is just indented code block)4535 -1 if (indentAfterMarker > 4) { indentAfterMarker = 1; }4536 -14537 -1 // " - test"4538 -1 // ^^^^^ - calculating total length of this thing4539 -1 indent = initial + indentAfterMarker;4540 -14541 -1 // Run subparser & write tokens4542 -1 token = state.push('list_item_open', 'li', 1);4543 -1 token.markup = String.fromCharCode(markerCharCode);4544 -1 token.map = itemLines = [ startLine, 0 ];4545 -14546 -1 oldIndent = state.blkIndent;4547 -1 oldTight = state.tight;4548 -1 oldTShift = state.tShift[startLine];4549 -1 oldLIndent = state.sCount[startLine];4550 -1 oldParentType = state.parentType;4551 -1 state.blkIndent = indent;4552 -1 state.tight = true;4553 -1 state.parentType = 'list';4554 -1 state.tShift[startLine] = contentStart - state.bMarks[startLine];4555 -1 state.sCount[startLine] = offset;4556 -14557 -1 if (contentStart >= max && state.isEmpty(startLine + 1)) {4558 -1 // workaround for this case4559 -1 // (list item is empty, list terminates before "foo"):4560 -1 // ~~~~~~~~4561 -1 // -4562 -1 //4563 -1 // foo4564 -1 // ~~~~~~~~4565 -1 state.line = Math.min(state.line + 2, endLine);4566 -1 } else {4567 -1 state.md.block.tokenize(state, startLine, endLine, true);4568 -1 }4569 -14570 -1 // If any of list item is tight, mark list as tight4571 -1 if (!state.tight || prevEmptyEnd) {4572 -1 tight = false;4573 -1 }4574 -1 // Item become loose if finish with empty line,4575 -1 // but we should filter last element, because it means list finish4576 -1 prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);4577 -14578 -1 state.blkIndent = oldIndent;4579 -1 state.tShift[startLine] = oldTShift;4580 -1 state.sCount[startLine] = oldLIndent;4581 -1 state.tight = oldTight;4582 -1 state.parentType = oldParentType;4583 -14584 -1 token = state.push('list_item_close', 'li', -1);4585 -1 token.markup = String.fromCharCode(markerCharCode);4586 -14587 -1 nextLine = startLine = state.line;4588 -1 itemLines[1] = nextLine;4589 -1 contentStart = state.bMarks[startLine];4590 -14591 -1 if (nextLine >= endLine) { break; }4592 -14593 -1 if (state.isEmpty(nextLine)) {4594 -1 break;4595 -1 }4596 -14597 -1 //4598 -1 // Try to check if list is terminated or continued.4599 -1 //4600 -1 if (state.sCount[nextLine] < state.blkIndent) { break; }4601 -14602 -1 // fail if terminating block found4603 -1 terminate = false;4604 -1 for (i = 0, l = terminatorRules.length; i < l; i++) {4605 -1 if (terminatorRules[i](state, nextLine, endLine, true)) {4606 -1 terminate = true;4607 -1 break;4608 -1 }4609 -1 }4610 -1 if (terminate) { break; }4611 -14612 -1 // fail if list has another type4613 -1 if (isOrdered) {4614 -1 posAfterMarker = skipOrderedListMarker(state, nextLine);4615 -1 if (posAfterMarker < 0) { break; }4616 -1 } else {4617 -1 posAfterMarker = skipBulletListMarker(state, nextLine);4618 -1 if (posAfterMarker < 0) { break; }4619 -1 }4620 -14621 -1 if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }4622 -1 }4623 -14624 -1 // Finilize list4625 -1 if (isOrdered) {4626 -1 token = state.push('ordered_list_close', 'ol', -1);4627 -1 } else {4628 -1 token = state.push('bullet_list_close', 'ul', -1);4629 -1 }4630 -1 token.markup = String.fromCharCode(markerCharCode);4631 -14632 -1 listLines[1] = nextLine;4633 -1 state.line = nextLine;4634 -14635 -1 // mark paragraphs tight if needed4636 -1 if (tight) {4637 -1 markTightParagraphs(state, listTokIdx);4638 -1 }4639 -14640 -1 return true;4641 -1 };4642 -14643 -1 },{"../common/utils":9}],31:[function(require,module,exports){4644 -1 // Paragraph4645 -14646 -1 'use strict';4647 -14648 -14649 -1 module.exports = function paragraph(state, startLine/*, endLine*/) {4650 -1 var content, terminate, i, l, token,4651 -1 nextLine = startLine + 1,4652 -1 terminatorRules = state.md.block.ruler.getRules('paragraph'),4653 -1 endLine = state.lineMax;4654 -14655 -1 // jump line-by-line until empty one or EOF4656 -1 for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {4657 -1 // this would be a code block normally, but after paragraph4658 -1 // it's considered a lazy continuation regardless of what's there4659 -1 if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }4660 -14661 -1 // quirk for blockquotes, this line should already be checked by that rule4662 -1 if (state.sCount[nextLine] < 0) { continue; }4663 -14664 -1 // Some tags can terminate paragraph without empty line.4665 -1 terminate = false;4666 -1 for (i = 0, l = terminatorRules.length; i < l; i++) {4667 -1 if (terminatorRules[i](state, nextLine, endLine, true)) {4668 -1 terminate = true;4669 -1 break;4670 -1 }4671 -1 }4672 -1 if (terminate) { break; }4673 -1 }4674 -14675 -1 content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();4676 -14677 -1 state.line = nextLine;4678 -14679 -1 token = state.push('paragraph_open', 'p', 1);4680 -1 token.map = [ startLine, state.line ];4681 -14682 -1 token = state.push('inline', '', 0);4683 -1 token.content = content;4684 -1 token.map = [ startLine, state.line ];4685 -1 token.children = [];4686 -14687 -1 token = state.push('paragraph_close', 'p', -1);4688 -14689 -1 return true;4690 -1 };4691 -14692 -1 },{}],32:[function(require,module,exports){4693 -1 'use strict';4694 -14695 -14696 -1 var parseLinkDestination = require('../helpers/parse_link_destination');4697 -1 var parseLinkTitle = require('../helpers/parse_link_title');4698 -1 var normalizeReference = require('../common/utils').normalizeReference;4699 -1 var isSpace = require('../common/utils').isSpace;4700 -14701 -14702 -1 module.exports = function reference(state, startLine, _endLine, silent) {4703 -1 var ch,4704 -1 destEndPos,4705 -1 destEndLineNo,4706 -1 endLine,4707 -1 href,4708 -1 i,4709 -1 l,4710 -1 label,4711 -1 labelEnd,4712 -1 res,4713 -1 start,4714 -1 str,4715 -1 terminate,4716 -1 terminatorRules,4717 -1 title,4718 -1 lines = 0,4719 -1 pos = state.bMarks[startLine] + state.tShift[startLine],4720 -1 max = state.eMarks[startLine],4721 -1 nextLine = startLine + 1;4722 -14723 -1 if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }4724 -14725 -1 // Simple check to quickly interrupt scan on [link](url) at the start of line.4726 -1 // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/544727 -1 while (++pos < max) {4728 -1 if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&4729 -1 state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {4730 -1 if (pos + 1 === max) { return false; }4731 -1 if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }4732 -1 break;4733 -1 }4734 -1 }4735 -14736 -1 endLine = state.lineMax;4737 -14738 -1 // jump line-by-line until empty one or EOF4739 -1 terminatorRules = state.md.block.ruler.getRules('reference');4740 -14741 -1 for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {4742 -1 // this would be a code block normally, but after paragraph4743 -1 // it's considered a lazy continuation regardless of what's there4744 -1 if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }4745 -14746 -1 // quirk for blockquotes, this line should already be checked by that rule4747 -1 if (state.sCount[nextLine] < 0) { continue; }4748 -14749 -1 // Some tags can terminate paragraph without empty line.4750 -1 terminate = false;4751 -1 for (i = 0, l = terminatorRules.length; i < l; i++) {4752 -1 if (terminatorRules[i](state, nextLine, endLine, true)) {4753 -1 terminate = true;4754 -1 break;4755 -1 }4756 -1 }4757 -1 if (terminate) { break; }4758 -1 }4759 -14760 -1 str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();4761 -1 max = str.length;4762 -14763 -1 for (pos = 1; pos < max; pos++) {4764 -1 ch = str.charCodeAt(pos);4765 -1 if (ch === 0x5B /* [ */) {4766 -1 return false;4767 -1 } else if (ch === 0x5D /* ] */) {4768 -1 labelEnd = pos;4769 -1 break;4770 -1 } else if (ch === 0x0A /* \n */) {4771 -1 lines++;4772 -1 } else if (ch === 0x5C /* \ */) {4773 -1 pos++;4774 -1 if (pos < max && str.charCodeAt(pos) === 0x0A) {4775 -1 lines++;4776 -1 }4777 -1 }4778 -1 }4779 -14780 -1 if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }4781 -14782 -1 // [label]: destination 'title'4783 -1 // ^^^ skip optional whitespace here4784 -1 for (pos = labelEnd + 2; pos < max; pos++) {4785 -1 ch = str.charCodeAt(pos);4786 -1 if (ch === 0x0A) {4787 -1 lines++;4788 -1 } else if (isSpace(ch)) {4789 -1 /*eslint no-empty:0*/4790 -1 } else {4791 -1 break;4792 -1 }4793 -1 }4794 -14795 -1 // [label]: destination 'title'4796 -1 // ^^^^^^^^^^^ parse this4797 -1 res = parseLinkDestination(str, pos, max);4798 -1 if (!res.ok) { return false; }4799 -14800 -1 href = state.md.normalizeLink(res.str);4801 -1 if (!state.md.validateLink(href)) { return false; }4802 -14803 -1 pos = res.pos;4804 -1 lines += res.lines;4805 -14806 -1 // save cursor state, we could require to rollback later4807 -1 destEndPos = pos;4808 -1 destEndLineNo = lines;4809 -14810 -1 // [label]: destination 'title'4811 -1 // ^^^ skipping those spaces4812 -1 start = pos;4813 -1 for (; pos < max; pos++) {4814 -1 ch = str.charCodeAt(pos);4815 -1 if (ch === 0x0A) {4816 -1 lines++;4817 -1 } else if (isSpace(ch)) {4818 -1 /*eslint no-empty:0*/4819 -1 } else {4820 -1 break;4821 -1 }4822 -1 }4823 -14824 -1 // [label]: destination 'title'4825 -1 // ^^^^^^^ parse this4826 -1 res = parseLinkTitle(str, pos, max);4827 -1 if (pos < max && start !== pos && res.ok) {4828 -1 title = res.str;4829 -1 pos = res.pos;4830 -1 lines += res.lines;4831 -1 } else {4832 -1 title = '';4833 -1 pos = destEndPos;4834 -1 lines = destEndLineNo;4835 -1 }4836 -14837 -1 // skip trailing spaces until the rest of the line4838 -1 while (pos < max) {4839 -1 ch = str.charCodeAt(pos);4840 -1 if (!isSpace(ch)) { break; }4841 -1 pos++;4842 -1 }4843 -14844 -1 if (pos < max && str.charCodeAt(pos) !== 0x0A) {4845 -1 if (title) {4846 -1 // garbage at the end of the line after title,4847 -1 // but it could still be a valid reference if we roll back4848 -1 title = '';4849 -1 pos = destEndPos;4850 -1 lines = destEndLineNo;4851 -1 while (pos < max) {4852 -1 ch = str.charCodeAt(pos);4853 -1 if (!isSpace(ch)) { break; }4854 -1 pos++;4855 -1 }4856 -1 }4857 -1 }4858 -14859 -1 if (pos < max && str.charCodeAt(pos) !== 0x0A) {4860 -1 // garbage at the end of the line4861 -1 return false;4862 -1 }4863 -14864 -1 label = normalizeReference(str.slice(1, labelEnd));4865 -1 if (!label) {4866 -1 // CommonMark 0.20 disallows empty labels4867 -1 return false;4868 -1 }4869 -14870 -1 // Reference can not terminate anything. This check is for safety only.4871 -1 /*istanbul ignore if*/4872 -1 if (silent) { return true; }4873 -14874 -1 if (typeof state.env.references === 'undefined') {4875 -1 state.env.references = {};4876 -1 }4877 -1 if (typeof state.env.references[label] === 'undefined') {4878 -1 state.env.references[label] = { title: title, href: href };4879 -1 }4880 -14881 -1 state.line = startLine + lines + 1;4882 -1 return true;4883 -1 };4884 -14885 -1 },{"../common/utils":9,"../helpers/parse_link_destination":11,"../helpers/parse_link_title":13}],33:[function(require,module,exports){4886 -1 // Parser state class4887 -14888 -1 'use strict';4889 -14890 -1 var Token = require('../token');4891 -1 var isSpace = require('../common/utils').isSpace;4892 -14893 -14894 -1 function StateBlock(src, md, env, tokens) {4895 -1 var ch, s, start, pos, len, indent, offset, indent_found;4896 -14897 -1 this.src = src;4898 -14899 -1 // link to parser instance4900 -1 this.md = md;4901 -14902 -1 this.env = env;4903 -14904 -1 //4905 -1 // Internal state vartiables4906 -1 //4907 -14908 -1 this.tokens = tokens;4909 -14910 -1 this.bMarks = []; // line begin offsets for fast jumps4911 -1 this.eMarks = []; // line end offsets for fast jumps4912 -1 this.tShift = []; // offsets of the first non-space characters (tabs not expanded)4913 -1 this.sCount = []; // indents for each line (tabs expanded)4914 -14915 -1 // block parser variables4916 -1 this.blkIndent = 0; // required block content indent4917 -1 // (for example, if we are in list)4918 -1 this.line = 0; // line index in src4919 -1 this.lineMax = 0; // lines count4920 -1 this.tight = false; // loose/tight mode for lists4921 -1 this.parentType = 'root'; // if `list`, block parser stops on two newlines4922 -1 this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)4923 -14924 -1 this.level = 0;4925 -14926 -1 // renderer4927 -1 this.result = '';4928 -14929 -1 // Create caches4930 -1 // Generate markers.4931 -1 s = this.src;4932 -1 indent_found = false;4933 -14934 -1 for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {4935 -1 ch = s.charCodeAt(pos);4936 -14937 -1 if (!indent_found) {4938 -1 if (isSpace(ch)) {4939 -1 indent++;4940 -14941 -1 if (ch === 0x09) {4942 -1 offset += 4 - offset % 4;4943 -1 } else {4944 -1 offset++;4945 -1 }4946 -1 continue;4947 -1 } else {4948 -1 indent_found = true;4949 -1 }4950 -1 }4951 -14952 -1 if (ch === 0x0A || pos === len - 1) {4953 -1 if (ch !== 0x0A) { pos++; }4954 -1 this.bMarks.push(start);4955 -1 this.eMarks.push(pos);4956 -1 this.tShift.push(indent);4957 -1 this.sCount.push(offset);4958 -14959 -1 indent_found = false;4960 -1 indent = 0;4961 -1 offset = 0;4962 -1 start = pos + 1;4963 -1 }4964 -1 }4965 -14966 -1 // Push fake entry to simplify cache bounds checks4967 -1 this.bMarks.push(s.length);4968 -1 this.eMarks.push(s.length);4969 -1 this.tShift.push(0);4970 -1 this.sCount.push(0);4971 -14972 -1 this.lineMax = this.bMarks.length - 1; // don't count last fake line4973 -1 }4974 -14975 -1 // Push new token to "stream".4976 -1 //4977 -1 StateBlock.prototype.push = function (type, tag, nesting) {4978 -1 var token = new Token(type, tag, nesting);4979 -1 token.block = true;4980 -14981 -1 if (nesting < 0) { this.level--; }4982 -1 token.level = this.level;4983 -1 if (nesting > 0) { this.level++; }4984 -14985 -1 this.tokens.push(token);4986 -1 return token;4987 -1 };4988 -14989 -1 StateBlock.prototype.isEmpty = function isEmpty(line) {4990 -1 return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];4991 -1 };4992 -14993 -1 StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {4994 -1 for (var max = this.lineMax; from < max; from++) {4995 -1 if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {4996 -1 break;4997 -1 }4998 -1 }4999 -1 return from;5000 -1 };5001 -15002 -1 // Skip spaces from given position.5003 -1 StateBlock.prototype.skipSpaces = function skipSpaces(pos) {5004 -1 var ch;5005 -15006 -1 for (var max = this.src.length; pos < max; pos++) {5007 -1 ch = this.src.charCodeAt(pos);5008 -1 if (!isSpace(ch)) { break; }5009 -1 }5010 -1 return pos;5011 -1 };5012 -15013 -1 // Skip spaces from given position in reverse.5014 -1 StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {5015 -1 if (pos <= min) { return pos; }5016 -15017 -1 while (pos > min) {5018 -1 if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }5019 -1 }5020 -1 return pos;5021 -1 };5022 -15023 -1 // Skip char codes from given position5024 -1 StateBlock.prototype.skipChars = function skipChars(pos, code) {5025 -1 for (var max = this.src.length; pos < max; pos++) {5026 -1 if (this.src.charCodeAt(pos) !== code) { break; }5027 -1 }5028 -1 return pos;5029 -1 };5030 -15031 -1 // Skip char codes reverse from given position - 15032 -1 StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {5033 -1 if (pos <= min) { return pos; }5034 -15035 -1 while (pos > min) {5036 -1 if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }5037 -1 }5038 -1 return pos;5039 -1 };5040 -15041 -1 // cut lines range from source.5042 -1 StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {5043 -1 var i, lineIndent, ch, first, last, queue, lineStart,5044 -1 line = begin;5045 -15046 -1 if (begin >= end) {5047 -1 return '';5048 -1 }5049 -15050 -1 queue = new Array(end - begin);5051 -15052 -1 for (i = 0; line < end; line++, i++) {5053 -1 lineIndent = 0;5054 -1 lineStart = first = this.bMarks[line];5055 -15056 -1 if (line + 1 < end || keepLastLF) {5057 -1 // No need for bounds check because we have fake entry on tail.5058 -1 last = this.eMarks[line] + 1;5059 -1 } else {5060 -1 last = this.eMarks[line];5061 -1 }5062 -15063 -1 while (first < last && lineIndent < indent) {5064 -1 ch = this.src.charCodeAt(first);5065 -15066 -1 if (isSpace(ch)) {5067 -1 if (ch === 0x09) {5068 -1 lineIndent += 4 - lineIndent % 4;5069 -1 } else {5070 -1 lineIndent++;5071 -1 }5072 -1 } else if (first - lineStart < this.tShift[line]) {5073 -1 // patched tShift masked characters to look like spaces (blockquotes, list markers)5074 -1 lineIndent++;5075 -1 } else {5076 -1 break;5077 -1 }5078 -15079 -1 first++;5080 -1 }5081 -15082 -1 queue[i] = this.src.slice(first, last);5083 -1 }5084 -15085 -1 return queue.join('');5086 -1 };5087 -15088 -1 // re-export Token class to use in block rules5089 -1 StateBlock.prototype.Token = Token;5090 -15091 -15092 -1 module.exports = StateBlock;5093 -15094 -1 },{"../common/utils":9,"../token":56}],34:[function(require,module,exports){5095 -1 // GFM table, non-standard5096 -15097 -1 'use strict';5098 -15099 -15100 -1 function getLine(state, line) {5101 -1 var pos = state.bMarks[line] + state.blkIndent,5102 -1 max = state.eMarks[line];5103 -15104 -1 return state.src.substr(pos, max - pos);5105 -1 }5106 -15107 -1 function escapedSplit(str) {5108 -1 var result = [],5109 -1 pos = 0,5110 -1 max = str.length,5111 -1 ch,5112 -1 escapes = 0,5113 -1 lastPos = 0,5114 -1 backTicked = false,5115 -1 lastBackTick = 0;5116 -15117 -1 ch = str.charCodeAt(pos);5118 -15119 -1 while (pos < max) {5120 -1 if (ch === 0x60/* ` */ && (escapes % 2 === 0)) {5121 -1 backTicked = !backTicked;5122 -1 lastBackTick = pos;5123 -1 } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {5124 -1 result.push(str.substring(lastPos, pos));5125 -1 lastPos = pos + 1;5126 -1 } else if (ch === 0x5c/* \ */) {5127 -1 escapes++;5128 -1 } else {5129 -1 escapes = 0;5130 -1 }5131 -15132 -1 pos++;5133 -15134 -1 // If there was an un-closed backtick, go back to just after5135 -1 // the last backtick, but as if it was a normal character5136 -1 if (pos === max && backTicked) {5137 -1 backTicked = false;5138 -1 pos = lastBackTick + 1;5139 -1 }5140 -15141 -1 ch = str.charCodeAt(pos);5142 -1 }5143 -15144 -1 result.push(str.substring(lastPos));5145 -15146 -1 return result;5147 -1 }5148 -15149 -15150 -1 module.exports = function table(state, startLine, endLine, silent) {5151 -1 var ch, lineText, pos, i, nextLine, columns, columnCount, token,5152 -1 aligns, t, tableLines, tbodyLines;5153 -15154 -1 // should have at least three lines5155 -1 if (startLine + 2 > endLine) { return false; }5156 -15157 -1 nextLine = startLine + 1;5158 -15159 -1 if (state.sCount[nextLine] < state.blkIndent) { return false; }5160 -15161 -1 // first character of the second line should be '|' or '-'5162 -15163 -1 pos = state.bMarks[nextLine] + state.tShift[nextLine];5164 -1 if (pos >= state.eMarks[nextLine]) { return false; }5165 -15166 -1 ch = state.src.charCodeAt(pos);5167 -1 if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }5168 -15169 -1 lineText = getLine(state, startLine + 1);5170 -1 if (!/^[-:| ]+$/.test(lineText)) { return false; }5171 -15172 -1 columns = lineText.split('|');5173 -1 aligns = [];5174 -1 for (i = 0; i < columns.length; i++) {5175 -1 t = columns[i].trim();5176 -1 if (!t) {5177 -1 // allow empty columns before and after table, but not in between columns;5178 -1 // e.g. allow ` |---| `, disallow ` ---||--- `5179 -1 if (i === 0 || i === columns.length - 1) {5180 -1 continue;5181 -1 } else {5182 -1 return false;5183 -1 }5184 -1 }5185 -15186 -1 if (!/^:?-+:?$/.test(t)) { return false; }5187 -1 if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {5188 -1 aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');5189 -1 } else if (t.charCodeAt(0) === 0x3A/* : */) {5190 -1 aligns.push('left');5191 -1 } else {5192 -1 aligns.push('');5193 -1 }5194 -1 }5195 -15196 -1 lineText = getLine(state, startLine).trim();5197 -1 if (lineText.indexOf('|') === -1) { return false; }5198 -1 columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));5199 -15200 -1 // header row will define an amount of columns in the entire table,5201 -1 // and align row shouldn't be smaller than that (the rest of the rows can)5202 -1 columnCount = columns.length;5203 -1 if (columnCount > aligns.length) { return false; }5204 -15205 -1 if (silent) { return true; }5206 -15207 -1 token = state.push('table_open', 'table', 1);5208 -1 token.map = tableLines = [ startLine, 0 ];5209 -15210 -1 token = state.push('thead_open', 'thead', 1);5211 -1 token.map = [ startLine, startLine + 1 ];5212 -15213 -1 token = state.push('tr_open', 'tr', 1);5214 -1 token.map = [ startLine, startLine + 1 ];5215 -15216 -1 for (i = 0; i < columns.length; i++) {5217 -1 token = state.push('th_open', 'th', 1);5218 -1 token.map = [ startLine, startLine + 1 ];5219 -1 if (aligns[i]) {5220 -1 token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];5221 -1 }5222 -15223 -1 token = state.push('inline', '', 0);5224 -1 token.content = columns[i].trim();5225 -1 token.map = [ startLine, startLine + 1 ];5226 -1 token.children = [];5227 -15228 -1 token = state.push('th_close', 'th', -1);5229 -1 }5230 -15231 -1 token = state.push('tr_close', 'tr', -1);5232 -1 token = state.push('thead_close', 'thead', -1);5233 -15234 -1 token = state.push('tbody_open', 'tbody', 1);5235 -1 token.map = tbodyLines = [ startLine + 2, 0 ];5236 -15237 -1 for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {5238 -1 if (state.sCount[nextLine] < state.blkIndent) { break; }5239 -15240 -1 lineText = getLine(state, nextLine);5241 -1 if (lineText.indexOf('|') === -1) { break; }5242 -15243 -1 // keep spaces at beginning of line to indicate an empty first cell, but5244 -1 // strip trailing whitespace5245 -1 columns = escapedSplit(lineText.replace(/^\||\|\s*$/g, ''));5246 -15247 -1 token = state.push('tr_open', 'tr', 1);5248 -1 for (i = 0; i < columnCount; i++) {5249 -1 token = state.push('td_open', 'td', 1);5250 -1 if (aligns[i]) {5251 -1 token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];5252 -1 }5253 -15254 -1 token = state.push('inline', '', 0);5255 -1 token.content = columns[i] ? columns[i].trim() : '';5256 -1 token.children = [];5257 -15258 -1 token = state.push('td_close', 'td', -1);5259 -1 }5260 -1 token = state.push('tr_close', 'tr', -1);5261 -1 }5262 -1 token = state.push('tbody_close', 'tbody', -1);5263 -1 token = state.push('table_close', 'table', -1);5264 -15265 -1 tableLines[1] = tbodyLines[1] = nextLine;5266 -1 state.line = nextLine;5267 -1 return true;5268 -1 };5269 -15270 -1 },{}],35:[function(require,module,exports){5271 -1 'use strict';5272 -15273 -15274 -1 module.exports = function block(state) {5275 -1 var token;5276 -15277 -1 if (state.inlineMode) {5278 -1 token = new state.Token('inline', '', 0);5279 -1 token.content = state.src;5280 -1 token.map = [ 0, 1 ];5281 -1 token.children = [];5282 -1 state.tokens.push(token);5283 -1 } else {5284 -1 state.md.block.parse(state.src, state.md, state.env, state.tokens);5285 -1 }5286 -1 };5287 -15288 -1 },{}],36:[function(require,module,exports){5289 -1 'use strict';5290 -15291 -1 module.exports = function inline(state) {5292 -1 var tokens = state.tokens, tok, i, l;5293 -15294 -1 // Parse inlines5295 -1 for (i = 0, l = tokens.length; i < l; i++) {5296 -1 tok = tokens[i];5297 -1 if (tok.type === 'inline') {5298 -1 state.md.inline.parse(tok.content, state.md, state.env, tok.children);5299 -1 }5300 -1 }5301 -1 };5302 -15303 -1 },{}],37:[function(require,module,exports){5304 -1 // Replace link-like texts with link nodes.5305 -1 //5306 -1 // Currently restricted by `md.validateLink()` to http/https/ftp5307 -1 //5308 -1 'use strict';5309 -15310 -15311 -1 var arrayReplaceAt = require('../common/utils').arrayReplaceAt;5312 -15313 -15314 -1 function isLinkOpen(str) {5315 -1 return /^<a[>\s]/i.test(str);5316 -1 }5317 -1 function isLinkClose(str) {5318 -1 return /^<\/a\s*>/i.test(str);5319 -1 }5320 -15321 -15322 -1 module.exports = function linkify(state) {5323 -1 var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,5324 -1 level, htmlLinkLevel, url, fullUrl, urlText,5325 -1 blockTokens = state.tokens,5326 -1 links;5327 -15328 -1 if (!state.md.options.linkify) { return; }5329 -15330 -1 for (j = 0, l = blockTokens.length; j < l; j++) {5331 -1 if (blockTokens[j].type !== 'inline' ||5332 -1 !state.md.linkify.pretest(blockTokens[j].content)) {5333 -1 continue;5334 -1 }5335 -15336 -1 tokens = blockTokens[j].children;5337 -15338 -1 htmlLinkLevel = 0;5339 -15340 -1 // We scan from the end, to keep position when new tags added.5341 -1 // Use reversed logic in links start/end match5342 -1 for (i = tokens.length - 1; i >= 0; i--) {5343 -1 currentToken = tokens[i];5344 -15345 -1 // Skip content of markdown links5346 -1 if (currentToken.type === 'link_close') {5347 -1 i--;5348 -1 while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {5349 -1 i--;5350 -1 }5351 -1 continue;5352 -1 }5353 -15354 -1 // Skip content of html tag links5355 -1 if (currentToken.type === 'html_inline') {5356 -1 if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {5357 -1 htmlLinkLevel--;5358 -1 }5359 -1 if (isLinkClose(currentToken.content)) {5360 -1 htmlLinkLevel++;5361 -1 }5362 -1 }5363 -1 if (htmlLinkLevel > 0) { continue; }5364 -15365 -1 if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {5366 -15367 -1 text = currentToken.content;5368 -1 links = state.md.linkify.match(text);5369 -15370 -1 // Now split string to nodes5371 -1 nodes = [];5372 -1 level = currentToken.level;5373 -1 lastPos = 0;5374 -15375 -1 for (ln = 0; ln < links.length; ln++) {5376 -15377 -1 url = links[ln].url;5378 -1 fullUrl = state.md.normalizeLink(url);5379 -1 if (!state.md.validateLink(fullUrl)) { continue; }5380 -15381 -1 urlText = links[ln].text;5382 -15383 -1 // Linkifier might send raw hostnames like "example.com", where url5384 -1 // starts with domain name. So we prepend http:// in those cases,5385 -1 // and remove it afterwards.5386 -1 //5387 -1 if (!links[ln].schema) {5388 -1 urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');5389 -1 } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {5390 -1 urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');5391 -1 } else {5392 -1 urlText = state.md.normalizeLinkText(urlText);5393 -1 }5394 -15395 -1 pos = links[ln].index;5396 -15397 -1 if (pos > lastPos) {5398 -1 token = new state.Token('text', '', 0);5399 -1 token.content = text.slice(lastPos, pos);5400 -1 token.level = level;5401 -1 nodes.push(token);5402 -1 }5403 -15404 -1 token = new state.Token('link_open', 'a', 1);5405 -1 token.attrs = [ [ 'href', fullUrl ] ];5406 -1 token.level = level++;5407 -1 token.markup = 'linkify';5408 -1 token.info = 'auto';5409 -1 nodes.push(token);5410 -15411 -1 token = new state.Token('text', '', 0);5412 -1 token.content = urlText;5413 -1 token.level = level;5414 -1 nodes.push(token);5415 -15416 -1 token = new state.Token('link_close', 'a', -1);5417 -1 token.level = --level;5418 -1 token.markup = 'linkify';5419 -1 token.info = 'auto';5420 -1 nodes.push(token);5421 -15422 -1 lastPos = links[ln].lastIndex;5423 -1 }5424 -1 if (lastPos < text.length) {5425 -1 token = new state.Token('text', '', 0);5426 -1 token.content = text.slice(lastPos);5427 -1 token.level = level;5428 -1 nodes.push(token);5429 -1 }5430 -15431 -1 // replace current node5432 -1 blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);5433 -1 }5434 -1 }5435 -1 }5436 -1 };5437 -15438 -1 },{"../common/utils":9}],38:[function(require,module,exports){5439 -1 // Normalize input string5440 -15441 -1 'use strict';5442 -15443 -15444 -1 var NEWLINES_RE = /\r[\n\u0085]?|[\u2424\u2028\u0085]/g;5445 -1 var NULL_RE = /\u0000/g;5446 -15447 -15448 -1 module.exports = function inline(state) {5449 -1 var str;5450 -15451 -1 // Normalize newlines5452 -1 str = state.src.replace(NEWLINES_RE, '\n');5453 -15454 -1 // Replace NULL characters5455 -1 str = str.replace(NULL_RE, '\uFFFD');5456 -15457 -1 state.src = str;5458 -1 };5459 -15460 -1 },{}],39:[function(require,module,exports){5461 -1 // Simple typographyc replacements5462 -1 //5463 -1 // (c) (C) → ©5464 -1 // (tm) (TM) → ™5465 -1 // (r) (R) → ®5466 -1 // +- → ±5467 -1 // (p) (P) -> §5468 -1 // ... → … (also ?.... → ?.., !.... → !..)5469 -1 // ???????? → ???, !!!!! → !!!, `,,` → `,`5470 -1 // -- → –, --- → —5471 -1 //5472 -1 'use strict';5473 -15474 -1 // TODO:5475 -1 // - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾5476 -1 // - miltiplication 2 x 4 -> 2 × 45477 -15478 -1 var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;5479 -15480 -1 // Workaround for phantomjs - need regex without /g flag,5481 -1 // or root check will fail every second time5482 -1 var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i;5483 -15484 -1 var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig;5485 -1 var SCOPED_ABBR = {5486 -1 c: '©',5487 -1 r: '®',5488 -1 p: '§',5489 -1 tm: '™'5490 -1 };5491 -15492 -1 function replaceFn(match, name) {5493 -1 return SCOPED_ABBR[name.toLowerCase()];5494 -1 }5495 -15496 -1 function replace_scoped(inlineTokens) {5497 -1 var i, token;5498 -15499 -1 for (i = inlineTokens.length - 1; i >= 0; i--) {5500 -1 token = inlineTokens[i];5501 -1 if (token.type === 'text') {5502 -1 token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);5503 -1 }5504 -1 }5505 -1 }5506 -15507 -1 function replace_rare(inlineTokens) {5508 -1 var i, token;5509 -15510 -1 for (i = inlineTokens.length - 1; i >= 0; i--) {5511 -1 token = inlineTokens[i];5512 -1 if (token.type === 'text') {5513 -1 if (RARE_RE.test(token.content)) {5514 -1 token.content = token.content5515 -1 .replace(/\+-/g, '±')5516 -1 // .., ..., ....... -> …5517 -1 // but ?..... & !..... -> ?.. & !..5518 -1 .replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')5519 -1 .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')5520 -1 // em-dash5521 -1 .replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')5522 -1 // en-dash5523 -1 .replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')5524 -1 .replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');5525 -1 }5526 -1 }5527 -1 }5528 -1 }5529 -15530 -15531 -1 module.exports = function replace(state) {5532 -1 var blkIdx;5533 -15534 -1 if (!state.md.options.typographer) { return; }5535 -15536 -1 for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {5537 -15538 -1 if (state.tokens[blkIdx].type !== 'inline') { continue; }5539 -15540 -1 if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {5541 -1 replace_scoped(state.tokens[blkIdx].children);5542 -1 }5543 -15544 -1 if (RARE_RE.test(state.tokens[blkIdx].content)) {5545 -1 replace_rare(state.tokens[blkIdx].children);5546 -1 }5547 -15548 -1 }5549 -1 };5550 -15551 -1 },{}],40:[function(require,module,exports){5552 -1 // Convert straight quotation marks to typographic ones5553 -1 //5554 -1 'use strict';5555 -15556 -15557 -1 var isWhiteSpace = require('../common/utils').isWhiteSpace;5558 -1 var isPunctChar = require('../common/utils').isPunctChar;5559 -1 var isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;5560 -15561 -1 var QUOTE_TEST_RE = /['"]/;5562 -1 var QUOTE_RE = /['"]/g;5563 -1 var APOSTROPHE = '\u2019'; /* ’ */5564 -15565 -15566 -1 function replaceAt(str, index, ch) {5567 -1 return str.substr(0, index) + ch + str.substr(index + 1);5568 -1 }5569 -15570 -1 function process_inlines(tokens, state) {5571 -1 var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,5572 -1 isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,5573 -1 canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;5574 -15575 -1 stack = [];5576 -15577 -1 for (i = 0; i < tokens.length; i++) {5578 -1 token = tokens[i];5579 -15580 -1 thisLevel = tokens[i].level;5581 -15582 -1 for (j = stack.length - 1; j >= 0; j--) {5583 -1 if (stack[j].level <= thisLevel) { break; }5584 -1 }5585 -1 stack.length = j + 1;5586 -15587 -1 if (token.type !== 'text') { continue; }5588 -15589 -1 text = token.content;5590 -1 pos = 0;5591 -1 max = text.length;5592 -15593 -1 /*eslint no-labels:0,block-scoped-var:0*/5594 -1 OUTER:5595 -1 while (pos < max) {5596 -1 QUOTE_RE.lastIndex = pos;5597 -1 t = QUOTE_RE.exec(text);5598 -1 if (!t) { break; }5599 -15600 -1 canOpen = canClose = true;5601 -1 pos = t.index + 1;5602 -1 isSingle = (t[0] === "'");5603 -15604 -1 // Find previous character,5605 -1 // default to space if it's the beginning of the line5606 -1 //5607 -1 lastChar = 0x20;5608 -15609 -1 if (t.index - 1 >= 0) {5610 -1 lastChar = text.charCodeAt(t.index - 1);5611 -1 } else {5612 -1 for (j = i - 1; j >= 0; j--) {5613 -1 if (tokens[j].type !== 'text') { continue; }5614 -15615 -1 lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);5616 -1 break;5617 -1 }5618 -1 }5619 -15620 -1 // Find next character,5621 -1 // default to space if it's the end of the line5622 -1 //5623 -1 nextChar = 0x20;5624 -15625 -1 if (pos < max) {5626 -1 nextChar = text.charCodeAt(pos);5627 -1 } else {5628 -1 for (j = i + 1; j < tokens.length; j++) {5629 -1 if (tokens[j].type !== 'text') { continue; }5630 -15631 -1 nextChar = tokens[j].content.charCodeAt(0);5632 -1 break;5633 -1 }5634 -1 }5635 -15636 -1 isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));5637 -1 isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));5638 -15639 -1 isLastWhiteSpace = isWhiteSpace(lastChar);5640 -1 isNextWhiteSpace = isWhiteSpace(nextChar);5641 -15642 -1 if (isNextWhiteSpace) {5643 -1 canOpen = false;5644 -1 } else if (isNextPunctChar) {5645 -1 if (!(isLastWhiteSpace || isLastPunctChar)) {5646 -1 canOpen = false;5647 -1 }5648 -1 }5649 -15650 -1 if (isLastWhiteSpace) {5651 -1 canClose = false;5652 -1 } else if (isLastPunctChar) {5653 -1 if (!(isNextWhiteSpace || isNextPunctChar)) {5654 -1 canClose = false;5655 -1 }5656 -1 }5657 -15658 -1 if (nextChar === 0x22 /* " */ && t[0] === '"') {5659 -1 if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {5660 -1 // special case: 1"" - count first quote as an inch5661 -1 canClose = canOpen = false;5662 -1 }5663 -1 }5664 -15665 -1 if (canOpen && canClose) {5666 -1 // treat this as the middle of the word5667 -1 canOpen = false;5668 -1 canClose = isNextPunctChar;5669 -1 }5670 -15671 -1 if (!canOpen && !canClose) {5672 -1 // middle of word5673 -1 if (isSingle) {5674 -1 token.content = replaceAt(token.content, t.index, APOSTROPHE);5675 -1 }5676 -1 continue;5677 -1 }5678 -15679 -1 if (canClose) {5680 -1 // this could be a closing quote, rewind the stack to get a match5681 -1 for (j = stack.length - 1; j >= 0; j--) {5682 -1 item = stack[j];5683 -1 if (stack[j].level < thisLevel) { break; }5684 -1 if (item.single === isSingle && stack[j].level === thisLevel) {5685 -1 item = stack[j];5686 -15687 -1 if (isSingle) {5688 -1 openQuote = state.md.options.quotes[2];5689 -1 closeQuote = state.md.options.quotes[3];5690 -1 } else {5691 -1 openQuote = state.md.options.quotes[0];5692 -1 closeQuote = state.md.options.quotes[1];5693 -1 }5694 -15695 -1 // replace token.content *before* tokens[item.token].content,5696 -1 // because, if they are pointing at the same token, replaceAt5697 -1 // could mess up indices when quote length != 15698 -1 token.content = replaceAt(token.content, t.index, closeQuote);5699 -1 tokens[item.token].content = replaceAt(5700 -1 tokens[item.token].content, item.pos, openQuote);5701 -15702 -1 pos += closeQuote.length - 1;5703 -1 if (item.token === i) { pos += openQuote.length - 1; }5704 -15705 -1 text = token.content;5706 -1 max = text.length;5707 -15708 -1 stack.length = j;5709 -1 continue OUTER;5710 -1 }5711 -1 }5712 -1 }5713 -15714 -1 if (canOpen) {5715 -1 stack.push({5716 -1 token: i,5717 -1 pos: t.index,5718 -1 single: isSingle,5719 -1 level: thisLevel5720 -1 });5721 -1 } else if (canClose && isSingle) {5722 -1 token.content = replaceAt(token.content, t.index, APOSTROPHE);5723 -1 }5724 -1 }5725 -1 }5726 -1 }5727 -15728 -15729 -1 module.exports = function smartquotes(state) {5730 -1 /*eslint max-depth:0*/5731 -1 var blkIdx;5732 -15733 -1 if (!state.md.options.typographer) { return; }5734 -15735 -1 for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {5736 -15737 -1 if (state.tokens[blkIdx].type !== 'inline' ||5738 -1 !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {5739 -1 continue;5740 -1 }5741 -15742 -1 process_inlines(state.tokens[blkIdx].children, state);5743 -1 }5744 -1 };5745 -15746 -1 },{"../common/utils":9}],41:[function(require,module,exports){5747 -1 // Core state object5748 -1 //5749 -1 'use strict';5750 -15751 -1 var Token = require('../token');5752 -15753 -15754 -1 function StateCore(src, md, env) {5755 -1 this.src = src;5756 -1 this.env = env;5757 -1 this.tokens = [];5758 -1 this.inlineMode = false;5759 -1 this.md = md; // link to parser instance5760 -1 }5761 -15762 -1 // re-export Token class to use in core rules5763 -1 StateCore.prototype.Token = Token;5764 -15765 -15766 -1 module.exports = StateCore;5767 -15768 -1 },{"../token":56}],42:[function(require,module,exports){5769 -1 // Process autolinks '<protocol:...>'5770 -15771 -1 'use strict';5772 -15773 -15774 -1 /*eslint max-len:0*/5775 -1 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])?)*)>/;5776 -1 var AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;5777 -15778 -15779 -1 module.exports = function autolink(state, silent) {5780 -1 var tail, linkMatch, emailMatch, url, fullUrl, token,5781 -1 pos = state.pos;5782 -15783 -1 if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }5784 -15785 -1 tail = state.src.slice(pos);5786 -15787 -1 if (tail.indexOf('>') < 0) { return false; }5788 -15789 -1 if (AUTOLINK_RE.test(tail)) {5790 -1 linkMatch = tail.match(AUTOLINK_RE);5791 -15792 -1 url = linkMatch[0].slice(1, -1);5793 -1 fullUrl = state.md.normalizeLink(url);5794 -1 if (!state.md.validateLink(fullUrl)) { return false; }5795 -15796 -1 if (!silent) {5797 -1 token = state.push('link_open', 'a', 1);5798 -1 token.attrs = [ [ 'href', fullUrl ] ];5799 -1 token.markup = 'autolink';5800 -1 token.info = 'auto';5801 -15802 -1 token = state.push('text', '', 0);5803 -1 token.content = state.md.normalizeLinkText(url);5804 -15805 -1 token = state.push('link_close', 'a', -1);5806 -1 token.markup = 'autolink';5807 -1 token.info = 'auto';5808 -1 }5809 -15810 -1 state.pos += linkMatch[0].length;5811 -1 return true;5812 -1 }5813 -15814 -1 if (EMAIL_RE.test(tail)) {5815 -1 emailMatch = tail.match(EMAIL_RE);5816 -15817 -1 url = emailMatch[0].slice(1, -1);5818 -1 fullUrl = state.md.normalizeLink('mailto:' + url);5819 -1 if (!state.md.validateLink(fullUrl)) { return false; }5820 -15821 -1 if (!silent) {5822 -1 token = state.push('link_open', 'a', 1);5823 -1 token.attrs = [ [ 'href', fullUrl ] ];5824 -1 token.markup = 'autolink';5825 -1 token.info = 'auto';5826 -15827 -1 token = state.push('text', '', 0);5828 -1 token.content = state.md.normalizeLinkText(url);5829 -15830 -1 token = state.push('link_close', 'a', -1);5831 -1 token.markup = 'autolink';5832 -1 token.info = 'auto';5833 -1 }5834 -15835 -1 state.pos += emailMatch[0].length;5836 -1 return true;5837 -1 }5838 -15839 -1 return false;5840 -1 };5841 -15842 -1 },{}],43:[function(require,module,exports){5843 -1 // Parse backticks5844 -15845 -1 'use strict';5846 -15847 -1 module.exports = function backtick(state, silent) {5848 -1 var start, max, marker, matchStart, matchEnd, token,5849 -1 pos = state.pos,5850 -1 ch = state.src.charCodeAt(pos);5851 -15852 -1 if (ch !== 0x60/* ` */) { return false; }5853 -15854 -1 start = pos;5855 -1 pos++;5856 -1 max = state.posMax;5857 -15858 -1 while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }5859 -15860 -1 marker = state.src.slice(start, pos);5861 -15862 -1 matchStart = matchEnd = pos;5863 -15864 -1 while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {5865 -1 matchEnd = matchStart + 1;5866 -15867 -1 while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }5868 -15869 -1 if (matchEnd - matchStart === marker.length) {5870 -1 if (!silent) {5871 -1 token = state.push('code_inline', 'code', 0);5872 -1 token.markup = marker;5873 -1 token.content = state.src.slice(pos, matchStart)5874 -1 .replace(/[ \n]+/g, ' ')5875 -1 .trim();5876 -1 }5877 -1 state.pos = matchEnd;5878 -1 return true;5879 -1 }5880 -1 }5881 -15882 -1 if (!silent) { state.pending += marker; }5883 -1 state.pos += marker.length;5884 -1 return true;5885 -1 };5886 -15887 -1 },{}],44:[function(require,module,exports){5888 -1 // For each opening emphasis-like marker find a matching closing one5889 -1 //5890 -1 'use strict';5891 -15892 -15893 -1 module.exports = function link_pairs(state) {5894 -1 var i, j, lastDelim, currDelim,5895 -1 delimiters = state.delimiters,5896 -1 max = state.delimiters.length;5897 -15898 -1 for (i = 0; i < max; i++) {5899 -1 lastDelim = delimiters[i];5900 -15901 -1 if (!lastDelim.close) { continue; }5902 -15903 -1 j = i - lastDelim.jump - 1;5904 -15905 -1 while (j >= 0) {5906 -1 currDelim = delimiters[j];5907 -15908 -1 if (currDelim.open &&5909 -1 currDelim.marker === lastDelim.marker &&5910 -1 currDelim.end < 0 &&5911 -1 currDelim.level === lastDelim.level) {5912 -15913 -1 lastDelim.jump = i - j;5914 -1 lastDelim.open = false;5915 -1 currDelim.end = i;5916 -1 currDelim.jump = 0;5917 -1 break;5918 -1 }5919 -15920 -1 j -= currDelim.jump + 1;5921 -1 }5922 -1 }5923 -1 };5924 -15925 -1 },{}],45:[function(require,module,exports){5926 -1 // Process *this* and _that_5927 -1 //5928 -1 'use strict';5929 -15930 -15931 -1 // Insert each marker as a separate text token, and add it to delimiter list5932 -1 //5933 -1 module.exports.tokenize = function emphasis(state, silent) {5934 -1 var i, scanned, token,5935 -1 start = state.pos,5936 -1 marker = state.src.charCodeAt(start);5937 -15938 -1 if (silent) { return false; }5939 -15940 -1 if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }5941 -15942 -1 scanned = state.scanDelims(state.pos, marker === 0x2A);5943 -15944 -1 for (i = 0; i < scanned.length; i++) {5945 -1 token = state.push('text', '', 0);5946 -1 token.content = String.fromCharCode(marker);5947 -15948 -1 state.delimiters.push({5949 -1 // Char code of the starting marker (number).5950 -1 //5951 -1 marker: marker,5952 -15953 -1 // An amount of characters before this one that's equivalent to5954 -1 // current one. In plain English: if this delimiter does not open5955 -1 // an emphasis, neither do previous `jump` characters.5956 -1 //5957 -1 // Used to skip sequences like "*****" in one step, for 1st asterisk5958 -1 // value will be 0, for 2nd it's 1 and so on.5959 -1 //5960 -1 jump: i,5961 -15962 -1 // A position of the token this delimiter corresponds to.5963 -1 //5964 -1 token: state.tokens.length - 1,5965 -15966 -1 // Token level.5967 -1 //5968 -1 level: state.level,5969 -15970 -1 // If this delimiter is matched as a valid opener, `end` will be5971 -1 // equal to its position, otherwise it's `-1`.5972 -1 //5973 -1 end: -1,5974 -15975 -1 // Boolean flags that determine if this delimiter could open or close5976 -1 // an emphasis.5977 -1 //5978 -1 open: scanned.can_open,5979 -1 close: scanned.can_close5980 -1 });5981 -1 }5982 -15983 -1 state.pos += scanned.length;5984 -15985 -1 return true;5986 -1 };5987 -15988 -15989 -1 // Walk through delimiter list and replace text tokens with tags5990 -1 //5991 -1 module.exports.postProcess = function emphasis(state) {5992 -1 var i,5993 -1 startDelim,5994 -1 endDelim,5995 -1 token,5996 -1 ch,5997 -1 isStrong,5998 -1 delimiters = state.delimiters,5999 -1 max = state.delimiters.length;6000 -16001 -1 for (i = 0; i < max; i++) {6002 -1 startDelim = delimiters[i];6003 -16004 -1 if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {6005 -1 continue;6006 -1 }6007 -16008 -1 // Process only opening markers6009 -1 if (startDelim.end === -1) {6010 -1 continue;6011 -1 }6012 -16013 -1 endDelim = delimiters[startDelim.end];6014 -16015 -1 // If the next delimiter has the same marker and is adjacent to this one,6016 -1 // merge those into one strong delimiter.6017 -1 //6018 -1 // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`6019 -1 //6020 -1 isStrong = i + 1 < max &&6021 -1 delimiters[i + 1].end === startDelim.end - 1 &&6022 -1 delimiters[i + 1].token === startDelim.token + 1 &&6023 -1 delimiters[startDelim.end - 1].token === endDelim.token - 1 &&6024 -1 delimiters[i + 1].marker === startDelim.marker;6025 -16026 -1 ch = String.fromCharCode(startDelim.marker);6027 -16028 -1 token = state.tokens[startDelim.token];6029 -1 token.type = isStrong ? 'strong_open' : 'em_open';6030 -1 token.tag = isStrong ? 'strong' : 'em';6031 -1 token.nesting = 1;6032 -1 token.markup = isStrong ? ch + ch : ch;6033 -1 token.content = '';6034 -16035 -1 token = state.tokens[endDelim.token];6036 -1 token.type = isStrong ? 'strong_close' : 'em_close';6037 -1 token.tag = isStrong ? 'strong' : 'em';6038 -1 token.nesting = -1;6039 -1 token.markup = isStrong ? ch + ch : ch;6040 -1 token.content = '';6041 -16042 -1 if (isStrong) {6043 -1 state.tokens[delimiters[i + 1].token].content = '';6044 -1 state.tokens[delimiters[startDelim.end - 1].token].content = '';6045 -1 i++;6046 -1 }6047 -1 }6048 -1 };6049 -16050 -1 },{}],46:[function(require,module,exports){6051 -1 // Process html entity - {, ¯, ", ...6052 -16053 -1 'use strict';6054 -16055 -1 var entities = require('../common/entities');6056 -1 var has = require('../common/utils').has;6057 -1 var isValidEntityCode = require('../common/utils').isValidEntityCode;6058 -1 var fromCodePoint = require('../common/utils').fromCodePoint;6059 -16060 -16061 -1 var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;6062 -1 var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;6063 -16064 -16065 -1 module.exports = function entity(state, silent) {6066 -1 var ch, code, match, pos = state.pos, max = state.posMax;6067 -16068 -1 if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }6069 -16070 -1 if (pos + 1 < max) {6071 -1 ch = state.src.charCodeAt(pos + 1);6072 -16073 -1 if (ch === 0x23 /* # */) {6074 -1 match = state.src.slice(pos).match(DIGITAL_RE);6075 -1 if (match) {6076 -1 if (!silent) {6077 -1 code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);6078 -1 state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);6079 -1 }6080 -1 state.pos += match[0].length;6081 -1 return true;6082 -1 }6083 -1 } else {6084 -1 match = state.src.slice(pos).match(NAMED_RE);6085 -1 if (match) {6086 -1 if (has(entities, match[1])) {6087 -1 if (!silent) { state.pending += entities[match[1]]; }6088 -1 state.pos += match[0].length;6089 -1 return true;6090 -1 }6091 -1 }6092 -1 }6093 -1 }6094 -16095 -1 if (!silent) { state.pending += '&'; }6096 -1 state.pos++;6097 -1 return true;6098 -1 };6099 -16100 -1 },{"../common/entities":6,"../common/utils":9}],47:[function(require,module,exports){6101 -1 // Proceess escaped chars and hardbreaks6102 -16103 -1 'use strict';6104 -16105 -1 var isSpace = require('../common/utils').isSpace;6106 -16107 -1 var ESCAPED = [];6108 -16109 -1 for (var i = 0; i < 256; i++) { ESCAPED.push(0); }6110 -16111 -1 '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'6112 -1 .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });6113 -16114 -16115 -1 module.exports = function escape(state, silent) {6116 -1 var ch, pos = state.pos, max = state.posMax;6117 -16118 -1 if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }6119 -16120 -1 pos++;6121 -16122 -1 if (pos < max) {6123 -1 ch = state.src.charCodeAt(pos);6124 -16125 -1 if (ch < 256 && ESCAPED[ch] !== 0) {6126 -1 if (!silent) { state.pending += state.src[pos]; }6127 -1 state.pos += 2;6128 -1 return true;6129 -1 }6130 -16131 -1 if (ch === 0x0A) {6132 -1 if (!silent) {6133 -1 state.push('hardbreak', 'br', 0);6134 -1 }6135 -16136 -1 pos++;6137 -1 // skip leading whitespaces from next line6138 -1 while (pos < max) {6139 -1 ch = state.src.charCodeAt(pos);6140 -1 if (!isSpace(ch)) { break; }6141 -1 pos++;6142 -1 }6143 -16144 -1 state.pos = pos;6145 -1 return true;6146 -1 }6147 -1 }6148 -16149 -1 if (!silent) { state.pending += '\\'; }6150 -1 state.pos++;6151 -1 return true;6152 -1 };6153 -16154 -1 },{"../common/utils":9}],48:[function(require,module,exports){6155 -1 // Process html tags6156 -16157 -1 'use strict';6158 -16159 -16160 -1 var HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;6161 -16162 -16163 -1 function isLetter(ch) {6164 -1 /*eslint no-bitwise:0*/6165 -1 var lc = ch | 0x20; // to lower case6166 -1 return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);6167 -1 }6168 -16169 -16170 -1 module.exports = function html_inline(state, silent) {6171 -1 var ch, match, max, token,6172 -1 pos = state.pos;6173 -16174 -1 if (!state.md.options.html) { return false; }6175 -16176 -1 // Check start6177 -1 max = state.posMax;6178 -1 if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||6179 -1 pos + 2 >= max) {6180 -1 return false;6181 -1 }6182 -16183 -1 // Quick fail on second char6184 -1 ch = state.src.charCodeAt(pos + 1);6185 -1 if (ch !== 0x21/* ! */ &&6186 -1 ch !== 0x3F/* ? */ &&6187 -1 ch !== 0x2F/* / */ &&6188 -1 !isLetter(ch)) {6189 -1 return false;6190 -1 }6191 -16192 -1 match = state.src.slice(pos).match(HTML_TAG_RE);6193 -1 if (!match) { return false; }6194 -16195 -1 if (!silent) {6196 -1 token = state.push('html_inline', '', 0);6197 -1 token.content = state.src.slice(pos, pos + match[0].length);6198 -1 }6199 -1 state.pos += match[0].length;6200 -1 return true;6201 -1 };6202 -16203 -1 },{"../common/html_re":8}],49:[function(require,module,exports){6204 -1 // Process 6205 -16206 -1 'use strict';6207 -16208 -1 var parseLinkLabel = require('../helpers/parse_link_label');6209 -1 var parseLinkDestination = require('../helpers/parse_link_destination');6210 -1 var parseLinkTitle = require('../helpers/parse_link_title');6211 -1 var normalizeReference = require('../common/utils').normalizeReference;6212 -1 var isSpace = require('../common/utils').isSpace;6213 -16214 -16215 -1 module.exports = function image(state, silent) {6216 -1 var attrs,6217 -1 code,6218 -1 content,6219 -1 label,6220 -1 labelEnd,6221 -1 labelStart,6222 -1 pos,6223 -1 ref,6224 -1 res,6225 -1 title,6226 -1 token,6227 -1 tokens,6228 -1 start,6229 -1 href = '',6230 -1 oldPos = state.pos,6231 -1 max = state.posMax;6232 -16233 -1 if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }6234 -1 if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }6235 -16236 -1 labelStart = state.pos + 2;6237 -1 labelEnd = parseLinkLabel(state, state.pos + 1, false);6238 -16239 -1 // parser failed to find ']', so it's not a valid link6240 -1 if (labelEnd < 0) { return false; }6241 -16242 -1 pos = labelEnd + 1;6243 -1 if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {6244 -1 //6245 -1 // Inline link6246 -1 //6247 -16248 -1 // [link]( <href> "title" )6249 -1 // ^^ skipping these spaces6250 -1 pos++;6251 -1 for (; pos < max; pos++) {6252 -1 code = state.src.charCodeAt(pos);6253 -1 if (!isSpace(code) && code !== 0x0A) { break; }6254 -1 }6255 -1 if (pos >= max) { return false; }6256 -16257 -1 // [link]( <href> "title" )6258 -1 // ^^^^^^ parsing link destination6259 -1 start = pos;6260 -1 res = parseLinkDestination(state.src, pos, state.posMax);6261 -1 if (res.ok) {6262 -1 href = state.md.normalizeLink(res.str);6263 -1 if (state.md.validateLink(href)) {6264 -1 pos = res.pos;6265 -1 } else {6266 -1 href = '';6267 -1 }6268 -1 }6269 -16270 -1 // [link]( <href> "title" )6271 -1 // ^^ skipping these spaces6272 -1 start = pos;6273 -1 for (; pos < max; pos++) {6274 -1 code = state.src.charCodeAt(pos);6275 -1 if (!isSpace(code) && code !== 0x0A) { break; }6276 -1 }6277 -16278 -1 // [link]( <href> "title" )6279 -1 // ^^^^^^^ parsing link title6280 -1 res = parseLinkTitle(state.src, pos, state.posMax);6281 -1 if (pos < max && start !== pos && res.ok) {6282 -1 title = res.str;6283 -1 pos = res.pos;6284 -16285 -1 // [link]( <href> "title" )6286 -1 // ^^ skipping these spaces6287 -1 for (; pos < max; pos++) {6288 -1 code = state.src.charCodeAt(pos);6289 -1 if (!isSpace(code) && code !== 0x0A) { break; }6290 -1 }6291 -1 } else {6292 -1 title = '';6293 -1 }6294 -16295 -1 if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {6296 -1 state.pos = oldPos;6297 -1 return false;6298 -1 }6299 -1 pos++;6300 -1 } else {6301 -1 //6302 -1 // Link reference6303 -1 //6304 -1 if (typeof state.env.references === 'undefined') { return false; }6305 -16306 -1 if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {6307 -1 start = pos + 1;6308 -1 pos = parseLinkLabel(state, pos);6309 -1 if (pos >= 0) {6310 -1 label = state.src.slice(start, pos++);6311 -1 } else {6312 -1 pos = labelEnd + 1;6313 -1 }6314 -1 } else {6315 -1 pos = labelEnd + 1;6316 -1 }6317 -16318 -1 // covers label === '' and label === undefined6319 -1 // (collapsed reference link and shortcut reference link respectively)6320 -1 if (!label) { label = state.src.slice(labelStart, labelEnd); }6321 -16322 -1 ref = state.env.references[normalizeReference(label)];6323 -1 if (!ref) {6324 -1 state.pos = oldPos;6325 -1 return false;6326 -1 }6327 -1 href = ref.href;6328 -1 title = ref.title;6329 -1 }6330 -16331 -1 //6332 -1 // We found the end of the link, and know for a fact it's a valid link;6333 -1 // so all that's left to do is to call tokenizer.6334 -1 //6335 -1 if (!silent) {6336 -1 content = state.src.slice(labelStart, labelEnd);6337 -16338 -1 state.md.inline.parse(6339 -1 content,6340 -1 state.md,6341 -1 state.env,6342 -1 tokens = []6343 -1 );6344 -16345 -1 token = state.push('image', 'img', 0);6346 -1 token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];6347 -1 token.children = tokens;6348 -1 token.content = content;6349 -16350 -1 if (title) {6351 -1 attrs.push([ 'title', title ]);6352 -1 }6353 -1 }6354 -16355 -1 state.pos = pos;6356 -1 state.posMax = max;6357 -1 return true;6358 -1 };6359 -16360 -1 },{"../common/utils":9,"../helpers/parse_link_destination":11,"../helpers/parse_link_label":12,"../helpers/parse_link_title":13}],50:[function(require,module,exports){6361 -1 // Process [link](<to> "stuff")6362 -16363 -1 'use strict';6364 -16365 -1 var parseLinkLabel = require('../helpers/parse_link_label');6366 -1 var parseLinkDestination = require('../helpers/parse_link_destination');6367 -1 var parseLinkTitle = require('../helpers/parse_link_title');6368 -1 var normalizeReference = require('../common/utils').normalizeReference;6369 -1 var isSpace = require('../common/utils').isSpace;6370 -16371 -16372 -1 module.exports = function link(state, silent) {6373 -1 var attrs,6374 -1 code,6375 -1 label,6376 -1 labelEnd,6377 -1 labelStart,6378 -1 pos,6379 -1 res,6380 -1 ref,6381 -1 title,6382 -1 token,6383 -1 href = '',6384 -1 oldPos = state.pos,6385 -1 max = state.posMax,6386 -1 start = state.pos;6387 -16388 -1 if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }6389 -16390 -1 labelStart = state.pos + 1;6391 -1 labelEnd = parseLinkLabel(state, state.pos, true);6392 -16393 -1 // parser failed to find ']', so it's not a valid link6394 -1 if (labelEnd < 0) { return false; }6395 -16396 -1 pos = labelEnd + 1;6397 -1 if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {6398 -1 //6399 -1 // Inline link6400 -1 //6401 -16402 -1 // [link]( <href> "title" )6403 -1 // ^^ skipping these spaces6404 -1 pos++;6405 -1 for (; pos < max; pos++) {6406 -1 code = state.src.charCodeAt(pos);6407 -1 if (!isSpace(code) && code !== 0x0A) { break; }6408 -1 }6409 -1 if (pos >= max) { return false; }6410 -16411 -1 // [link]( <href> "title" )6412 -1 // ^^^^^^ parsing link destination6413 -1 start = pos;6414 -1 res = parseLinkDestination(state.src, pos, state.posMax);6415 -1 if (res.ok) {6416 -1 href = state.md.normalizeLink(res.str);6417 -1 if (state.md.validateLink(href)) {6418 -1 pos = res.pos;6419 -1 } else {6420 -1 href = '';6421 -1 }6422 -1 }6423 -16424 -1 // [link]( <href> "title" )6425 -1 // ^^ skipping these spaces6426 -1 start = pos;6427 -1 for (; pos < max; pos++) {6428 -1 code = state.src.charCodeAt(pos);6429 -1 if (!isSpace(code) && code !== 0x0A) { break; }6430 -1 }6431 -16432 -1 // [link]( <href> "title" )6433 -1 // ^^^^^^^ parsing link title6434 -1 res = parseLinkTitle(state.src, pos, state.posMax);6435 -1 if (pos < max && start !== pos && res.ok) {6436 -1 title = res.str;6437 -1 pos = res.pos;6438 -16439 -1 // [link]( <href> "title" )6440 -1 // ^^ skipping these spaces6441 -1 for (; pos < max; pos++) {6442 -1 code = state.src.charCodeAt(pos);6443 -1 if (!isSpace(code) && code !== 0x0A) { break; }6444 -1 }6445 -1 } else {6446 -1 title = '';6447 -1 }6448 -16449 -1 if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {6450 -1 state.pos = oldPos;6451 -1 return false;6452 -1 }6453 -1 pos++;6454 -1 } else {6455 -1 //6456 -1 // Link reference6457 -1 //6458 -1 if (typeof state.env.references === 'undefined') { return false; }6459 -16460 -1 if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {6461 -1 start = pos + 1;6462 -1 pos = parseLinkLabel(state, pos);6463 -1 if (pos >= 0) {6464 -1 label = state.src.slice(start, pos++);6465 -1 } else {6466 -1 pos = labelEnd + 1;6467 -1 }6468 -1 } else {6469 -1 pos = labelEnd + 1;6470 -1 }6471 -16472 -1 // covers label === '' and label === undefined6473 -1 // (collapsed reference link and shortcut reference link respectively)6474 -1 if (!label) { label = state.src.slice(labelStart, labelEnd); }6475 -16476 -1 ref = state.env.references[normalizeReference(label)];6477 -1 if (!ref) {6478 -1 state.pos = oldPos;6479 -1 return false;6480 -1 }6481 -1 href = ref.href;6482 -1 title = ref.title;6483 -1 }6484 -16485 -1 //6486 -1 // We found the end of the link, and know for a fact it's a valid link;6487 -1 // so all that's left to do is to call tokenizer.6488 -1 //6489 -1 if (!silent) {6490 -1 state.pos = labelStart;6491 -1 state.posMax = labelEnd;6492 -16493 -1 token = state.push('link_open', 'a', 1);6494 -1 token.attrs = attrs = [ [ 'href', href ] ];6495 -1 if (title) {6496 -1 attrs.push([ 'title', title ]);6497 -1 }6498 -16499 -1 state.md.inline.tokenize(state);6500 -16501 -1 token = state.push('link_close', 'a', -1);6502 -1 }6503 -16504 -1 state.pos = pos;6505 -1 state.posMax = max;6506 -1 return true;6507 -1 };6508 -16509 -1 },{"../common/utils":9,"../helpers/parse_link_destination":11,"../helpers/parse_link_label":12,"../helpers/parse_link_title":13}],51:[function(require,module,exports){6510 -1 // Proceess '\n'6511 -16512 -1 'use strict';6513 -16514 -1 module.exports = function newline(state, silent) {6515 -1 var pmax, max, pos = state.pos;6516 -16517 -1 if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }6518 -16519 -1 pmax = state.pending.length - 1;6520 -1 max = state.posMax;6521 -16522 -1 // ' \n' -> hardbreak6523 -1 // Lookup in pending chars is bad practice! Don't copy to other rules!6524 -1 // Pending string is stored in concat mode, indexed lookups will cause6525 -1 // convertion to flat mode.6526 -1 if (!silent) {6527 -1 if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {6528 -1 if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {6529 -1 state.pending = state.pending.replace(/ +$/, '');6530 -1 state.push('hardbreak', 'br', 0);6531 -1 } else {6532 -1 state.pending = state.pending.slice(0, -1);6533 -1 state.push('softbreak', 'br', 0);6534 -1 }6535 -16536 -1 } else {6537 -1 state.push('softbreak', 'br', 0);6538 -1 }6539 -1 }6540 -16541 -1 pos++;6542 -16543 -1 // skip heading spaces for next line6544 -1 while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }6545 -16546 -1 state.pos = pos;6547 -1 return true;6548 -1 };6549 -16550 -1 },{}],52:[function(require,module,exports){6551 -1 // Inline parser state6552 -16553 -1 'use strict';6554 -16555 -16556 -1 var Token = require('../token');6557 -1 var isWhiteSpace = require('../common/utils').isWhiteSpace;6558 -1 var isPunctChar = require('../common/utils').isPunctChar;6559 -1 var isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;6560 -16561 -16562 -1 function StateInline(src, md, env, outTokens) {6563 -1 this.src = src;6564 -1 this.env = env;6565 -1 this.md = md;6566 -1 this.tokens = outTokens;6567 -16568 -1 this.pos = 0;6569 -1 this.posMax = this.src.length;6570 -1 this.level = 0;6571 -1 this.pending = '';6572 -1 this.pendingLevel = 0;6573 -16574 -1 this.cache = {}; // Stores { start: end } pairs. Useful for backtrack6575 -1 // optimization of pairs parse (emphasis, strikes).6576 -16577 -1 this.delimiters = []; // Emphasis-like delimiters6578 -1 }6579 -16580 -16581 -1 // Flush pending text6582 -1 //6583 -1 StateInline.prototype.pushPending = function () {6584 -1 var token = new Token('text', '', 0);6585 -1 token.content = this.pending;6586 -1 token.level = this.pendingLevel;6587 -1 this.tokens.push(token);6588 -1 this.pending = '';6589 -1 return token;6590 -1 };6591 -16592 -16593 -1 // Push new token to "stream".6594 -1 // If pending text exists - flush it as text token6595 -1 //6596 -1 StateInline.prototype.push = function (type, tag, nesting) {6597 -1 if (this.pending) {6598 -1 this.pushPending();6599 -1 }6600 -16601 -1 var token = new Token(type, tag, nesting);6602 -16603 -1 if (nesting < 0) { this.level--; }6604 -1 token.level = this.level;6605 -1 if (nesting > 0) { this.level++; }6606 -16607 -1 this.pendingLevel = this.level;6608 -1 this.tokens.push(token);6609 -1 return token;6610 -1 };6611 -16612 -16613 -1 // Scan a sequence of emphasis-like markers, and determine whether6614 -1 // it can start an emphasis sequence or end an emphasis sequence.6615 -1 //6616 -1 // - start - position to scan from (it should point at a valid marker);6617 -1 // - canSplitWord - determine if these markers can be found inside a word6618 -1 //6619 -1 StateInline.prototype.scanDelims = function (start, canSplitWord) {6620 -1 var pos = start, lastChar, nextChar, count, can_open, can_close,6621 -1 isLastWhiteSpace, isLastPunctChar,6622 -1 isNextWhiteSpace, isNextPunctChar,6623 -1 left_flanking = true,6624 -1 right_flanking = true,6625 -1 max = this.posMax,6626 -1 marker = this.src.charCodeAt(start);6627 -16628 -1 // treat beginning of the line as a whitespace6629 -1 lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;6630 -16631 -1 while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }6632 -16633 -1 count = pos - start;6634 -16635 -1 // treat end of the line as a whitespace6636 -1 nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;6637 -16638 -1 isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));6639 -1 isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));6640 -16641 -1 isLastWhiteSpace = isWhiteSpace(lastChar);6642 -1 isNextWhiteSpace = isWhiteSpace(nextChar);6643 -16644 -1 if (isNextWhiteSpace) {6645 -1 left_flanking = false;6646 -1 } else if (isNextPunctChar) {6647 -1 if (!(isLastWhiteSpace || isLastPunctChar)) {6648 -1 left_flanking = false;6649 -1 }6650 -1 }6651 -16652 -1 if (isLastWhiteSpace) {6653 -1 right_flanking = false;6654 -1 } else if (isLastPunctChar) {6655 -1 if (!(isNextWhiteSpace || isNextPunctChar)) {6656 -1 right_flanking = false;6657 -1 }6658 -1 }6659 -16660 -1 if (!canSplitWord) {6661 -1 can_open = left_flanking && (!right_flanking || isLastPunctChar);6662 -1 can_close = right_flanking && (!left_flanking || isNextPunctChar);6663 -1 } else {6664 -1 can_open = left_flanking;6665 -1 can_close = right_flanking;6666 -1 }6667 -16668 -1 return {6669 -1 can_open: can_open,6670 -1 can_close: can_close,6671 -1 length: count6672 -1 };6673 -1 };6674 -16675 -16676 -1 // re-export Token class to use in block rules6677 -1 StateInline.prototype.Token = Token;6678 -16679 -16680 -1 module.exports = StateInline;6681 -16682 -1 },{"../common/utils":9,"../token":56}],53:[function(require,module,exports){6683 -1 // ~~strike through~~6684 -1 //6685 -1 'use strict';6686 -16687 -16688 -1 // Insert each marker as a separate text token, and add it to delimiter list6689 -1 //6690 -1 module.exports.tokenize = function strikethrough(state, silent) {6691 -1 var i, scanned, token, len, ch,6692 -1 start = state.pos,6693 -1 marker = state.src.charCodeAt(start);6694 -16695 -1 if (silent) { return false; }6696 -16697 -1 if (marker !== 0x7E/* ~ */) { return false; }6698 -16699 -1 scanned = state.scanDelims(state.pos, true);6700 -1 len = scanned.length;6701 -1 ch = String.fromCharCode(marker);6702 -16703 -1 if (len < 2) { return false; }6704 -16705 -1 if (len % 2) {6706 -1 token = state.push('text', '', 0);6707 -1 token.content = ch;6708 -1 len--;6709 -1 }6710 -16711 -1 for (i = 0; i < len; i += 2) {6712 -1 token = state.push('text', '', 0);6713 -1 token.content = ch + ch;6714 -16715 -1 state.delimiters.push({6716 -1 marker: marker,6717 -1 jump: i,6718 -1 token: state.tokens.length - 1,6719 -1 level: state.level,6720 -1 end: -1,6721 -1 open: scanned.can_open,6722 -1 close: scanned.can_close6723 -1 });6724 -1 }6725 -16726 -1 state.pos += scanned.length;6727 -16728 -1 return true;6729 -1 };6730 -16731 -16732 -1 // Walk through delimiter list and replace text tokens with tags6733 -1 //6734 -1 module.exports.postProcess = function strikethrough(state) {6735 -1 var i, j,6736 -1 startDelim,6737 -1 endDelim,6738 -1 token,6739 -1 loneMarkers = [],6740 -1 delimiters = state.delimiters,6741 -1 max = state.delimiters.length;6742 -16743 -1 for (i = 0; i < max; i++) {6744 -1 startDelim = delimiters[i];6745 -16746 -1 if (startDelim.marker !== 0x7E/* ~ */) {6747 -1 continue;6748 -1 }6749 -16750 -1 if (startDelim.end === -1) {6751 -1 continue;6752 -1 }6753 -16754 -1 endDelim = delimiters[startDelim.end];6755 -16756 -1 token = state.tokens[startDelim.token];6757 -1 token.type = 's_open';6758 -1 token.tag = 's';6759 -1 token.nesting = 1;6760 -1 token.markup = '~~';6761 -1 token.content = '';6762 -16763 -1 token = state.tokens[endDelim.token];6764 -1 token.type = 's_close';6765 -1 token.tag = 's';6766 -1 token.nesting = -1;6767 -1 token.markup = '~~';6768 -1 token.content = '';6769 -16770 -1 if (state.tokens[endDelim.token - 1].type === 'text' &&6771 -1 state.tokens[endDelim.token - 1].content === '~') {6772 -16773 -1 loneMarkers.push(endDelim.token - 1);6774 -1 }6775 -1 }6776 -16777 -1 // If a marker sequence has an odd number of characters, it's splitted6778 -1 // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the6779 -1 // start of the sequence.6780 -1 //6781 -1 // So, we have to move all those markers after subsequent s_close tags.6782 -1 //6783 -1 while (loneMarkers.length) {6784 -1 i = loneMarkers.pop();6785 -1 j = i + 1;6786 -16787 -1 while (j < state.tokens.length && state.tokens[j].type === 's_close') {6788 -1 j++;6789 -1 }6790 -16791 -1 j--;6792 -16793 -1 if (i !== j) {6794 -1 token = state.tokens[j];6795 -1 state.tokens[j] = state.tokens[i];6796 -1 state.tokens[i] = token;6797 -1 }6798 -1 }6799 -1 };6800 -16801 -1 },{}],54:[function(require,module,exports){6802 -1 // Skip text characters for text token, place those to pending buffer6803 -1 // and increment current pos6804 -16805 -1 'use strict';6806 -16807 -16808 -1 // Rule to skip pure text6809 -1 // '{}$%@~+=:' reserved for extentions6810 -16811 -1 // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~6812 -16813 -1 // !!!! Don't confuse with "Markdown ASCII Punctuation" chars6814 -1 // http://spec.commonmark.org/0.15/#ascii-punctuation-character6815 -1 function isTerminatorChar(ch) {6816 -1 switch (ch) {6817 -1 case 0x0A/* \n */:6818 -1 case 0x21/* ! */:6819 -1 case 0x23/* # */:6820 -1 case 0x24/* $ */:6821 -1 case 0x25/* % */:6822 -1 case 0x26/* & */:6823 -1 case 0x2A/* * */:6824 -1 case 0x2B/* + */:6825 -1 case 0x2D/* - */:6826 -1 case 0x3A/* : */:6827 -1 case 0x3C/* < */:6828 -1 case 0x3D/* = */:6829 -1 case 0x3E/* > */:6830 -1 case 0x40/* @ */:6831 -1 case 0x5B/* [ */:6832 -1 case 0x5C/* \ */:6833 -1 case 0x5D/* ] */:6834 -1 case 0x5E/* ^ */:6835 -1 case 0x5F/* _ */:6836 -1 case 0x60/* ` */:6837 -1 case 0x7B/* { */:6838 -1 case 0x7D/* } */:6839 -1 case 0x7E/* ~ */:6840 -1 return true;6841 -1 default:6842 -1 return false;6843 -1 }6844 -1 }6845 -16846 -1 module.exports = function text(state, silent) {6847 -1 var pos = state.pos;6848 -16849 -1 while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {6850 -1 pos++;6851 -1 }6852 -16853 -1 if (pos === state.pos) { return false; }6854 -16855 -1 if (!silent) { state.pending += state.src.slice(state.pos, pos); }6856 -16857 -1 state.pos = pos;6858 -16859 -1 return true;6860 -1 };6861 -16862 -1 // Alternative implementation, for memory.6863 -1 //6864 -1 // It costs 10% of performance, but allows extend terminators list, if place it6865 -1 // to `ParcerInline` property. Probably, will switch to it sometime, such6866 -1 // flexibility required.6867 -16868 -1 /*6869 -1 var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;6870 -16871 -1 module.exports = function text(state, silent) {6872 -1 var pos = state.pos,6873 -1 idx = state.src.slice(pos).search(TERMINATOR_RE);6874 -16875 -1 // first char is terminator -> empty text6876 -1 if (idx === 0) { return false; }6877 -16878 -1 // no terminator -> text till end of string6879 -1 if (idx < 0) {6880 -1 if (!silent) { state.pending += state.src.slice(pos); }6881 -1 state.pos = state.src.length;6882 -1 return true;6883 -1 }6884 -16885 -1 if (!silent) { state.pending += state.src.slice(pos, pos + idx); }6886 -16887 -1 state.pos += idx;6888 -16889 -1 return true;6890 -1 };*/6891 -16892 -1 },{}],55:[function(require,module,exports){6893 -1 // Merge adjacent text nodes into one, and re-calculate all token levels6894 -1 //6895 -1 'use strict';6896 -16897 -16898 -1 module.exports = function text_collapse(state) {6899 -1 var curr, last,6900 -1 level = 0,6901 -1 tokens = state.tokens,6902 -1 max = state.tokens.length;6903 -16904 -1 for (curr = last = 0; curr < max; curr++) {6905 -1 // re-calculate levels6906 -1 level += tokens[curr].nesting;6907 -1 tokens[curr].level = level;6908 -16909 -1 if (tokens[curr].type === 'text' &&6910 -1 curr + 1 < max &&6911 -1 tokens[curr + 1].type === 'text') {6912 -16913 -1 // collapse two adjacent text nodes6914 -1 tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;6915 -1 } else {6916 -1 if (curr !== last) { tokens[last] = tokens[curr]; }6917 -16918 -1 last++;6919 -1 }6920 -1 }6921 -16922 -1 if (curr !== last) {6923 -1 tokens.length = last;6924 -1 }6925 -1 };6926 -16927 -1 },{}],56:[function(require,module,exports){6928 -1 // Token class6929 -16930 -1 'use strict';6931 -16932 -16933 -1 /**6934 -1 * class Token6935 -1 **/6936 -16937 -1 /**6938 -1 * new Token(type, tag, nesting)6939 -1 *6940 -1 * Create new token and fill passed properties.6941 -1 **/6942 -1 function Token(type, tag, nesting) {6943 -1 /**6944 -1 * Token#type -> String6945 -1 *6946 -1 * Type of the token (string, e.g. "paragraph_open")6947 -1 **/6948 -1 this.type = type;6949 -16950 -1 /**6951 -1 * Token#tag -> String6952 -1 *6953 -1 * html tag name, e.g. "p"6954 -1 **/6955 -1 this.tag = tag;6956 -16957 -1 /**6958 -1 * Token#attrs -> Array6959 -1 *6960 -1 * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`6961 -1 **/6962 -1 this.attrs = null;6963 -16964 -1 /**6965 -1 * Token#map -> Array6966 -1 *6967 -1 * Source map info. Format: `[ line_begin, line_end ]`6968 -1 **/6969 -1 this.map = null;6970 -16971 -1 /**6972 -1 * Token#nesting -> Number6973 -1 *6974 -1 * Level change (number in {-1, 0, 1} set), where:6975 -1 *6976 -1 * - `1` means the tag is opening6977 -1 * - `0` means the tag is self-closing6978 -1 * - `-1` means the tag is closing6979 -1 **/6980 -1 this.nesting = nesting;6981 -16982 -1 /**6983 -1 * Token#level -> Number6984 -1 *6985 -1 * nesting level, the same as `state.level`6986 -1 **/6987 -1 this.level = 0;6988 -16989 -1 /**6990 -1 * Token#children -> Array6991 -1 *6992 -1 * An array of child nodes (inline and img tokens)6993 -1 **/6994 -1 this.children = null;6995 -16996 -1 /**6997 -1 * Token#content -> String6998 -1 *6999 -1 * In a case of self-closing tag (code, html, fence, etc.),7000 -1 * it has contents of this tag.7001 -1 **/7002 -1 this.content = '';7003 -17004 -1 /**7005 -1 * Token#markup -> String7006 -1 *7007 -1 * '*' or '_' for emphasis, fence string for fence, etc.7008 -1 **/7009 -1 this.markup = '';7010 -17011 -1 /**7012 -1 * Token#info -> String7013 -1 *7014 -1 * fence infostring7015 -1 **/7016 -1 this.info = '';7017 -17018 -1 /**7019 -1 * Token#meta -> Object7020 -1 *7021 -1 * A place for plugins to store an arbitrary data7022 -1 **/7023 -1 this.meta = null;7024 -17025 -1 /**7026 -1 * Token#block -> Boolean7027 -1 *7028 -1 * True for block-level tokens, false for inline tokens.7029 -1 * Used in renderer to calculate line breaks7030 -1 **/7031 -1 this.block = false;7032 -17033 -1 /**7034 -1 * Token#hidden -> Boolean7035 -1 *7036 -1 * If it's true, ignore this element when rendering. Used for tight lists7037 -1 * to hide paragraphs.7038 -1 **/7039 -1 this.hidden = false;7040 -1 }7041 -17042 -17043 -1 /**7044 -1 * Token.attrIndex(name) -> Number7045 -1 *7046 -1 * Search attribute index by name.7047 -1 **/7048 -1 Token.prototype.attrIndex = function attrIndex(name) {7049 -1 var attrs, i, len;7050 -17051 -1 if (!this.attrs) { return -1; }7052 -17053 -1 attrs = this.attrs;7054 -17055 -1 for (i = 0, len = attrs.length; i < len; i++) {7056 -1 if (attrs[i][0] === name) { return i; }7057 -1 }7058 -1 return -1;7059 -1 };7060 -17061 -17062 -1 /**7063 -1 * Token.attrPush(attrData)7064 -1 *7065 -1 * Add `[ name, value ]` attribute to list. Init attrs if necessary7066 -1 **/7067 -1 Token.prototype.attrPush = function attrPush(attrData) {7068 -1 if (this.attrs) {7069 -1 this.attrs.push(attrData);7070 -1 } else {7071 -1 this.attrs = [ attrData ];7072 -1 }7073 -1 };7074 -17075 -17076 -1 /**7077 -1 * Token.attrSet(name, value)7078 -1 *7079 -1 * Set `name` attribute to `value`. Override old value if exists.7080 -1 **/7081 -1 Token.prototype.attrSet = function attrSet(name, value) {7082 -1 var idx = this.attrIndex(name),7083 -1 attrData = [ name, value ];7084 -17085 -1 if (idx < 0) {7086 -1 this.attrPush(attrData);7087 -1 } else {7088 -1 this.attrs[idx] = attrData;7089 -1 }7090 -1 };7091 -17092 -17093 -1 /**7094 -1 * Token.attrGet(name)7095 -1 *7096 -1 * Get the value of attribute `name`, or null if it does not exist.7097 -1 **/7098 -1 Token.prototype.attrGet = function attrGet(name) {7099 -1 var idx = this.attrIndex(name), value = null;7100 -1 if (idx >= 0) {7101 -1 value = this.attrs[idx][1];7102 -1 }7103 -1 return value;7104 -1 };7105 -17106 -17107 -1 /**7108 -1 * Token.attrJoin(name, value)7109 -1 *7110 -1 * Join value to existing attribute via space. Or create new attribute if not7111 -1 * exists. Useful to operate with token classes.7112 -1 **/7113 -1 Token.prototype.attrJoin = function attrJoin(name, value) {7114 -1 var idx = this.attrIndex(name);7115 -17116 -1 if (idx < 0) {7117 -1 this.attrPush([ name, value ]);7118 -1 } else {7119 -1 this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;7120 -1 }7121 -1 };7122 -17123 -17124 -1 module.exports = Token;7125 -17126 -1 },{}],57:[function(require,module,exports){7127 -17128 -1 'use strict';7129 -17130 -17131 -1 /* eslint-disable no-bitwise */7132 -17133 -1 var decodeCache = {};7134 -17135 -1 function getDecodeCache(exclude) {7136 -1 var i, ch, cache = decodeCache[exclude];7137 -1 if (cache) { return cache; }7138 -17139 -1 cache = decodeCache[exclude] = [];7140 -17141 -1 for (i = 0; i < 128; i++) {7142 -1 ch = String.fromCharCode(i);7143 -1 cache.push(ch);7144 -1 }7145 -17146 -1 for (i = 0; i < exclude.length; i++) {7147 -1 ch = exclude.charCodeAt(i);7148 -1 cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);7149 -1 }7150 -17151 -1 return cache;7152 -1 }7153 -17154 -17155 -1 // Decode percent-encoded string.7156 -1 //7157 -1 function decode(string, exclude) {7158 -1 var cache;7159 -17160 -1 if (typeof exclude !== 'string') {7161 -1 exclude = decode.defaultChars;7162 -1 }7163 -17164 -1 cache = getDecodeCache(exclude);7165 -17166 -1 return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {7167 -1 var i, l, b1, b2, b3, b4, chr,7168 -1 result = '';7169 -17170 -1 for (i = 0, l = seq.length; i < l; i += 3) {7171 -1 b1 = parseInt(seq.slice(i + 1, i + 3), 16);7172 -17173 -1 if (b1 < 0x80) {7174 -1 result += cache[b1];7175 -1 continue;7176 -1 }7177 -17178 -1 if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {7179 -1 // 110xxxxx 10xxxxxx7180 -1 b2 = parseInt(seq.slice(i + 4, i + 6), 16);7181 -17182 -1 if ((b2 & 0xC0) === 0x80) {7183 -1 chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);7184 -17185 -1 if (chr < 0x80) {7186 -1 result += '\ufffd\ufffd';7187 -1 } else {7188 -1 result += String.fromCharCode(chr);7189 -1 }7190 -17191 -1 i += 3;7192 -1 continue;7193 -1 }7194 -1 }7195 -17196 -1 if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {7197 -1 // 1110xxxx 10xxxxxx 10xxxxxx7198 -1 b2 = parseInt(seq.slice(i + 4, i + 6), 16);7199 -1 b3 = parseInt(seq.slice(i + 7, i + 9), 16);7200 -17201 -1 if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {7202 -1 chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);7203 -17204 -1 if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {7205 -1 result += '\ufffd\ufffd\ufffd';7206 -1 } else {7207 -1 result += String.fromCharCode(chr);7208 -1 }7209 -17210 -1 i += 6;7211 -1 continue;7212 -1 }7213 -1 }7214 -17215 -1 if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {7216 -1 // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx7217 -1 b2 = parseInt(seq.slice(i + 4, i + 6), 16);7218 -1 b3 = parseInt(seq.slice(i + 7, i + 9), 16);7219 -1 b4 = parseInt(seq.slice(i + 10, i + 12), 16);7220 -17221 -1 if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {7222 -1 chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);7223 -17224 -1 if (chr < 0x10000 || chr > 0x10FFFF) {7225 -1 result += '\ufffd\ufffd\ufffd\ufffd';7226 -1 } else {7227 -1 chr -= 0x10000;7228 -1 result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));7229 -1 }7230 -17231 -1 i += 9;7232 -1 continue;7233 -1 }7234 -1 }7235 -17236 -1 result += '\ufffd';7237 -1 }7238 -17239 -1 return result;7240 -1 });7241 -1 }7242 -17243 -17244 -1 decode.defaultChars = ';/?:@&=+$,#';7245 -1 decode.componentChars = '';7246 -17247 -17248 -1 module.exports = decode;7249 -17250 -1 },{}],58:[function(require,module,exports){7251 -17252 -1 'use strict';7253 -17254 -17255 -1 var encodeCache = {};7256 -17257 -17258 -1 // Create a lookup array where anything but characters in `chars` string7259 -1 // and alphanumeric chars is percent-encoded.7260 -1 //7261 -1 function getEncodeCache(exclude) {7262 -1 var i, ch, cache = encodeCache[exclude];7263 -1 if (cache) { return cache; }7264 -17265 -1 cache = encodeCache[exclude] = [];7266 -17267 -1 for (i = 0; i < 128; i++) {7268 -1 ch = String.fromCharCode(i);7269 -17270 -1 if (/^[0-9a-z]$/i.test(ch)) {7271 -1 // always allow unencoded alphanumeric characters7272 -1 cache.push(ch);7273 -1 } else {7274 -1 cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));7275 -1 }7276 -1 }7277 -17278 -1 for (i = 0; i < exclude.length; i++) {7279 -1 cache[exclude.charCodeAt(i)] = exclude[i];7280 -1 }7281 -17282 -1 return cache;7283 -1 }7284 -17285 -17286 -1 // Encode unsafe characters with percent-encoding, skipping already7287 -1 // encoded sequences.7288 -1 //7289 -1 // - string - string to encode7290 -1 // - exclude - list of characters to ignore (in addition to a-zA-Z0-9)7291 -1 // - keepEscaped - don't encode '%' in a correct escape sequence (default: true)7292 -1 //7293 -1 function encode(string, exclude, keepEscaped) {7294 -1 var i, l, code, nextCode, cache,7295 -1 result = '';7296 -17297 -1 if (typeof exclude !== 'string') {7298 -1 // encode(string, keepEscaped)7299 -1 keepEscaped = exclude;7300 -1 exclude = encode.defaultChars;7301 -1 }7302 -17303 -1 if (typeof keepEscaped === 'undefined') {7304 -1 keepEscaped = true;7305 -1 }7306 -17307 -1 cache = getEncodeCache(exclude);7308 -17309 -1 for (i = 0, l = string.length; i < l; i++) {7310 -1 code = string.charCodeAt(i);7311 -17312 -1 if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {7313 -1 if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {7314 -1 result += string.slice(i, i + 3);7315 -1 i += 2;7316 -1 continue;7317 -1 }7318 -1 }7319 -17320 -1 if (code < 128) {7321 -1 result += cache[code];7322 -1 continue;7323 -1 }7324 -17325 -1 if (code >= 0xD800 && code <= 0xDFFF) {7326 -1 if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {7327 -1 nextCode = string.charCodeAt(i + 1);7328 -1 if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {7329 -1 result += encodeURIComponent(string[i] + string[i + 1]);7330 -1 i++;7331 -1 continue;7332 -1 }7333 -1 }7334 -1 result += '%EF%BF%BD';7335 -1 continue;7336 -1 }7337 -17338 -1 result += encodeURIComponent(string[i]);7339 -1 }7340 -17341 -1 return result;7342 -1 }7343 -17344 -1 encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";7345 -1 encode.componentChars = "-_.!~*'()";7346 -17347 -17348 -1 module.exports = encode;7349 -17350 -1 },{}],59:[function(require,module,exports){7351 -17352 -1 'use strict';7353 -17354 -17355 -1 module.exports = function format(url) {7356 -1 var result = '';7357 -17358 -1 result += url.protocol || '';7359 -1 result += url.slashes ? '//' : '';7360 -1 result += url.auth ? url.auth + '@' : '';7361 -17362 -1 if (url.hostname && url.hostname.indexOf(':') !== -1) {7363 -1 // ipv6 address7364 -1 result += '[' + url.hostname + ']';7365 -1 } else {7366 -1 result += url.hostname || '';7367 -1 }7368 -17369 -1 result += url.port ? ':' + url.port : '';7370 -1 result += url.pathname || '';7371 -1 result += url.search || '';7372 -1 result += url.hash || '';7373 -17374 -1 return result;7375 -1 };7376 -17377 -1 },{}],60:[function(require,module,exports){7378 -1 'use strict';7379 -17380 -17381 -1 module.exports.encode = require('./encode');7382 -1 module.exports.decode = require('./decode');7383 -1 module.exports.format = require('./format');7384 -1 module.exports.parse = require('./parse');7385 -17386 -1 },{"./decode":57,"./encode":58,"./format":59,"./parse":61}],61:[function(require,module,exports){7387 -1 // Copyright Joyent, Inc. and other Node contributors.7388 -1 //7389 -1 // Permission is hereby granted, free of charge, to any person obtaining a7390 -1 // copy of this software and associated documentation files (the7391 -1 // "Software"), to deal in the Software without restriction, including7392 -1 // without limitation the rights to use, copy, modify, merge, publish,7393 -1 // distribute, sublicense, and/or sell copies of the Software, and to permit7394 -1 // persons to whom the Software is furnished to do so, subject to the7395 -1 // following conditions:7396 -1 //7397 -1 // The above copyright notice and this permission notice shall be included7398 -1 // in all copies or substantial portions of the Software.7399 -1 //7400 -1 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS7401 -1 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF7402 -1 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN7403 -1 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,7404 -1 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR7405 -1 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE7406 -1 // USE OR OTHER DEALINGS IN THE SOFTWARE.7407 -17408 -1 'use strict';7409 -17410 -1 //7411 -1 // Changes from joyent/node:7412 -1 //7413 -1 // 1. No leading slash in paths,7414 -1 // e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`7415 -1 //7416 -1 // 2. Backslashes are not replaced with slashes,7417 -1 // so `http:\\example.org\` is treated like a relative path7418 -1 //7419 -1 // 3. Trailing colon is treated like a part of the path,7420 -1 // i.e. in `http://example.org:foo` pathname is `:foo`7421 -1 //7422 -1 // 4. Nothing is URL-encoded in the resulting object,7423 -1 // (in joyent/node some chars in auth and paths are encoded)7424 -1 //7425 -1 // 5. `url.parse()` does not have `parseQueryString` argument7426 -1 //7427 -1 // 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,7428 -1 // which can be constructed using other parts of the url.7429 -1 //7430 -17431 -17432 -1 function Url() {7433 -1 this.protocol = null;7434 -1 this.slashes = null;7435 -1 this.auth = null;7436 -1 this.port = null;7437 -1 this.hostname = null;7438 -1 this.hash = null;7439 -1 this.search = null;7440 -1 this.pathname = null;7441 -1 }7442 -17443 -1 // Reference: RFC 3986, RFC 1808, RFC 23967444 -17445 -1 // define these here so at least they only have to be7446 -1 // compiled once on the first module load.7447 -1 var protocolPattern = /^([a-z0-9.+-]+:)/i,7448 -1 portPattern = /:[0-9]*$/,7449 -17450 -1 // Special case for a simple path URL7451 -1 simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,7452 -17453 -1 // RFC 2396: characters reserved for delimiting URLs.7454 -1 // We actually just auto-escape these.7455 -1 delims = [ '<', '>', '"', '`', ' ', '\r', '\n', '\t' ],7456 -17457 -1 // RFC 2396: characters not allowed for various reasons.7458 -1 unwise = [ '{', '}', '|', '\\', '^', '`' ].concat(delims),7459 -17460 -1 // Allowed by RFCs, but cause of XSS attacks. Always escape these.7461 -1 autoEscape = [ '\'' ].concat(unwise),7462 -1 // Characters that are never ever allowed in a hostname.7463 -1 // Note that any invalid chars are also handled, but these7464 -1 // are the ones that are *expected* to be seen, so we fast-path7465 -1 // them.7466 -1 nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),7467 -1 hostEndingChars = [ '/', '?', '#' ],7468 -1 hostnameMaxLen = 255,7469 -1 hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,7470 -1 hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,7471 -1 // protocols that can allow "unsafe" and "unwise" chars.7472 -1 /* eslint-disable no-script-url */7473 -1 // protocols that never have a hostname.7474 -1 hostlessProtocol = {7475 -1 'javascript': true,7476 -1 'javascript:': true7477 -1 },7478 -1 // protocols that always contain a // bit.7479 -1 slashedProtocol = {7480 -1 'http': true,7481 -1 'https': true,7482 -1 'ftp': true,7483 -1 'gopher': true,7484 -1 'file': true,7485 -1 'http:': true,7486 -1 'https:': true,7487 -1 'ftp:': true,7488 -1 'gopher:': true,7489 -1 'file:': true7490 -1 };7491 -1 /* eslint-enable no-script-url */7492 -17493 -1 function urlParse(url, slashesDenoteHost) {7494 -1 if (url && url instanceof Url) { return url; }7495 -17496 -1 var u = new Url();7497 -1 u.parse(url, slashesDenoteHost);7498 -1 return u;7499 -1 }7500 -17501 -1 Url.prototype.parse = function(url, slashesDenoteHost) {7502 -1 var i, l, lowerProto, hec, slashes,7503 -1 rest = url;7504 -17505 -1 // trim before proceeding.7506 -1 // This is to support parse stuff like " http://foo.com \n"7507 -1 rest = rest.trim();7508 -17509 -1 if (!slashesDenoteHost && url.split('#').length === 1) {7510 -1 // Try fast path regexp7511 -1 var simplePath = simplePathPattern.exec(rest);7512 -1 if (simplePath) {7513 -1 this.pathname = simplePath[1];7514 -1 if (simplePath[2]) {7515 -1 this.search = simplePath[2];7516 -1 }7517 -1 return this;7518 -1 }7519 -1 }7520 -17521 -1 var proto = protocolPattern.exec(rest);7522 -1 if (proto) {7523 -1 proto = proto[0];7524 -1 lowerProto = proto.toLowerCase();7525 -1 this.protocol = proto;7526 -1 rest = rest.substr(proto.length);7527 -1 }7528 -17529 -1 // figure out if it's got a host7530 -1 // user@server is *always* interpreted as a hostname, and url7531 -1 // resolution will treat //foo/bar as host=foo,path=bar because that's7532 -1 // how the browser resolves relative URLs.7533 -1 if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {7534 -1 slashes = rest.substr(0, 2) === '//';7535 -1 if (slashes && !(proto && hostlessProtocol[proto])) {7536 -1 rest = rest.substr(2);7537 -1 this.slashes = true;7538 -1 }7539 -1 }7540 -17541 -1 if (!hostlessProtocol[proto] &&7542 -1 (slashes || (proto && !slashedProtocol[proto]))) {7543 -17544 -1 // there's a hostname.7545 -1 // the first instance of /, ?, ;, or # ends the host.7546 -1 //7547 -1 // If there is an @ in the hostname, then non-host chars *are* allowed7548 -1 // to the left of the last @ sign, unless some host-ending character7549 -1 // comes *before* the @-sign.7550 -1 // URLs are obnoxious.7551 -1 //7552 -1 // ex:7553 -1 // http://a@b@c/ => user:a@b host:c7554 -1 // http://a@b?@c => user:a host:c path:/?@c7555 -17556 -1 // v0.12 TODO(isaacs): This is not quite how Chrome does things.7557 -1 // Review our test case against browsers more comprehensively.7558 -17559 -1 // find the first instance of any hostEndingChars7560 -1 var hostEnd = -1;7561 -1 for (i = 0; i < hostEndingChars.length; i++) {7562 -1 hec = rest.indexOf(hostEndingChars[i]);7563 -1 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {7564 -1 hostEnd = hec;7565 -1 }7566 -1 }7567 -17568 -1 // at this point, either we have an explicit point where the7569 -1 // auth portion cannot go past, or the last @ char is the decider.7570 -1 var auth, atSign;7571 -1 if (hostEnd === -1) {7572 -1 // atSign can be anywhere.7573 -1 atSign = rest.lastIndexOf('@');7574 -1 } else {7575 -1 // atSign must be in auth portion.7576 -1 // http://a@b/c@d => host:b auth:a path:/c@d7577 -1 atSign = rest.lastIndexOf('@', hostEnd);7578 -1 }7579 -17580 -1 // Now we have a portion which is definitely the auth.7581 -1 // Pull that off.7582 -1 if (atSign !== -1) {7583 -1 auth = rest.slice(0, atSign);7584 -1 rest = rest.slice(atSign + 1);7585 -1 this.auth = auth;7586 -1 }7587 -17588 -1 // the host is the remaining to the left of the first non-host char7589 -1 hostEnd = -1;7590 -1 for (i = 0; i < nonHostChars.length; i++) {7591 -1 hec = rest.indexOf(nonHostChars[i]);7592 -1 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {7593 -1 hostEnd = hec;7594 -1 }7595 -1 }7596 -1 // if we still have not hit it, then the entire thing is a host.7597 -1 if (hostEnd === -1) {7598 -1 hostEnd = rest.length;7599 -1 }7600 -17601 -1 if (rest[hostEnd - 1] === ':') { hostEnd--; }7602 -1 var host = rest.slice(0, hostEnd);7603 -1 rest = rest.slice(hostEnd);7604 -17605 -1 // pull out port.7606 -1 this.parseHost(host);7607 -17608 -1 // we've indicated that there is a hostname,7609 -1 // so even if it's empty, it has to be present.7610 -1 this.hostname = this.hostname || '';7611 -17612 -1 // if hostname begins with [ and ends with ]7613 -1 // assume that it's an IPv6 address.7614 -1 var ipv6Hostname = this.hostname[0] === '[' &&7615 -1 this.hostname[this.hostname.length - 1] === ']';7616 -17617 -1 // validate a little.7618 -1 if (!ipv6Hostname) {7619 -1 var hostparts = this.hostname.split(/\./);7620 -1 for (i = 0, l = hostparts.length; i < l; i++) {7621 -1 var part = hostparts[i];7622 -1 if (!part) { continue; }7623 -1 if (!part.match(hostnamePartPattern)) {7624 -1 var newpart = '';7625 -1 for (var j = 0, k = part.length; j < k; j++) {7626 -1 if (part.charCodeAt(j) > 127) {7627 -1 // we replace non-ASCII char with a temporary placeholder7628 -1 // we need this to make sure size of hostname is not7629 -1 // broken by replacing non-ASCII by nothing7630 -1 newpart += 'x';7631 -1 } else {7632 -1 newpart += part[j];7633 -1 }7634 -1 }7635 -1 // we test again with ASCII char only7636 -1 if (!newpart.match(hostnamePartPattern)) {7637 -1 var validParts = hostparts.slice(0, i);7638 -1 var notHost = hostparts.slice(i + 1);7639 -1 var bit = part.match(hostnamePartStart);7640 -1 if (bit) {7641 -1 validParts.push(bit[1]);7642 -1 notHost.unshift(bit[2]);7643 -1 }7644 -1 if (notHost.length) {7645 -1 rest = notHost.join('.') + rest;7646 -1 }7647 -1 this.hostname = validParts.join('.');7648 -1 break;7649 -1 }7650 -1 }7651 -1 }7652 -1 }7653 -17654 -1 if (this.hostname.length > hostnameMaxLen) {7655 -1 this.hostname = '';7656 -1 }7657 -17658 -1 // strip [ and ] from the hostname7659 -1 // the host field still retains them, though7660 -1 if (ipv6Hostname) {7661 -1 this.hostname = this.hostname.substr(1, this.hostname.length - 2);7662 -1 }7663 -1 }7664 -17665 -1 // chop off from the tail first.7666 -1 var hash = rest.indexOf('#');7667 -1 if (hash !== -1) {7668 -1 // got a fragment string.7669 -1 this.hash = rest.substr(hash);7670 -1 rest = rest.slice(0, hash);7671 -1 }7672 -1 var qm = rest.indexOf('?');7673 -1 if (qm !== -1) {7674 -1 this.search = rest.substr(qm);7675 -1 rest = rest.slice(0, qm);7676 -1 }7677 -1 if (rest) { this.pathname = rest; }7678 -1 if (slashedProtocol[lowerProto] &&7679 -1 this.hostname && !this.pathname) {7680 -1 this.pathname = '';7681 -1 }7682 -17683 -1 return this;7684 -1 };7685 -17686 -1 Url.prototype.parseHost = function(host) {7687 -1 var port = portPattern.exec(host);7688 -1 if (port) {7689 -1 port = port[0];7690 -1 if (port !== ':') {7691 -1 this.port = port.substr(1);7692 -1 }7693 -1 host = host.substr(0, host.length - port.length);7694 -1 }7695 -1 if (host) { this.hostname = host; }7696 -1 };7697 -17698 -1 module.exports = urlParse;7699 -17700 -1 },{}],62:[function(require,module,exports){7701 -1 module.exports=/[\0-\x1F\x7F-\x9F]/7702 -1 },{}],63:[function(require,module,exports){7703 -1 module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804\uDCBD|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/7704 -1 },{}],64:[function(require,module,exports){7705 -1 module.exports=/[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/7706 -1 },{}],65:[function(require,module,exports){7707 -1 module.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/7708 -1 },{}],66:[function(require,module,exports){7709 -17710 -1 module.exports.Any = require('./properties/Any/regex');7711 -1 module.exports.Cc = require('./categories/Cc/regex');7712 -1 module.exports.Cf = require('./categories/Cf/regex');7713 -1 module.exports.P = require('./categories/P/regex');7714 -1 module.exports.Z = require('./categories/Z/regex');7715 -17716 -1 },{"./categories/Cc/regex":62,"./categories/Cf/regex":63,"./categories/P/regex":64,"./categories/Z/regex":65,"./properties/Any/regex":67}],67:[function(require,module,exports){7717 -1 module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/7718 -1 },{}],68:[function(require,module,exports){7719 -1 var MarkdownIt = require('markdown-it');7720 -17721 -1 var md = new MarkdownIt();7722 -1 var element = document.getElementById('markdown');7723 -1 element.outerHTML = md.render(element.textContent);7724 -17725 -1 },{"markdown-it":5}]},{},[68]);
diff --git a/static/src/markdown.js b/static/src/markdown.js
@@ -1,5 +0,0 @@1 -1 var MarkdownIt = require('markdown-it');2 -13 -1 var md = new MarkdownIt();4 -1 var element = document.getElementById('markdown');5 -1 element.outerHTML = md.render(element.textContent);
diff --git a/tpl/app.html b/tpl/app.html
@@ -3,7 +3,7 @@ 3 3 4 4 <head> 5 5 <meta charset="utf-8">6 -1 <title>voterunner - <= topic =></title>-1 6 <title>voterunner - {{ topic }}</title> 7 7 <meta name="viewport" content="width=device-width" /> 8 8 <link rel="shortcut icon" href="/favicon.ico"/> 9 9 <link rel="stylesheet" type="text/css" href="/style.css" /> @@ -50,6 +50,6 @@ 50 50 51 51 </body> 52 5253 -1 <% nodes %>-1 53 {{ nodes|json }} 54 54 55 55 </html>
diff --git a/tpl/markdown.html b/tpl/markdown.html
@@ -14,8 +14,7 @@ 14 14 </head> 15 15 16 16 <body>17 -1 <pre id="markdown"><= markdown =></pre>18 -1 <script type="text/javascript" src="/markdown.js"></script>-1 17 {{{ markdown|markdown }}} 19 18 </body> 20 19 21 20 </html>