11cb0ef41Sopenharmony_ci/** 21cb0ef41Sopenharmony_ci * marked - a markdown parser 31cb0ef41Sopenharmony_ci * Copyright (c) 2011-2021, Christopher Jeffrey. (MIT Licensed) 41cb0ef41Sopenharmony_ci * https://github.com/markedjs/marked 51cb0ef41Sopenharmony_ci */ 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci/** 81cb0ef41Sopenharmony_ci * DO NOT EDIT THIS FILE 91cb0ef41Sopenharmony_ci * The code in this file is generated from files in ./src/ 101cb0ef41Sopenharmony_ci */ 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci(function (global, factory) { 131cb0ef41Sopenharmony_ci typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 141cb0ef41Sopenharmony_ci typeof define === 'function' && define.amd ? define(factory) : 151cb0ef41Sopenharmony_ci (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.marked = factory()); 161cb0ef41Sopenharmony_ci}(this, (function () { 'use strict'; 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci function _defineProperties(target, props) { 191cb0ef41Sopenharmony_ci for (var i = 0; i < props.length; i++) { 201cb0ef41Sopenharmony_ci var descriptor = props[i]; 211cb0ef41Sopenharmony_ci descriptor.enumerable = descriptor.enumerable || false; 221cb0ef41Sopenharmony_ci descriptor.configurable = true; 231cb0ef41Sopenharmony_ci if ("value" in descriptor) descriptor.writable = true; 241cb0ef41Sopenharmony_ci Object.defineProperty(target, descriptor.key, descriptor); 251cb0ef41Sopenharmony_ci } 261cb0ef41Sopenharmony_ci } 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci function _createClass(Constructor, protoProps, staticProps) { 291cb0ef41Sopenharmony_ci if (protoProps) _defineProperties(Constructor.prototype, protoProps); 301cb0ef41Sopenharmony_ci if (staticProps) _defineProperties(Constructor, staticProps); 311cb0ef41Sopenharmony_ci return Constructor; 321cb0ef41Sopenharmony_ci } 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci function _unsupportedIterableToArray(o, minLen) { 351cb0ef41Sopenharmony_ci if (!o) return; 361cb0ef41Sopenharmony_ci if (typeof o === "string") return _arrayLikeToArray(o, minLen); 371cb0ef41Sopenharmony_ci var n = Object.prototype.toString.call(o).slice(8, -1); 381cb0ef41Sopenharmony_ci if (n === "Object" && o.constructor) n = o.constructor.name; 391cb0ef41Sopenharmony_ci if (n === "Map" || n === "Set") return Array.from(o); 401cb0ef41Sopenharmony_ci if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 411cb0ef41Sopenharmony_ci } 421cb0ef41Sopenharmony_ci 431cb0ef41Sopenharmony_ci function _arrayLikeToArray(arr, len) { 441cb0ef41Sopenharmony_ci if (len == null || len > arr.length) len = arr.length; 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci return arr2; 491cb0ef41Sopenharmony_ci } 501cb0ef41Sopenharmony_ci 511cb0ef41Sopenharmony_ci function _createForOfIteratorHelperLoose(o, allowArrayLike) { 521cb0ef41Sopenharmony_ci var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; 531cb0ef41Sopenharmony_ci if (it) return (it = it.call(o)).next.bind(it); 541cb0ef41Sopenharmony_ci 551cb0ef41Sopenharmony_ci if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { 561cb0ef41Sopenharmony_ci if (it) o = it; 571cb0ef41Sopenharmony_ci var i = 0; 581cb0ef41Sopenharmony_ci return function () { 591cb0ef41Sopenharmony_ci if (i >= o.length) return { 601cb0ef41Sopenharmony_ci done: true 611cb0ef41Sopenharmony_ci }; 621cb0ef41Sopenharmony_ci return { 631cb0ef41Sopenharmony_ci done: false, 641cb0ef41Sopenharmony_ci value: o[i++] 651cb0ef41Sopenharmony_ci }; 661cb0ef41Sopenharmony_ci }; 671cb0ef41Sopenharmony_ci } 681cb0ef41Sopenharmony_ci 691cb0ef41Sopenharmony_ci throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 701cb0ef41Sopenharmony_ci } 711cb0ef41Sopenharmony_ci 721cb0ef41Sopenharmony_ci var defaults$5 = {exports: {}}; 731cb0ef41Sopenharmony_ci 741cb0ef41Sopenharmony_ci function getDefaults$1() { 751cb0ef41Sopenharmony_ci return { 761cb0ef41Sopenharmony_ci baseUrl: null, 771cb0ef41Sopenharmony_ci breaks: false, 781cb0ef41Sopenharmony_ci extensions: null, 791cb0ef41Sopenharmony_ci gfm: true, 801cb0ef41Sopenharmony_ci headerIds: true, 811cb0ef41Sopenharmony_ci headerPrefix: '', 821cb0ef41Sopenharmony_ci highlight: null, 831cb0ef41Sopenharmony_ci langPrefix: 'language-', 841cb0ef41Sopenharmony_ci mangle: true, 851cb0ef41Sopenharmony_ci pedantic: false, 861cb0ef41Sopenharmony_ci renderer: null, 871cb0ef41Sopenharmony_ci sanitize: false, 881cb0ef41Sopenharmony_ci sanitizer: null, 891cb0ef41Sopenharmony_ci silent: false, 901cb0ef41Sopenharmony_ci smartLists: false, 911cb0ef41Sopenharmony_ci smartypants: false, 921cb0ef41Sopenharmony_ci tokenizer: null, 931cb0ef41Sopenharmony_ci walkTokens: null, 941cb0ef41Sopenharmony_ci xhtml: false 951cb0ef41Sopenharmony_ci }; 961cb0ef41Sopenharmony_ci } 971cb0ef41Sopenharmony_ci 981cb0ef41Sopenharmony_ci function changeDefaults$1(newDefaults) { 991cb0ef41Sopenharmony_ci defaults$5.exports.defaults = newDefaults; 1001cb0ef41Sopenharmony_ci } 1011cb0ef41Sopenharmony_ci 1021cb0ef41Sopenharmony_ci defaults$5.exports = { 1031cb0ef41Sopenharmony_ci defaults: getDefaults$1(), 1041cb0ef41Sopenharmony_ci getDefaults: getDefaults$1, 1051cb0ef41Sopenharmony_ci changeDefaults: changeDefaults$1 1061cb0ef41Sopenharmony_ci }; 1071cb0ef41Sopenharmony_ci 1081cb0ef41Sopenharmony_ci /** 1091cb0ef41Sopenharmony_ci * Helpers 1101cb0ef41Sopenharmony_ci */ 1111cb0ef41Sopenharmony_ci var escapeTest = /[&<>"']/; 1121cb0ef41Sopenharmony_ci var escapeReplace = /[&<>"']/g; 1131cb0ef41Sopenharmony_ci var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/; 1141cb0ef41Sopenharmony_ci var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g; 1151cb0ef41Sopenharmony_ci var escapeReplacements = { 1161cb0ef41Sopenharmony_ci '&': '&', 1171cb0ef41Sopenharmony_ci '<': '<', 1181cb0ef41Sopenharmony_ci '>': '>', 1191cb0ef41Sopenharmony_ci '"': '"', 1201cb0ef41Sopenharmony_ci "'": ''' 1211cb0ef41Sopenharmony_ci }; 1221cb0ef41Sopenharmony_ci 1231cb0ef41Sopenharmony_ci var getEscapeReplacement = function getEscapeReplacement(ch) { 1241cb0ef41Sopenharmony_ci return escapeReplacements[ch]; 1251cb0ef41Sopenharmony_ci }; 1261cb0ef41Sopenharmony_ci 1271cb0ef41Sopenharmony_ci function escape$2(html, encode) { 1281cb0ef41Sopenharmony_ci if (encode) { 1291cb0ef41Sopenharmony_ci if (escapeTest.test(html)) { 1301cb0ef41Sopenharmony_ci return html.replace(escapeReplace, getEscapeReplacement); 1311cb0ef41Sopenharmony_ci } 1321cb0ef41Sopenharmony_ci } else { 1331cb0ef41Sopenharmony_ci if (escapeTestNoEncode.test(html)) { 1341cb0ef41Sopenharmony_ci return html.replace(escapeReplaceNoEncode, getEscapeReplacement); 1351cb0ef41Sopenharmony_ci } 1361cb0ef41Sopenharmony_ci } 1371cb0ef41Sopenharmony_ci 1381cb0ef41Sopenharmony_ci return html; 1391cb0ef41Sopenharmony_ci } 1401cb0ef41Sopenharmony_ci 1411cb0ef41Sopenharmony_ci var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; 1421cb0ef41Sopenharmony_ci 1431cb0ef41Sopenharmony_ci function unescape$1(html) { 1441cb0ef41Sopenharmony_ci // explicitly match decimal, hex, and named HTML entities 1451cb0ef41Sopenharmony_ci return html.replace(unescapeTest, function (_, n) { 1461cb0ef41Sopenharmony_ci n = n.toLowerCase(); 1471cb0ef41Sopenharmony_ci if (n === 'colon') return ':'; 1481cb0ef41Sopenharmony_ci 1491cb0ef41Sopenharmony_ci if (n.charAt(0) === '#') { 1501cb0ef41Sopenharmony_ci return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1)); 1511cb0ef41Sopenharmony_ci } 1521cb0ef41Sopenharmony_ci 1531cb0ef41Sopenharmony_ci return ''; 1541cb0ef41Sopenharmony_ci }); 1551cb0ef41Sopenharmony_ci } 1561cb0ef41Sopenharmony_ci 1571cb0ef41Sopenharmony_ci var caret = /(^|[^\[])\^/g; 1581cb0ef41Sopenharmony_ci 1591cb0ef41Sopenharmony_ci function edit$1(regex, opt) { 1601cb0ef41Sopenharmony_ci regex = regex.source || regex; 1611cb0ef41Sopenharmony_ci opt = opt || ''; 1621cb0ef41Sopenharmony_ci var obj = { 1631cb0ef41Sopenharmony_ci replace: function replace(name, val) { 1641cb0ef41Sopenharmony_ci val = val.source || val; 1651cb0ef41Sopenharmony_ci val = val.replace(caret, '$1'); 1661cb0ef41Sopenharmony_ci regex = regex.replace(name, val); 1671cb0ef41Sopenharmony_ci return obj; 1681cb0ef41Sopenharmony_ci }, 1691cb0ef41Sopenharmony_ci getRegex: function getRegex() { 1701cb0ef41Sopenharmony_ci return new RegExp(regex, opt); 1711cb0ef41Sopenharmony_ci } 1721cb0ef41Sopenharmony_ci }; 1731cb0ef41Sopenharmony_ci return obj; 1741cb0ef41Sopenharmony_ci } 1751cb0ef41Sopenharmony_ci 1761cb0ef41Sopenharmony_ci var nonWordAndColonTest = /[^\w:]/g; 1771cb0ef41Sopenharmony_ci var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; 1781cb0ef41Sopenharmony_ci 1791cb0ef41Sopenharmony_ci function cleanUrl$1(sanitize, base, href) { 1801cb0ef41Sopenharmony_ci if (sanitize) { 1811cb0ef41Sopenharmony_ci var prot; 1821cb0ef41Sopenharmony_ci 1831cb0ef41Sopenharmony_ci try { 1841cb0ef41Sopenharmony_ci prot = decodeURIComponent(unescape$1(href)).replace(nonWordAndColonTest, '').toLowerCase(); 1851cb0ef41Sopenharmony_ci } catch (e) { 1861cb0ef41Sopenharmony_ci return null; 1871cb0ef41Sopenharmony_ci } 1881cb0ef41Sopenharmony_ci 1891cb0ef41Sopenharmony_ci if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) { 1901cb0ef41Sopenharmony_ci return null; 1911cb0ef41Sopenharmony_ci } 1921cb0ef41Sopenharmony_ci } 1931cb0ef41Sopenharmony_ci 1941cb0ef41Sopenharmony_ci if (base && !originIndependentUrl.test(href)) { 1951cb0ef41Sopenharmony_ci href = resolveUrl(base, href); 1961cb0ef41Sopenharmony_ci } 1971cb0ef41Sopenharmony_ci 1981cb0ef41Sopenharmony_ci try { 1991cb0ef41Sopenharmony_ci href = encodeURI(href).replace(/%25/g, '%'); 2001cb0ef41Sopenharmony_ci } catch (e) { 2011cb0ef41Sopenharmony_ci return null; 2021cb0ef41Sopenharmony_ci } 2031cb0ef41Sopenharmony_ci 2041cb0ef41Sopenharmony_ci return href; 2051cb0ef41Sopenharmony_ci } 2061cb0ef41Sopenharmony_ci 2071cb0ef41Sopenharmony_ci var baseUrls = {}; 2081cb0ef41Sopenharmony_ci var justDomain = /^[^:]+:\/*[^/]*$/; 2091cb0ef41Sopenharmony_ci var protocol = /^([^:]+:)[\s\S]*$/; 2101cb0ef41Sopenharmony_ci var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/; 2111cb0ef41Sopenharmony_ci 2121cb0ef41Sopenharmony_ci function resolveUrl(base, href) { 2131cb0ef41Sopenharmony_ci if (!baseUrls[' ' + base]) { 2141cb0ef41Sopenharmony_ci // we can ignore everything in base after the last slash of its path component, 2151cb0ef41Sopenharmony_ci // but we might need to add _that_ 2161cb0ef41Sopenharmony_ci // https://tools.ietf.org/html/rfc3986#section-3 2171cb0ef41Sopenharmony_ci if (justDomain.test(base)) { 2181cb0ef41Sopenharmony_ci baseUrls[' ' + base] = base + '/'; 2191cb0ef41Sopenharmony_ci } else { 2201cb0ef41Sopenharmony_ci baseUrls[' ' + base] = rtrim$1(base, '/', true); 2211cb0ef41Sopenharmony_ci } 2221cb0ef41Sopenharmony_ci } 2231cb0ef41Sopenharmony_ci 2241cb0ef41Sopenharmony_ci base = baseUrls[' ' + base]; 2251cb0ef41Sopenharmony_ci var relativeBase = base.indexOf(':') === -1; 2261cb0ef41Sopenharmony_ci 2271cb0ef41Sopenharmony_ci if (href.substring(0, 2) === '//') { 2281cb0ef41Sopenharmony_ci if (relativeBase) { 2291cb0ef41Sopenharmony_ci return href; 2301cb0ef41Sopenharmony_ci } 2311cb0ef41Sopenharmony_ci 2321cb0ef41Sopenharmony_ci return base.replace(protocol, '$1') + href; 2331cb0ef41Sopenharmony_ci } else if (href.charAt(0) === '/') { 2341cb0ef41Sopenharmony_ci if (relativeBase) { 2351cb0ef41Sopenharmony_ci return href; 2361cb0ef41Sopenharmony_ci } 2371cb0ef41Sopenharmony_ci 2381cb0ef41Sopenharmony_ci return base.replace(domain, '$1') + href; 2391cb0ef41Sopenharmony_ci } else { 2401cb0ef41Sopenharmony_ci return base + href; 2411cb0ef41Sopenharmony_ci } 2421cb0ef41Sopenharmony_ci } 2431cb0ef41Sopenharmony_ci 2441cb0ef41Sopenharmony_ci var noopTest$1 = { 2451cb0ef41Sopenharmony_ci exec: function noopTest() {} 2461cb0ef41Sopenharmony_ci }; 2471cb0ef41Sopenharmony_ci 2481cb0ef41Sopenharmony_ci function merge$2(obj) { 2491cb0ef41Sopenharmony_ci var i = 1, 2501cb0ef41Sopenharmony_ci target, 2511cb0ef41Sopenharmony_ci key; 2521cb0ef41Sopenharmony_ci 2531cb0ef41Sopenharmony_ci for (; i < arguments.length; i++) { 2541cb0ef41Sopenharmony_ci target = arguments[i]; 2551cb0ef41Sopenharmony_ci 2561cb0ef41Sopenharmony_ci for (key in target) { 2571cb0ef41Sopenharmony_ci if (Object.prototype.hasOwnProperty.call(target, key)) { 2581cb0ef41Sopenharmony_ci obj[key] = target[key]; 2591cb0ef41Sopenharmony_ci } 2601cb0ef41Sopenharmony_ci } 2611cb0ef41Sopenharmony_ci } 2621cb0ef41Sopenharmony_ci 2631cb0ef41Sopenharmony_ci return obj; 2641cb0ef41Sopenharmony_ci } 2651cb0ef41Sopenharmony_ci 2661cb0ef41Sopenharmony_ci function splitCells$1(tableRow, count) { 2671cb0ef41Sopenharmony_ci // ensure that every cell-delimiting pipe has a space 2681cb0ef41Sopenharmony_ci // before it to distinguish it from an escaped pipe 2691cb0ef41Sopenharmony_ci var row = tableRow.replace(/\|/g, function (match, offset, str) { 2701cb0ef41Sopenharmony_ci var escaped = false, 2711cb0ef41Sopenharmony_ci curr = offset; 2721cb0ef41Sopenharmony_ci 2731cb0ef41Sopenharmony_ci while (--curr >= 0 && str[curr] === '\\') { 2741cb0ef41Sopenharmony_ci escaped = !escaped; 2751cb0ef41Sopenharmony_ci } 2761cb0ef41Sopenharmony_ci 2771cb0ef41Sopenharmony_ci if (escaped) { 2781cb0ef41Sopenharmony_ci // odd number of slashes means | is escaped 2791cb0ef41Sopenharmony_ci // so we leave it alone 2801cb0ef41Sopenharmony_ci return '|'; 2811cb0ef41Sopenharmony_ci } else { 2821cb0ef41Sopenharmony_ci // add space before unescaped | 2831cb0ef41Sopenharmony_ci return ' |'; 2841cb0ef41Sopenharmony_ci } 2851cb0ef41Sopenharmony_ci }), 2861cb0ef41Sopenharmony_ci cells = row.split(/ \|/); 2871cb0ef41Sopenharmony_ci var i = 0; // First/last cell in a row cannot be empty if it has no leading/trailing pipe 2881cb0ef41Sopenharmony_ci 2891cb0ef41Sopenharmony_ci if (!cells[0].trim()) { 2901cb0ef41Sopenharmony_ci cells.shift(); 2911cb0ef41Sopenharmony_ci } 2921cb0ef41Sopenharmony_ci 2931cb0ef41Sopenharmony_ci if (!cells[cells.length - 1].trim()) { 2941cb0ef41Sopenharmony_ci cells.pop(); 2951cb0ef41Sopenharmony_ci } 2961cb0ef41Sopenharmony_ci 2971cb0ef41Sopenharmony_ci if (cells.length > count) { 2981cb0ef41Sopenharmony_ci cells.splice(count); 2991cb0ef41Sopenharmony_ci } else { 3001cb0ef41Sopenharmony_ci while (cells.length < count) { 3011cb0ef41Sopenharmony_ci cells.push(''); 3021cb0ef41Sopenharmony_ci } 3031cb0ef41Sopenharmony_ci } 3041cb0ef41Sopenharmony_ci 3051cb0ef41Sopenharmony_ci for (; i < cells.length; i++) { 3061cb0ef41Sopenharmony_ci // leading or trailing whitespace is ignored per the gfm spec 3071cb0ef41Sopenharmony_ci cells[i] = cells[i].trim().replace(/\\\|/g, '|'); 3081cb0ef41Sopenharmony_ci } 3091cb0ef41Sopenharmony_ci 3101cb0ef41Sopenharmony_ci return cells; 3111cb0ef41Sopenharmony_ci } // Remove trailing 'c's. Equivalent to str.replace(/c*$/, ''). 3121cb0ef41Sopenharmony_ci // /c*$/ is vulnerable to REDOS. 3131cb0ef41Sopenharmony_ci // invert: Remove suffix of non-c chars instead. Default falsey. 3141cb0ef41Sopenharmony_ci 3151cb0ef41Sopenharmony_ci 3161cb0ef41Sopenharmony_ci function rtrim$1(str, c, invert) { 3171cb0ef41Sopenharmony_ci var l = str.length; 3181cb0ef41Sopenharmony_ci 3191cb0ef41Sopenharmony_ci if (l === 0) { 3201cb0ef41Sopenharmony_ci return ''; 3211cb0ef41Sopenharmony_ci } // Length of suffix matching the invert condition. 3221cb0ef41Sopenharmony_ci 3231cb0ef41Sopenharmony_ci 3241cb0ef41Sopenharmony_ci var suffLen = 0; // Step left until we fail to match the invert condition. 3251cb0ef41Sopenharmony_ci 3261cb0ef41Sopenharmony_ci while (suffLen < l) { 3271cb0ef41Sopenharmony_ci var currChar = str.charAt(l - suffLen - 1); 3281cb0ef41Sopenharmony_ci 3291cb0ef41Sopenharmony_ci if (currChar === c && !invert) { 3301cb0ef41Sopenharmony_ci suffLen++; 3311cb0ef41Sopenharmony_ci } else if (currChar !== c && invert) { 3321cb0ef41Sopenharmony_ci suffLen++; 3331cb0ef41Sopenharmony_ci } else { 3341cb0ef41Sopenharmony_ci break; 3351cb0ef41Sopenharmony_ci } 3361cb0ef41Sopenharmony_ci } 3371cb0ef41Sopenharmony_ci 3381cb0ef41Sopenharmony_ci return str.substr(0, l - suffLen); 3391cb0ef41Sopenharmony_ci } 3401cb0ef41Sopenharmony_ci 3411cb0ef41Sopenharmony_ci function findClosingBracket$1(str, b) { 3421cb0ef41Sopenharmony_ci if (str.indexOf(b[1]) === -1) { 3431cb0ef41Sopenharmony_ci return -1; 3441cb0ef41Sopenharmony_ci } 3451cb0ef41Sopenharmony_ci 3461cb0ef41Sopenharmony_ci var l = str.length; 3471cb0ef41Sopenharmony_ci var level = 0, 3481cb0ef41Sopenharmony_ci i = 0; 3491cb0ef41Sopenharmony_ci 3501cb0ef41Sopenharmony_ci for (; i < l; i++) { 3511cb0ef41Sopenharmony_ci if (str[i] === '\\') { 3521cb0ef41Sopenharmony_ci i++; 3531cb0ef41Sopenharmony_ci } else if (str[i] === b[0]) { 3541cb0ef41Sopenharmony_ci level++; 3551cb0ef41Sopenharmony_ci } else if (str[i] === b[1]) { 3561cb0ef41Sopenharmony_ci level--; 3571cb0ef41Sopenharmony_ci 3581cb0ef41Sopenharmony_ci if (level < 0) { 3591cb0ef41Sopenharmony_ci return i; 3601cb0ef41Sopenharmony_ci } 3611cb0ef41Sopenharmony_ci } 3621cb0ef41Sopenharmony_ci } 3631cb0ef41Sopenharmony_ci 3641cb0ef41Sopenharmony_ci return -1; 3651cb0ef41Sopenharmony_ci } 3661cb0ef41Sopenharmony_ci 3671cb0ef41Sopenharmony_ci function checkSanitizeDeprecation$1(opt) { 3681cb0ef41Sopenharmony_ci if (opt && opt.sanitize && !opt.silent) { 3691cb0ef41Sopenharmony_ci console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options'); 3701cb0ef41Sopenharmony_ci } 3711cb0ef41Sopenharmony_ci } // copied from https://stackoverflow.com/a/5450113/806777 3721cb0ef41Sopenharmony_ci 3731cb0ef41Sopenharmony_ci 3741cb0ef41Sopenharmony_ci function repeatString$1(pattern, count) { 3751cb0ef41Sopenharmony_ci if (count < 1) { 3761cb0ef41Sopenharmony_ci return ''; 3771cb0ef41Sopenharmony_ci } 3781cb0ef41Sopenharmony_ci 3791cb0ef41Sopenharmony_ci var result = ''; 3801cb0ef41Sopenharmony_ci 3811cb0ef41Sopenharmony_ci while (count > 1) { 3821cb0ef41Sopenharmony_ci if (count & 1) { 3831cb0ef41Sopenharmony_ci result += pattern; 3841cb0ef41Sopenharmony_ci } 3851cb0ef41Sopenharmony_ci 3861cb0ef41Sopenharmony_ci count >>= 1; 3871cb0ef41Sopenharmony_ci pattern += pattern; 3881cb0ef41Sopenharmony_ci } 3891cb0ef41Sopenharmony_ci 3901cb0ef41Sopenharmony_ci return result + pattern; 3911cb0ef41Sopenharmony_ci } 3921cb0ef41Sopenharmony_ci 3931cb0ef41Sopenharmony_ci var helpers = { 3941cb0ef41Sopenharmony_ci escape: escape$2, 3951cb0ef41Sopenharmony_ci unescape: unescape$1, 3961cb0ef41Sopenharmony_ci edit: edit$1, 3971cb0ef41Sopenharmony_ci cleanUrl: cleanUrl$1, 3981cb0ef41Sopenharmony_ci resolveUrl: resolveUrl, 3991cb0ef41Sopenharmony_ci noopTest: noopTest$1, 4001cb0ef41Sopenharmony_ci merge: merge$2, 4011cb0ef41Sopenharmony_ci splitCells: splitCells$1, 4021cb0ef41Sopenharmony_ci rtrim: rtrim$1, 4031cb0ef41Sopenharmony_ci findClosingBracket: findClosingBracket$1, 4041cb0ef41Sopenharmony_ci checkSanitizeDeprecation: checkSanitizeDeprecation$1, 4051cb0ef41Sopenharmony_ci repeatString: repeatString$1 4061cb0ef41Sopenharmony_ci }; 4071cb0ef41Sopenharmony_ci 4081cb0ef41Sopenharmony_ci var defaults$4 = defaults$5.exports.defaults; 4091cb0ef41Sopenharmony_ci var rtrim = helpers.rtrim, 4101cb0ef41Sopenharmony_ci splitCells = helpers.splitCells, 4111cb0ef41Sopenharmony_ci _escape = helpers.escape, 4121cb0ef41Sopenharmony_ci findClosingBracket = helpers.findClosingBracket; 4131cb0ef41Sopenharmony_ci 4141cb0ef41Sopenharmony_ci function outputLink(cap, link, raw, lexer) { 4151cb0ef41Sopenharmony_ci var href = link.href; 4161cb0ef41Sopenharmony_ci var title = link.title ? _escape(link.title) : null; 4171cb0ef41Sopenharmony_ci var text = cap[1].replace(/\\([\[\]])/g, '$1'); 4181cb0ef41Sopenharmony_ci 4191cb0ef41Sopenharmony_ci if (cap[0].charAt(0) !== '!') { 4201cb0ef41Sopenharmony_ci lexer.state.inLink = true; 4211cb0ef41Sopenharmony_ci var token = { 4221cb0ef41Sopenharmony_ci type: 'link', 4231cb0ef41Sopenharmony_ci raw: raw, 4241cb0ef41Sopenharmony_ci href: href, 4251cb0ef41Sopenharmony_ci title: title, 4261cb0ef41Sopenharmony_ci text: text, 4271cb0ef41Sopenharmony_ci tokens: lexer.inlineTokens(text, []) 4281cb0ef41Sopenharmony_ci }; 4291cb0ef41Sopenharmony_ci lexer.state.inLink = false; 4301cb0ef41Sopenharmony_ci return token; 4311cb0ef41Sopenharmony_ci } else { 4321cb0ef41Sopenharmony_ci return { 4331cb0ef41Sopenharmony_ci type: 'image', 4341cb0ef41Sopenharmony_ci raw: raw, 4351cb0ef41Sopenharmony_ci href: href, 4361cb0ef41Sopenharmony_ci title: title, 4371cb0ef41Sopenharmony_ci text: _escape(text) 4381cb0ef41Sopenharmony_ci }; 4391cb0ef41Sopenharmony_ci } 4401cb0ef41Sopenharmony_ci } 4411cb0ef41Sopenharmony_ci 4421cb0ef41Sopenharmony_ci function indentCodeCompensation(raw, text) { 4431cb0ef41Sopenharmony_ci var matchIndentToCode = raw.match(/^(\s+)(?:```)/); 4441cb0ef41Sopenharmony_ci 4451cb0ef41Sopenharmony_ci if (matchIndentToCode === null) { 4461cb0ef41Sopenharmony_ci return text; 4471cb0ef41Sopenharmony_ci } 4481cb0ef41Sopenharmony_ci 4491cb0ef41Sopenharmony_ci var indentToCode = matchIndentToCode[1]; 4501cb0ef41Sopenharmony_ci return text.split('\n').map(function (node) { 4511cb0ef41Sopenharmony_ci var matchIndentInNode = node.match(/^\s+/); 4521cb0ef41Sopenharmony_ci 4531cb0ef41Sopenharmony_ci if (matchIndentInNode === null) { 4541cb0ef41Sopenharmony_ci return node; 4551cb0ef41Sopenharmony_ci } 4561cb0ef41Sopenharmony_ci 4571cb0ef41Sopenharmony_ci var indentInNode = matchIndentInNode[0]; 4581cb0ef41Sopenharmony_ci 4591cb0ef41Sopenharmony_ci if (indentInNode.length >= indentToCode.length) { 4601cb0ef41Sopenharmony_ci return node.slice(indentToCode.length); 4611cb0ef41Sopenharmony_ci } 4621cb0ef41Sopenharmony_ci 4631cb0ef41Sopenharmony_ci return node; 4641cb0ef41Sopenharmony_ci }).join('\n'); 4651cb0ef41Sopenharmony_ci } 4661cb0ef41Sopenharmony_ci /** 4671cb0ef41Sopenharmony_ci * Tokenizer 4681cb0ef41Sopenharmony_ci */ 4691cb0ef41Sopenharmony_ci 4701cb0ef41Sopenharmony_ci 4711cb0ef41Sopenharmony_ci var Tokenizer_1 = /*#__PURE__*/function () { 4721cb0ef41Sopenharmony_ci function Tokenizer(options) { 4731cb0ef41Sopenharmony_ci this.options = options || defaults$4; 4741cb0ef41Sopenharmony_ci } 4751cb0ef41Sopenharmony_ci 4761cb0ef41Sopenharmony_ci var _proto = Tokenizer.prototype; 4771cb0ef41Sopenharmony_ci 4781cb0ef41Sopenharmony_ci _proto.space = function space(src) { 4791cb0ef41Sopenharmony_ci var cap = this.rules.block.newline.exec(src); 4801cb0ef41Sopenharmony_ci 4811cb0ef41Sopenharmony_ci if (cap) { 4821cb0ef41Sopenharmony_ci if (cap[0].length > 1) { 4831cb0ef41Sopenharmony_ci return { 4841cb0ef41Sopenharmony_ci type: 'space', 4851cb0ef41Sopenharmony_ci raw: cap[0] 4861cb0ef41Sopenharmony_ci }; 4871cb0ef41Sopenharmony_ci } 4881cb0ef41Sopenharmony_ci 4891cb0ef41Sopenharmony_ci return { 4901cb0ef41Sopenharmony_ci raw: '\n' 4911cb0ef41Sopenharmony_ci }; 4921cb0ef41Sopenharmony_ci } 4931cb0ef41Sopenharmony_ci }; 4941cb0ef41Sopenharmony_ci 4951cb0ef41Sopenharmony_ci _proto.code = function code(src) { 4961cb0ef41Sopenharmony_ci var cap = this.rules.block.code.exec(src); 4971cb0ef41Sopenharmony_ci 4981cb0ef41Sopenharmony_ci if (cap) { 4991cb0ef41Sopenharmony_ci var text = cap[0].replace(/^ {1,4}/gm, ''); 5001cb0ef41Sopenharmony_ci return { 5011cb0ef41Sopenharmony_ci type: 'code', 5021cb0ef41Sopenharmony_ci raw: cap[0], 5031cb0ef41Sopenharmony_ci codeBlockStyle: 'indented', 5041cb0ef41Sopenharmony_ci text: !this.options.pedantic ? rtrim(text, '\n') : text 5051cb0ef41Sopenharmony_ci }; 5061cb0ef41Sopenharmony_ci } 5071cb0ef41Sopenharmony_ci }; 5081cb0ef41Sopenharmony_ci 5091cb0ef41Sopenharmony_ci _proto.fences = function fences(src) { 5101cb0ef41Sopenharmony_ci var cap = this.rules.block.fences.exec(src); 5111cb0ef41Sopenharmony_ci 5121cb0ef41Sopenharmony_ci if (cap) { 5131cb0ef41Sopenharmony_ci var raw = cap[0]; 5141cb0ef41Sopenharmony_ci var text = indentCodeCompensation(raw, cap[3] || ''); 5151cb0ef41Sopenharmony_ci return { 5161cb0ef41Sopenharmony_ci type: 'code', 5171cb0ef41Sopenharmony_ci raw: raw, 5181cb0ef41Sopenharmony_ci lang: cap[2] ? cap[2].trim() : cap[2], 5191cb0ef41Sopenharmony_ci text: text 5201cb0ef41Sopenharmony_ci }; 5211cb0ef41Sopenharmony_ci } 5221cb0ef41Sopenharmony_ci }; 5231cb0ef41Sopenharmony_ci 5241cb0ef41Sopenharmony_ci _proto.heading = function heading(src) { 5251cb0ef41Sopenharmony_ci var cap = this.rules.block.heading.exec(src); 5261cb0ef41Sopenharmony_ci 5271cb0ef41Sopenharmony_ci if (cap) { 5281cb0ef41Sopenharmony_ci var text = cap[2].trim(); // remove trailing #s 5291cb0ef41Sopenharmony_ci 5301cb0ef41Sopenharmony_ci if (/#$/.test(text)) { 5311cb0ef41Sopenharmony_ci var trimmed = rtrim(text, '#'); 5321cb0ef41Sopenharmony_ci 5331cb0ef41Sopenharmony_ci if (this.options.pedantic) { 5341cb0ef41Sopenharmony_ci text = trimmed.trim(); 5351cb0ef41Sopenharmony_ci } else if (!trimmed || / $/.test(trimmed)) { 5361cb0ef41Sopenharmony_ci // CommonMark requires space before trailing #s 5371cb0ef41Sopenharmony_ci text = trimmed.trim(); 5381cb0ef41Sopenharmony_ci } 5391cb0ef41Sopenharmony_ci } 5401cb0ef41Sopenharmony_ci 5411cb0ef41Sopenharmony_ci var token = { 5421cb0ef41Sopenharmony_ci type: 'heading', 5431cb0ef41Sopenharmony_ci raw: cap[0], 5441cb0ef41Sopenharmony_ci depth: cap[1].length, 5451cb0ef41Sopenharmony_ci text: text, 5461cb0ef41Sopenharmony_ci tokens: [] 5471cb0ef41Sopenharmony_ci }; 5481cb0ef41Sopenharmony_ci this.lexer.inline(token.text, token.tokens); 5491cb0ef41Sopenharmony_ci return token; 5501cb0ef41Sopenharmony_ci } 5511cb0ef41Sopenharmony_ci }; 5521cb0ef41Sopenharmony_ci 5531cb0ef41Sopenharmony_ci _proto.hr = function hr(src) { 5541cb0ef41Sopenharmony_ci var cap = this.rules.block.hr.exec(src); 5551cb0ef41Sopenharmony_ci 5561cb0ef41Sopenharmony_ci if (cap) { 5571cb0ef41Sopenharmony_ci return { 5581cb0ef41Sopenharmony_ci type: 'hr', 5591cb0ef41Sopenharmony_ci raw: cap[0] 5601cb0ef41Sopenharmony_ci }; 5611cb0ef41Sopenharmony_ci } 5621cb0ef41Sopenharmony_ci }; 5631cb0ef41Sopenharmony_ci 5641cb0ef41Sopenharmony_ci _proto.blockquote = function blockquote(src) { 5651cb0ef41Sopenharmony_ci var cap = this.rules.block.blockquote.exec(src); 5661cb0ef41Sopenharmony_ci 5671cb0ef41Sopenharmony_ci if (cap) { 5681cb0ef41Sopenharmony_ci var text = cap[0].replace(/^ *> ?/gm, ''); 5691cb0ef41Sopenharmony_ci return { 5701cb0ef41Sopenharmony_ci type: 'blockquote', 5711cb0ef41Sopenharmony_ci raw: cap[0], 5721cb0ef41Sopenharmony_ci tokens: this.lexer.blockTokens(text, []), 5731cb0ef41Sopenharmony_ci text: text 5741cb0ef41Sopenharmony_ci }; 5751cb0ef41Sopenharmony_ci } 5761cb0ef41Sopenharmony_ci }; 5771cb0ef41Sopenharmony_ci 5781cb0ef41Sopenharmony_ci _proto.list = function list(src) { 5791cb0ef41Sopenharmony_ci var cap = this.rules.block.list.exec(src); 5801cb0ef41Sopenharmony_ci 5811cb0ef41Sopenharmony_ci if (cap) { 5821cb0ef41Sopenharmony_ci var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, lines, itemContents; 5831cb0ef41Sopenharmony_ci var bull = cap[1].trim(); 5841cb0ef41Sopenharmony_ci var isordered = bull.length > 1; 5851cb0ef41Sopenharmony_ci var list = { 5861cb0ef41Sopenharmony_ci type: 'list', 5871cb0ef41Sopenharmony_ci raw: '', 5881cb0ef41Sopenharmony_ci ordered: isordered, 5891cb0ef41Sopenharmony_ci start: isordered ? +bull.slice(0, -1) : '', 5901cb0ef41Sopenharmony_ci loose: false, 5911cb0ef41Sopenharmony_ci items: [] 5921cb0ef41Sopenharmony_ci }; 5931cb0ef41Sopenharmony_ci bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull; 5941cb0ef41Sopenharmony_ci 5951cb0ef41Sopenharmony_ci if (this.options.pedantic) { 5961cb0ef41Sopenharmony_ci bull = isordered ? bull : '[*+-]'; 5971cb0ef41Sopenharmony_ci } // Get next list item 5981cb0ef41Sopenharmony_ci 5991cb0ef41Sopenharmony_ci 6001cb0ef41Sopenharmony_ci var itemRegex = new RegExp("^( {0,3}" + bull + ")((?: [^\\n]*| *)(?:\\n[^\\n]*)*(?:\\n|$))"); // Get each top-level item 6011cb0ef41Sopenharmony_ci 6021cb0ef41Sopenharmony_ci while (src) { 6031cb0ef41Sopenharmony_ci if (this.rules.block.hr.test(src)) { 6041cb0ef41Sopenharmony_ci // End list if we encounter an HR (possibly move into itemRegex?) 6051cb0ef41Sopenharmony_ci break; 6061cb0ef41Sopenharmony_ci } 6071cb0ef41Sopenharmony_ci 6081cb0ef41Sopenharmony_ci if (!(cap = itemRegex.exec(src))) { 6091cb0ef41Sopenharmony_ci break; 6101cb0ef41Sopenharmony_ci } 6111cb0ef41Sopenharmony_ci 6121cb0ef41Sopenharmony_ci lines = cap[2].split('\n'); 6131cb0ef41Sopenharmony_ci 6141cb0ef41Sopenharmony_ci if (this.options.pedantic) { 6151cb0ef41Sopenharmony_ci indent = 2; 6161cb0ef41Sopenharmony_ci itemContents = lines[0].trimLeft(); 6171cb0ef41Sopenharmony_ci } else { 6181cb0ef41Sopenharmony_ci indent = cap[2].search(/[^ ]/); // Find first non-space char 6191cb0ef41Sopenharmony_ci 6201cb0ef41Sopenharmony_ci indent = cap[1].length + (indent > 4 ? 1 : indent); // intented code blocks after 4 spaces; indent is always 1 6211cb0ef41Sopenharmony_ci 6221cb0ef41Sopenharmony_ci itemContents = lines[0].slice(indent - cap[1].length); 6231cb0ef41Sopenharmony_ci } 6241cb0ef41Sopenharmony_ci 6251cb0ef41Sopenharmony_ci blankLine = false; 6261cb0ef41Sopenharmony_ci raw = cap[0]; 6271cb0ef41Sopenharmony_ci 6281cb0ef41Sopenharmony_ci if (!lines[0] && /^ *$/.test(lines[1])) { 6291cb0ef41Sopenharmony_ci // items begin with at most one blank line 6301cb0ef41Sopenharmony_ci raw = cap[1] + lines.slice(0, 2).join('\n') + '\n'; 6311cb0ef41Sopenharmony_ci list.loose = true; 6321cb0ef41Sopenharmony_ci lines = []; 6331cb0ef41Sopenharmony_ci } 6341cb0ef41Sopenharmony_ci 6351cb0ef41Sopenharmony_ci var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])"); 6361cb0ef41Sopenharmony_ci 6371cb0ef41Sopenharmony_ci for (i = 1; i < lines.length; i++) { 6381cb0ef41Sopenharmony_ci line = lines[i]; 6391cb0ef41Sopenharmony_ci 6401cb0ef41Sopenharmony_ci if (this.options.pedantic) { 6411cb0ef41Sopenharmony_ci // Re-align to follow commonmark nesting rules 6421cb0ef41Sopenharmony_ci line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' '); 6431cb0ef41Sopenharmony_ci } // End list item if found start of new bullet 6441cb0ef41Sopenharmony_ci 6451cb0ef41Sopenharmony_ci 6461cb0ef41Sopenharmony_ci if (nextBulletRegex.test(line)) { 6471cb0ef41Sopenharmony_ci raw = cap[1] + lines.slice(0, i).join('\n') + '\n'; 6481cb0ef41Sopenharmony_ci break; 6491cb0ef41Sopenharmony_ci } // Until we encounter a blank line, item contents do not need indentation 6501cb0ef41Sopenharmony_ci 6511cb0ef41Sopenharmony_ci 6521cb0ef41Sopenharmony_ci if (!blankLine) { 6531cb0ef41Sopenharmony_ci if (!line.trim()) { 6541cb0ef41Sopenharmony_ci // Check if current line is empty 6551cb0ef41Sopenharmony_ci blankLine = true; 6561cb0ef41Sopenharmony_ci } // Dedent if possible 6571cb0ef41Sopenharmony_ci 6581cb0ef41Sopenharmony_ci 6591cb0ef41Sopenharmony_ci if (line.search(/[^ ]/) >= indent) { 6601cb0ef41Sopenharmony_ci itemContents += '\n' + line.slice(indent); 6611cb0ef41Sopenharmony_ci } else { 6621cb0ef41Sopenharmony_ci itemContents += '\n' + line; 6631cb0ef41Sopenharmony_ci } 6641cb0ef41Sopenharmony_ci 6651cb0ef41Sopenharmony_ci continue; 6661cb0ef41Sopenharmony_ci } // Dedent this line 6671cb0ef41Sopenharmony_ci 6681cb0ef41Sopenharmony_ci 6691cb0ef41Sopenharmony_ci if (line.search(/[^ ]/) >= indent || !line.trim()) { 6701cb0ef41Sopenharmony_ci itemContents += '\n' + line.slice(indent); 6711cb0ef41Sopenharmony_ci continue; 6721cb0ef41Sopenharmony_ci } else { 6731cb0ef41Sopenharmony_ci // Line was not properly indented; end of this item 6741cb0ef41Sopenharmony_ci raw = cap[1] + lines.slice(0, i).join('\n') + '\n'; 6751cb0ef41Sopenharmony_ci break; 6761cb0ef41Sopenharmony_ci } 6771cb0ef41Sopenharmony_ci } 6781cb0ef41Sopenharmony_ci 6791cb0ef41Sopenharmony_ci if (!list.loose) { 6801cb0ef41Sopenharmony_ci // If the previous item ended with a blank line, the list is loose 6811cb0ef41Sopenharmony_ci if (endsWithBlankLine) { 6821cb0ef41Sopenharmony_ci list.loose = true; 6831cb0ef41Sopenharmony_ci } else if (/\n *\n *$/.test(raw)) { 6841cb0ef41Sopenharmony_ci endsWithBlankLine = true; 6851cb0ef41Sopenharmony_ci } 6861cb0ef41Sopenharmony_ci } // Check for task list items 6871cb0ef41Sopenharmony_ci 6881cb0ef41Sopenharmony_ci 6891cb0ef41Sopenharmony_ci if (this.options.gfm) { 6901cb0ef41Sopenharmony_ci istask = /^\[[ xX]\] /.exec(itemContents); 6911cb0ef41Sopenharmony_ci 6921cb0ef41Sopenharmony_ci if (istask) { 6931cb0ef41Sopenharmony_ci ischecked = istask[0] !== '[ ] '; 6941cb0ef41Sopenharmony_ci itemContents = itemContents.replace(/^\[[ xX]\] +/, ''); 6951cb0ef41Sopenharmony_ci } 6961cb0ef41Sopenharmony_ci } 6971cb0ef41Sopenharmony_ci 6981cb0ef41Sopenharmony_ci list.items.push({ 6991cb0ef41Sopenharmony_ci type: 'list_item', 7001cb0ef41Sopenharmony_ci raw: raw, 7011cb0ef41Sopenharmony_ci task: !!istask, 7021cb0ef41Sopenharmony_ci checked: ischecked, 7031cb0ef41Sopenharmony_ci loose: false, 7041cb0ef41Sopenharmony_ci text: itemContents 7051cb0ef41Sopenharmony_ci }); 7061cb0ef41Sopenharmony_ci list.raw += raw; 7071cb0ef41Sopenharmony_ci src = src.slice(raw.length); 7081cb0ef41Sopenharmony_ci } // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic 7091cb0ef41Sopenharmony_ci 7101cb0ef41Sopenharmony_ci 7111cb0ef41Sopenharmony_ci list.items[list.items.length - 1].raw = raw.trimRight(); 7121cb0ef41Sopenharmony_ci list.items[list.items.length - 1].text = itemContents.trimRight(); 7131cb0ef41Sopenharmony_ci list.raw = list.raw.trimRight(); 7141cb0ef41Sopenharmony_ci var l = list.items.length; // Item child tokens handled here at end because we needed to have the final item to trim it first 7151cb0ef41Sopenharmony_ci 7161cb0ef41Sopenharmony_ci for (i = 0; i < l; i++) { 7171cb0ef41Sopenharmony_ci this.lexer.state.top = false; 7181cb0ef41Sopenharmony_ci list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []); 7191cb0ef41Sopenharmony_ci 7201cb0ef41Sopenharmony_ci if (list.items[i].tokens.some(function (t) { 7211cb0ef41Sopenharmony_ci return t.type === 'space'; 7221cb0ef41Sopenharmony_ci })) { 7231cb0ef41Sopenharmony_ci list.loose = true; 7241cb0ef41Sopenharmony_ci list.items[i].loose = true; 7251cb0ef41Sopenharmony_ci } 7261cb0ef41Sopenharmony_ci } 7271cb0ef41Sopenharmony_ci 7281cb0ef41Sopenharmony_ci return list; 7291cb0ef41Sopenharmony_ci } 7301cb0ef41Sopenharmony_ci }; 7311cb0ef41Sopenharmony_ci 7321cb0ef41Sopenharmony_ci _proto.html = function html(src) { 7331cb0ef41Sopenharmony_ci var cap = this.rules.block.html.exec(src); 7341cb0ef41Sopenharmony_ci 7351cb0ef41Sopenharmony_ci if (cap) { 7361cb0ef41Sopenharmony_ci var token = { 7371cb0ef41Sopenharmony_ci type: 'html', 7381cb0ef41Sopenharmony_ci raw: cap[0], 7391cb0ef41Sopenharmony_ci pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), 7401cb0ef41Sopenharmony_ci text: cap[0] 7411cb0ef41Sopenharmony_ci }; 7421cb0ef41Sopenharmony_ci 7431cb0ef41Sopenharmony_ci if (this.options.sanitize) { 7441cb0ef41Sopenharmony_ci token.type = 'paragraph'; 7451cb0ef41Sopenharmony_ci token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]); 7461cb0ef41Sopenharmony_ci token.tokens = []; 7471cb0ef41Sopenharmony_ci this.lexer.inline(token.text, token.tokens); 7481cb0ef41Sopenharmony_ci } 7491cb0ef41Sopenharmony_ci 7501cb0ef41Sopenharmony_ci return token; 7511cb0ef41Sopenharmony_ci } 7521cb0ef41Sopenharmony_ci }; 7531cb0ef41Sopenharmony_ci 7541cb0ef41Sopenharmony_ci _proto.def = function def(src) { 7551cb0ef41Sopenharmony_ci var cap = this.rules.block.def.exec(src); 7561cb0ef41Sopenharmony_ci 7571cb0ef41Sopenharmony_ci if (cap) { 7581cb0ef41Sopenharmony_ci if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1); 7591cb0ef41Sopenharmony_ci var tag = cap[1].toLowerCase().replace(/\s+/g, ' '); 7601cb0ef41Sopenharmony_ci return { 7611cb0ef41Sopenharmony_ci type: 'def', 7621cb0ef41Sopenharmony_ci tag: tag, 7631cb0ef41Sopenharmony_ci raw: cap[0], 7641cb0ef41Sopenharmony_ci href: cap[2], 7651cb0ef41Sopenharmony_ci title: cap[3] 7661cb0ef41Sopenharmony_ci }; 7671cb0ef41Sopenharmony_ci } 7681cb0ef41Sopenharmony_ci }; 7691cb0ef41Sopenharmony_ci 7701cb0ef41Sopenharmony_ci _proto.table = function table(src) { 7711cb0ef41Sopenharmony_ci var cap = this.rules.block.table.exec(src); 7721cb0ef41Sopenharmony_ci 7731cb0ef41Sopenharmony_ci if (cap) { 7741cb0ef41Sopenharmony_ci var item = { 7751cb0ef41Sopenharmony_ci type: 'table', 7761cb0ef41Sopenharmony_ci header: splitCells(cap[1]).map(function (c) { 7771cb0ef41Sopenharmony_ci return { 7781cb0ef41Sopenharmony_ci text: c 7791cb0ef41Sopenharmony_ci }; 7801cb0ef41Sopenharmony_ci }), 7811cb0ef41Sopenharmony_ci align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), 7821cb0ef41Sopenharmony_ci rows: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [] 7831cb0ef41Sopenharmony_ci }; 7841cb0ef41Sopenharmony_ci 7851cb0ef41Sopenharmony_ci if (item.header.length === item.align.length) { 7861cb0ef41Sopenharmony_ci item.raw = cap[0]; 7871cb0ef41Sopenharmony_ci var l = item.align.length; 7881cb0ef41Sopenharmony_ci var i, j, k, row; 7891cb0ef41Sopenharmony_ci 7901cb0ef41Sopenharmony_ci for (i = 0; i < l; i++) { 7911cb0ef41Sopenharmony_ci if (/^ *-+: *$/.test(item.align[i])) { 7921cb0ef41Sopenharmony_ci item.align[i] = 'right'; 7931cb0ef41Sopenharmony_ci } else if (/^ *:-+: *$/.test(item.align[i])) { 7941cb0ef41Sopenharmony_ci item.align[i] = 'center'; 7951cb0ef41Sopenharmony_ci } else if (/^ *:-+ *$/.test(item.align[i])) { 7961cb0ef41Sopenharmony_ci item.align[i] = 'left'; 7971cb0ef41Sopenharmony_ci } else { 7981cb0ef41Sopenharmony_ci item.align[i] = null; 7991cb0ef41Sopenharmony_ci } 8001cb0ef41Sopenharmony_ci } 8011cb0ef41Sopenharmony_ci 8021cb0ef41Sopenharmony_ci l = item.rows.length; 8031cb0ef41Sopenharmony_ci 8041cb0ef41Sopenharmony_ci for (i = 0; i < l; i++) { 8051cb0ef41Sopenharmony_ci item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) { 8061cb0ef41Sopenharmony_ci return { 8071cb0ef41Sopenharmony_ci text: c 8081cb0ef41Sopenharmony_ci }; 8091cb0ef41Sopenharmony_ci }); 8101cb0ef41Sopenharmony_ci } // parse child tokens inside headers and cells 8111cb0ef41Sopenharmony_ci // header child tokens 8121cb0ef41Sopenharmony_ci 8131cb0ef41Sopenharmony_ci 8141cb0ef41Sopenharmony_ci l = item.header.length; 8151cb0ef41Sopenharmony_ci 8161cb0ef41Sopenharmony_ci for (j = 0; j < l; j++) { 8171cb0ef41Sopenharmony_ci item.header[j].tokens = []; 8181cb0ef41Sopenharmony_ci this.lexer.inlineTokens(item.header[j].text, item.header[j].tokens); 8191cb0ef41Sopenharmony_ci } // cell child tokens 8201cb0ef41Sopenharmony_ci 8211cb0ef41Sopenharmony_ci 8221cb0ef41Sopenharmony_ci l = item.rows.length; 8231cb0ef41Sopenharmony_ci 8241cb0ef41Sopenharmony_ci for (j = 0; j < l; j++) { 8251cb0ef41Sopenharmony_ci row = item.rows[j]; 8261cb0ef41Sopenharmony_ci 8271cb0ef41Sopenharmony_ci for (k = 0; k < row.length; k++) { 8281cb0ef41Sopenharmony_ci row[k].tokens = []; 8291cb0ef41Sopenharmony_ci this.lexer.inlineTokens(row[k].text, row[k].tokens); 8301cb0ef41Sopenharmony_ci } 8311cb0ef41Sopenharmony_ci } 8321cb0ef41Sopenharmony_ci 8331cb0ef41Sopenharmony_ci return item; 8341cb0ef41Sopenharmony_ci } 8351cb0ef41Sopenharmony_ci } 8361cb0ef41Sopenharmony_ci }; 8371cb0ef41Sopenharmony_ci 8381cb0ef41Sopenharmony_ci _proto.lheading = function lheading(src) { 8391cb0ef41Sopenharmony_ci var cap = this.rules.block.lheading.exec(src); 8401cb0ef41Sopenharmony_ci 8411cb0ef41Sopenharmony_ci if (cap) { 8421cb0ef41Sopenharmony_ci var token = { 8431cb0ef41Sopenharmony_ci type: 'heading', 8441cb0ef41Sopenharmony_ci raw: cap[0], 8451cb0ef41Sopenharmony_ci depth: cap[2].charAt(0) === '=' ? 1 : 2, 8461cb0ef41Sopenharmony_ci text: cap[1], 8471cb0ef41Sopenharmony_ci tokens: [] 8481cb0ef41Sopenharmony_ci }; 8491cb0ef41Sopenharmony_ci this.lexer.inline(token.text, token.tokens); 8501cb0ef41Sopenharmony_ci return token; 8511cb0ef41Sopenharmony_ci } 8521cb0ef41Sopenharmony_ci }; 8531cb0ef41Sopenharmony_ci 8541cb0ef41Sopenharmony_ci _proto.paragraph = function paragraph(src) { 8551cb0ef41Sopenharmony_ci var cap = this.rules.block.paragraph.exec(src); 8561cb0ef41Sopenharmony_ci 8571cb0ef41Sopenharmony_ci if (cap) { 8581cb0ef41Sopenharmony_ci var token = { 8591cb0ef41Sopenharmony_ci type: 'paragraph', 8601cb0ef41Sopenharmony_ci raw: cap[0], 8611cb0ef41Sopenharmony_ci text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1], 8621cb0ef41Sopenharmony_ci tokens: [] 8631cb0ef41Sopenharmony_ci }; 8641cb0ef41Sopenharmony_ci this.lexer.inline(token.text, token.tokens); 8651cb0ef41Sopenharmony_ci return token; 8661cb0ef41Sopenharmony_ci } 8671cb0ef41Sopenharmony_ci }; 8681cb0ef41Sopenharmony_ci 8691cb0ef41Sopenharmony_ci _proto.text = function text(src) { 8701cb0ef41Sopenharmony_ci var cap = this.rules.block.text.exec(src); 8711cb0ef41Sopenharmony_ci 8721cb0ef41Sopenharmony_ci if (cap) { 8731cb0ef41Sopenharmony_ci var token = { 8741cb0ef41Sopenharmony_ci type: 'text', 8751cb0ef41Sopenharmony_ci raw: cap[0], 8761cb0ef41Sopenharmony_ci text: cap[0], 8771cb0ef41Sopenharmony_ci tokens: [] 8781cb0ef41Sopenharmony_ci }; 8791cb0ef41Sopenharmony_ci this.lexer.inline(token.text, token.tokens); 8801cb0ef41Sopenharmony_ci return token; 8811cb0ef41Sopenharmony_ci } 8821cb0ef41Sopenharmony_ci }; 8831cb0ef41Sopenharmony_ci 8841cb0ef41Sopenharmony_ci _proto.escape = function escape(src) { 8851cb0ef41Sopenharmony_ci var cap = this.rules.inline.escape.exec(src); 8861cb0ef41Sopenharmony_ci 8871cb0ef41Sopenharmony_ci if (cap) { 8881cb0ef41Sopenharmony_ci return { 8891cb0ef41Sopenharmony_ci type: 'escape', 8901cb0ef41Sopenharmony_ci raw: cap[0], 8911cb0ef41Sopenharmony_ci text: _escape(cap[1]) 8921cb0ef41Sopenharmony_ci }; 8931cb0ef41Sopenharmony_ci } 8941cb0ef41Sopenharmony_ci }; 8951cb0ef41Sopenharmony_ci 8961cb0ef41Sopenharmony_ci _proto.tag = function tag(src) { 8971cb0ef41Sopenharmony_ci var cap = this.rules.inline.tag.exec(src); 8981cb0ef41Sopenharmony_ci 8991cb0ef41Sopenharmony_ci if (cap) { 9001cb0ef41Sopenharmony_ci if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) { 9011cb0ef41Sopenharmony_ci this.lexer.state.inLink = true; 9021cb0ef41Sopenharmony_ci } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) { 9031cb0ef41Sopenharmony_ci this.lexer.state.inLink = false; 9041cb0ef41Sopenharmony_ci } 9051cb0ef41Sopenharmony_ci 9061cb0ef41Sopenharmony_ci if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { 9071cb0ef41Sopenharmony_ci this.lexer.state.inRawBlock = true; 9081cb0ef41Sopenharmony_ci } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { 9091cb0ef41Sopenharmony_ci this.lexer.state.inRawBlock = false; 9101cb0ef41Sopenharmony_ci } 9111cb0ef41Sopenharmony_ci 9121cb0ef41Sopenharmony_ci return { 9131cb0ef41Sopenharmony_ci type: this.options.sanitize ? 'text' : 'html', 9141cb0ef41Sopenharmony_ci raw: cap[0], 9151cb0ef41Sopenharmony_ci inLink: this.lexer.state.inLink, 9161cb0ef41Sopenharmony_ci inRawBlock: this.lexer.state.inRawBlock, 9171cb0ef41Sopenharmony_ci text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0] 9181cb0ef41Sopenharmony_ci }; 9191cb0ef41Sopenharmony_ci } 9201cb0ef41Sopenharmony_ci }; 9211cb0ef41Sopenharmony_ci 9221cb0ef41Sopenharmony_ci _proto.link = function link(src) { 9231cb0ef41Sopenharmony_ci var cap = this.rules.inline.link.exec(src); 9241cb0ef41Sopenharmony_ci 9251cb0ef41Sopenharmony_ci if (cap) { 9261cb0ef41Sopenharmony_ci var trimmedUrl = cap[2].trim(); 9271cb0ef41Sopenharmony_ci 9281cb0ef41Sopenharmony_ci if (!this.options.pedantic && /^</.test(trimmedUrl)) { 9291cb0ef41Sopenharmony_ci // commonmark requires matching angle brackets 9301cb0ef41Sopenharmony_ci if (!/>$/.test(trimmedUrl)) { 9311cb0ef41Sopenharmony_ci return; 9321cb0ef41Sopenharmony_ci } // ending angle bracket cannot be escaped 9331cb0ef41Sopenharmony_ci 9341cb0ef41Sopenharmony_ci 9351cb0ef41Sopenharmony_ci var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\'); 9361cb0ef41Sopenharmony_ci 9371cb0ef41Sopenharmony_ci if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) { 9381cb0ef41Sopenharmony_ci return; 9391cb0ef41Sopenharmony_ci } 9401cb0ef41Sopenharmony_ci } else { 9411cb0ef41Sopenharmony_ci // find closing parenthesis 9421cb0ef41Sopenharmony_ci var lastParenIndex = findClosingBracket(cap[2], '()'); 9431cb0ef41Sopenharmony_ci 9441cb0ef41Sopenharmony_ci if (lastParenIndex > -1) { 9451cb0ef41Sopenharmony_ci var start = cap[0].indexOf('!') === 0 ? 5 : 4; 9461cb0ef41Sopenharmony_ci var linkLen = start + cap[1].length + lastParenIndex; 9471cb0ef41Sopenharmony_ci cap[2] = cap[2].substring(0, lastParenIndex); 9481cb0ef41Sopenharmony_ci cap[0] = cap[0].substring(0, linkLen).trim(); 9491cb0ef41Sopenharmony_ci cap[3] = ''; 9501cb0ef41Sopenharmony_ci } 9511cb0ef41Sopenharmony_ci } 9521cb0ef41Sopenharmony_ci 9531cb0ef41Sopenharmony_ci var href = cap[2]; 9541cb0ef41Sopenharmony_ci var title = ''; 9551cb0ef41Sopenharmony_ci 9561cb0ef41Sopenharmony_ci if (this.options.pedantic) { 9571cb0ef41Sopenharmony_ci // split pedantic href and title 9581cb0ef41Sopenharmony_ci var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); 9591cb0ef41Sopenharmony_ci 9601cb0ef41Sopenharmony_ci if (link) { 9611cb0ef41Sopenharmony_ci href = link[1]; 9621cb0ef41Sopenharmony_ci title = link[3]; 9631cb0ef41Sopenharmony_ci } 9641cb0ef41Sopenharmony_ci } else { 9651cb0ef41Sopenharmony_ci title = cap[3] ? cap[3].slice(1, -1) : ''; 9661cb0ef41Sopenharmony_ci } 9671cb0ef41Sopenharmony_ci 9681cb0ef41Sopenharmony_ci href = href.trim(); 9691cb0ef41Sopenharmony_ci 9701cb0ef41Sopenharmony_ci if (/^</.test(href)) { 9711cb0ef41Sopenharmony_ci if (this.options.pedantic && !/>$/.test(trimmedUrl)) { 9721cb0ef41Sopenharmony_ci // pedantic allows starting angle bracket without ending angle bracket 9731cb0ef41Sopenharmony_ci href = href.slice(1); 9741cb0ef41Sopenharmony_ci } else { 9751cb0ef41Sopenharmony_ci href = href.slice(1, -1); 9761cb0ef41Sopenharmony_ci } 9771cb0ef41Sopenharmony_ci } 9781cb0ef41Sopenharmony_ci 9791cb0ef41Sopenharmony_ci return outputLink(cap, { 9801cb0ef41Sopenharmony_ci href: href ? href.replace(this.rules.inline._escapes, '$1') : href, 9811cb0ef41Sopenharmony_ci title: title ? title.replace(this.rules.inline._escapes, '$1') : title 9821cb0ef41Sopenharmony_ci }, cap[0], this.lexer); 9831cb0ef41Sopenharmony_ci } 9841cb0ef41Sopenharmony_ci }; 9851cb0ef41Sopenharmony_ci 9861cb0ef41Sopenharmony_ci _proto.reflink = function reflink(src, links) { 9871cb0ef41Sopenharmony_ci var cap; 9881cb0ef41Sopenharmony_ci 9891cb0ef41Sopenharmony_ci if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) { 9901cb0ef41Sopenharmony_ci var link = (cap[2] || cap[1]).replace(/\s+/g, ' '); 9911cb0ef41Sopenharmony_ci link = links[link.toLowerCase()]; 9921cb0ef41Sopenharmony_ci 9931cb0ef41Sopenharmony_ci if (!link || !link.href) { 9941cb0ef41Sopenharmony_ci var text = cap[0].charAt(0); 9951cb0ef41Sopenharmony_ci return { 9961cb0ef41Sopenharmony_ci type: 'text', 9971cb0ef41Sopenharmony_ci raw: text, 9981cb0ef41Sopenharmony_ci text: text 9991cb0ef41Sopenharmony_ci }; 10001cb0ef41Sopenharmony_ci } 10011cb0ef41Sopenharmony_ci 10021cb0ef41Sopenharmony_ci return outputLink(cap, link, cap[0], this.lexer); 10031cb0ef41Sopenharmony_ci } 10041cb0ef41Sopenharmony_ci }; 10051cb0ef41Sopenharmony_ci 10061cb0ef41Sopenharmony_ci _proto.emStrong = function emStrong(src, maskedSrc, prevChar) { 10071cb0ef41Sopenharmony_ci if (prevChar === void 0) { 10081cb0ef41Sopenharmony_ci prevChar = ''; 10091cb0ef41Sopenharmony_ci } 10101cb0ef41Sopenharmony_ci 10111cb0ef41Sopenharmony_ci var match = this.rules.inline.emStrong.lDelim.exec(src); 10121cb0ef41Sopenharmony_ci if (!match) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well 10131cb0ef41Sopenharmony_ci 10141cb0ef41Sopenharmony_ci if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return; 10151cb0ef41Sopenharmony_ci var nextChar = match[1] || match[2] || ''; 10161cb0ef41Sopenharmony_ci 10171cb0ef41Sopenharmony_ci if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) { 10181cb0ef41Sopenharmony_ci var lLength = match[0].length - 1; 10191cb0ef41Sopenharmony_ci var rDelim, 10201cb0ef41Sopenharmony_ci rLength, 10211cb0ef41Sopenharmony_ci delimTotal = lLength, 10221cb0ef41Sopenharmony_ci midDelimTotal = 0; 10231cb0ef41Sopenharmony_ci var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd; 10241cb0ef41Sopenharmony_ci endReg.lastIndex = 0; // Clip maskedSrc to same section of string as src (move to lexer?) 10251cb0ef41Sopenharmony_ci 10261cb0ef41Sopenharmony_ci maskedSrc = maskedSrc.slice(-1 * src.length + lLength); 10271cb0ef41Sopenharmony_ci 10281cb0ef41Sopenharmony_ci while ((match = endReg.exec(maskedSrc)) != null) { 10291cb0ef41Sopenharmony_ci rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6]; 10301cb0ef41Sopenharmony_ci if (!rDelim) continue; // skip single * in __abc*abc__ 10311cb0ef41Sopenharmony_ci 10321cb0ef41Sopenharmony_ci rLength = rDelim.length; 10331cb0ef41Sopenharmony_ci 10341cb0ef41Sopenharmony_ci if (match[3] || match[4]) { 10351cb0ef41Sopenharmony_ci // found another Left Delim 10361cb0ef41Sopenharmony_ci delimTotal += rLength; 10371cb0ef41Sopenharmony_ci continue; 10381cb0ef41Sopenharmony_ci } else if (match[5] || match[6]) { 10391cb0ef41Sopenharmony_ci // either Left or Right Delim 10401cb0ef41Sopenharmony_ci if (lLength % 3 && !((lLength + rLength) % 3)) { 10411cb0ef41Sopenharmony_ci midDelimTotal += rLength; 10421cb0ef41Sopenharmony_ci continue; // CommonMark Emphasis Rules 9-10 10431cb0ef41Sopenharmony_ci } 10441cb0ef41Sopenharmony_ci } 10451cb0ef41Sopenharmony_ci 10461cb0ef41Sopenharmony_ci delimTotal -= rLength; 10471cb0ef41Sopenharmony_ci if (delimTotal > 0) continue; // Haven't found enough closing delimiters 10481cb0ef41Sopenharmony_ci // Remove extra characters. *a*** -> *a* 10491cb0ef41Sopenharmony_ci 10501cb0ef41Sopenharmony_ci rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); // Create `em` if smallest delimiter has odd char count. *a*** 10511cb0ef41Sopenharmony_ci 10521cb0ef41Sopenharmony_ci if (Math.min(lLength, rLength) % 2) { 10531cb0ef41Sopenharmony_ci var _text = src.slice(1, lLength + match.index + rLength); 10541cb0ef41Sopenharmony_ci 10551cb0ef41Sopenharmony_ci return { 10561cb0ef41Sopenharmony_ci type: 'em', 10571cb0ef41Sopenharmony_ci raw: src.slice(0, lLength + match.index + rLength + 1), 10581cb0ef41Sopenharmony_ci text: _text, 10591cb0ef41Sopenharmony_ci tokens: this.lexer.inlineTokens(_text, []) 10601cb0ef41Sopenharmony_ci }; 10611cb0ef41Sopenharmony_ci } // Create 'strong' if smallest delimiter has even char count. **a*** 10621cb0ef41Sopenharmony_ci 10631cb0ef41Sopenharmony_ci 10641cb0ef41Sopenharmony_ci var text = src.slice(2, lLength + match.index + rLength - 1); 10651cb0ef41Sopenharmony_ci return { 10661cb0ef41Sopenharmony_ci type: 'strong', 10671cb0ef41Sopenharmony_ci raw: src.slice(0, lLength + match.index + rLength + 1), 10681cb0ef41Sopenharmony_ci text: text, 10691cb0ef41Sopenharmony_ci tokens: this.lexer.inlineTokens(text, []) 10701cb0ef41Sopenharmony_ci }; 10711cb0ef41Sopenharmony_ci } 10721cb0ef41Sopenharmony_ci } 10731cb0ef41Sopenharmony_ci }; 10741cb0ef41Sopenharmony_ci 10751cb0ef41Sopenharmony_ci _proto.codespan = function codespan(src) { 10761cb0ef41Sopenharmony_ci var cap = this.rules.inline.code.exec(src); 10771cb0ef41Sopenharmony_ci 10781cb0ef41Sopenharmony_ci if (cap) { 10791cb0ef41Sopenharmony_ci var text = cap[2].replace(/\n/g, ' '); 10801cb0ef41Sopenharmony_ci var hasNonSpaceChars = /[^ ]/.test(text); 10811cb0ef41Sopenharmony_ci var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text); 10821cb0ef41Sopenharmony_ci 10831cb0ef41Sopenharmony_ci if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) { 10841cb0ef41Sopenharmony_ci text = text.substring(1, text.length - 1); 10851cb0ef41Sopenharmony_ci } 10861cb0ef41Sopenharmony_ci 10871cb0ef41Sopenharmony_ci text = _escape(text, true); 10881cb0ef41Sopenharmony_ci return { 10891cb0ef41Sopenharmony_ci type: 'codespan', 10901cb0ef41Sopenharmony_ci raw: cap[0], 10911cb0ef41Sopenharmony_ci text: text 10921cb0ef41Sopenharmony_ci }; 10931cb0ef41Sopenharmony_ci } 10941cb0ef41Sopenharmony_ci }; 10951cb0ef41Sopenharmony_ci 10961cb0ef41Sopenharmony_ci _proto.br = function br(src) { 10971cb0ef41Sopenharmony_ci var cap = this.rules.inline.br.exec(src); 10981cb0ef41Sopenharmony_ci 10991cb0ef41Sopenharmony_ci if (cap) { 11001cb0ef41Sopenharmony_ci return { 11011cb0ef41Sopenharmony_ci type: 'br', 11021cb0ef41Sopenharmony_ci raw: cap[0] 11031cb0ef41Sopenharmony_ci }; 11041cb0ef41Sopenharmony_ci } 11051cb0ef41Sopenharmony_ci }; 11061cb0ef41Sopenharmony_ci 11071cb0ef41Sopenharmony_ci _proto.del = function del(src) { 11081cb0ef41Sopenharmony_ci var cap = this.rules.inline.del.exec(src); 11091cb0ef41Sopenharmony_ci 11101cb0ef41Sopenharmony_ci if (cap) { 11111cb0ef41Sopenharmony_ci return { 11121cb0ef41Sopenharmony_ci type: 'del', 11131cb0ef41Sopenharmony_ci raw: cap[0], 11141cb0ef41Sopenharmony_ci text: cap[2], 11151cb0ef41Sopenharmony_ci tokens: this.lexer.inlineTokens(cap[2], []) 11161cb0ef41Sopenharmony_ci }; 11171cb0ef41Sopenharmony_ci } 11181cb0ef41Sopenharmony_ci }; 11191cb0ef41Sopenharmony_ci 11201cb0ef41Sopenharmony_ci _proto.autolink = function autolink(src, mangle) { 11211cb0ef41Sopenharmony_ci var cap = this.rules.inline.autolink.exec(src); 11221cb0ef41Sopenharmony_ci 11231cb0ef41Sopenharmony_ci if (cap) { 11241cb0ef41Sopenharmony_ci var text, href; 11251cb0ef41Sopenharmony_ci 11261cb0ef41Sopenharmony_ci if (cap[2] === '@') { 11271cb0ef41Sopenharmony_ci text = _escape(this.options.mangle ? mangle(cap[1]) : cap[1]); 11281cb0ef41Sopenharmony_ci href = 'mailto:' + text; 11291cb0ef41Sopenharmony_ci } else { 11301cb0ef41Sopenharmony_ci text = _escape(cap[1]); 11311cb0ef41Sopenharmony_ci href = text; 11321cb0ef41Sopenharmony_ci } 11331cb0ef41Sopenharmony_ci 11341cb0ef41Sopenharmony_ci return { 11351cb0ef41Sopenharmony_ci type: 'link', 11361cb0ef41Sopenharmony_ci raw: cap[0], 11371cb0ef41Sopenharmony_ci text: text, 11381cb0ef41Sopenharmony_ci href: href, 11391cb0ef41Sopenharmony_ci tokens: [{ 11401cb0ef41Sopenharmony_ci type: 'text', 11411cb0ef41Sopenharmony_ci raw: text, 11421cb0ef41Sopenharmony_ci text: text 11431cb0ef41Sopenharmony_ci }] 11441cb0ef41Sopenharmony_ci }; 11451cb0ef41Sopenharmony_ci } 11461cb0ef41Sopenharmony_ci }; 11471cb0ef41Sopenharmony_ci 11481cb0ef41Sopenharmony_ci _proto.url = function url(src, mangle) { 11491cb0ef41Sopenharmony_ci var cap; 11501cb0ef41Sopenharmony_ci 11511cb0ef41Sopenharmony_ci if (cap = this.rules.inline.url.exec(src)) { 11521cb0ef41Sopenharmony_ci var text, href; 11531cb0ef41Sopenharmony_ci 11541cb0ef41Sopenharmony_ci if (cap[2] === '@') { 11551cb0ef41Sopenharmony_ci text = _escape(this.options.mangle ? mangle(cap[0]) : cap[0]); 11561cb0ef41Sopenharmony_ci href = 'mailto:' + text; 11571cb0ef41Sopenharmony_ci } else { 11581cb0ef41Sopenharmony_ci // do extended autolink path validation 11591cb0ef41Sopenharmony_ci var prevCapZero; 11601cb0ef41Sopenharmony_ci 11611cb0ef41Sopenharmony_ci do { 11621cb0ef41Sopenharmony_ci prevCapZero = cap[0]; 11631cb0ef41Sopenharmony_ci cap[0] = this.rules.inline._backpedal.exec(cap[0])[0]; 11641cb0ef41Sopenharmony_ci } while (prevCapZero !== cap[0]); 11651cb0ef41Sopenharmony_ci 11661cb0ef41Sopenharmony_ci text = _escape(cap[0]); 11671cb0ef41Sopenharmony_ci 11681cb0ef41Sopenharmony_ci if (cap[1] === 'www.') { 11691cb0ef41Sopenharmony_ci href = 'http://' + text; 11701cb0ef41Sopenharmony_ci } else { 11711cb0ef41Sopenharmony_ci href = text; 11721cb0ef41Sopenharmony_ci } 11731cb0ef41Sopenharmony_ci } 11741cb0ef41Sopenharmony_ci 11751cb0ef41Sopenharmony_ci return { 11761cb0ef41Sopenharmony_ci type: 'link', 11771cb0ef41Sopenharmony_ci raw: cap[0], 11781cb0ef41Sopenharmony_ci text: text, 11791cb0ef41Sopenharmony_ci href: href, 11801cb0ef41Sopenharmony_ci tokens: [{ 11811cb0ef41Sopenharmony_ci type: 'text', 11821cb0ef41Sopenharmony_ci raw: text, 11831cb0ef41Sopenharmony_ci text: text 11841cb0ef41Sopenharmony_ci }] 11851cb0ef41Sopenharmony_ci }; 11861cb0ef41Sopenharmony_ci } 11871cb0ef41Sopenharmony_ci }; 11881cb0ef41Sopenharmony_ci 11891cb0ef41Sopenharmony_ci _proto.inlineText = function inlineText(src, smartypants) { 11901cb0ef41Sopenharmony_ci var cap = this.rules.inline.text.exec(src); 11911cb0ef41Sopenharmony_ci 11921cb0ef41Sopenharmony_ci if (cap) { 11931cb0ef41Sopenharmony_ci var text; 11941cb0ef41Sopenharmony_ci 11951cb0ef41Sopenharmony_ci if (this.lexer.state.inRawBlock) { 11961cb0ef41Sopenharmony_ci text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]; 11971cb0ef41Sopenharmony_ci } else { 11981cb0ef41Sopenharmony_ci text = _escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]); 11991cb0ef41Sopenharmony_ci } 12001cb0ef41Sopenharmony_ci 12011cb0ef41Sopenharmony_ci return { 12021cb0ef41Sopenharmony_ci type: 'text', 12031cb0ef41Sopenharmony_ci raw: cap[0], 12041cb0ef41Sopenharmony_ci text: text 12051cb0ef41Sopenharmony_ci }; 12061cb0ef41Sopenharmony_ci } 12071cb0ef41Sopenharmony_ci }; 12081cb0ef41Sopenharmony_ci 12091cb0ef41Sopenharmony_ci return Tokenizer; 12101cb0ef41Sopenharmony_ci }(); 12111cb0ef41Sopenharmony_ci 12121cb0ef41Sopenharmony_ci var noopTest = helpers.noopTest, 12131cb0ef41Sopenharmony_ci edit = helpers.edit, 12141cb0ef41Sopenharmony_ci merge$1 = helpers.merge; 12151cb0ef41Sopenharmony_ci /** 12161cb0ef41Sopenharmony_ci * Block-Level Grammar 12171cb0ef41Sopenharmony_ci */ 12181cb0ef41Sopenharmony_ci 12191cb0ef41Sopenharmony_ci var block$1 = { 12201cb0ef41Sopenharmony_ci newline: /^(?: *(?:\n|$))+/, 12211cb0ef41Sopenharmony_ci code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, 12221cb0ef41Sopenharmony_ci fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/, 12231cb0ef41Sopenharmony_ci hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, 12241cb0ef41Sopenharmony_ci heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, 12251cb0ef41Sopenharmony_ci blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, 12261cb0ef41Sopenharmony_ci list: /^( {0,3}bull)( [^\n]+?)?(?:\n|$)/, 12271cb0ef41Sopenharmony_ci html: '^ {0,3}(?:' // optional indentation 12281cb0ef41Sopenharmony_ci + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1) 12291cb0ef41Sopenharmony_ci + '|comment[^\\n]*(\\n+|$)' // (2) 12301cb0ef41Sopenharmony_ci + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3) 12311cb0ef41Sopenharmony_ci + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4) 12321cb0ef41Sopenharmony_ci + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5) 12331cb0ef41Sopenharmony_ci + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6) 12341cb0ef41Sopenharmony_ci + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag 12351cb0ef41Sopenharmony_ci + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag 12361cb0ef41Sopenharmony_ci + ')', 12371cb0ef41Sopenharmony_ci def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, 12381cb0ef41Sopenharmony_ci table: noopTest, 12391cb0ef41Sopenharmony_ci lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/, 12401cb0ef41Sopenharmony_ci // regex template, placeholders will be replaced according to different paragraph 12411cb0ef41Sopenharmony_ci // interruption rules of commonmark and the original markdown spec: 12421cb0ef41Sopenharmony_ci _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/, 12431cb0ef41Sopenharmony_ci text: /^[^\n]+/ 12441cb0ef41Sopenharmony_ci }; 12451cb0ef41Sopenharmony_ci block$1._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/; 12461cb0ef41Sopenharmony_ci block$1._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; 12471cb0ef41Sopenharmony_ci block$1.def = edit(block$1.def).replace('label', block$1._label).replace('title', block$1._title).getRegex(); 12481cb0ef41Sopenharmony_ci block$1.bullet = /(?:[*+-]|\d{1,9}[.)])/; 12491cb0ef41Sopenharmony_ci block$1.listItemStart = edit(/^( *)(bull) */).replace('bull', block$1.bullet).getRegex(); 12501cb0ef41Sopenharmony_ci block$1.list = edit(block$1.list).replace(/bull/g, block$1.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block$1.def.source + ')').getRegex(); 12511cb0ef41Sopenharmony_ci block$1._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul'; 12521cb0ef41Sopenharmony_ci block$1._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/; 12531cb0ef41Sopenharmony_ci block$1.html = edit(block$1.html, 'i').replace('comment', block$1._comment).replace('tag', block$1._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); 12541cb0ef41Sopenharmony_ci block$1.paragraph = edit(block$1._paragraph).replace('hr', block$1.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs 12551cb0ef41Sopenharmony_ci .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt 12561cb0ef41Sopenharmony_ci .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block$1._tag) // pars can be interrupted by type (6) html blocks 12571cb0ef41Sopenharmony_ci .getRegex(); 12581cb0ef41Sopenharmony_ci block$1.blockquote = edit(block$1.blockquote).replace('paragraph', block$1.paragraph).getRegex(); 12591cb0ef41Sopenharmony_ci /** 12601cb0ef41Sopenharmony_ci * Normal Block Grammar 12611cb0ef41Sopenharmony_ci */ 12621cb0ef41Sopenharmony_ci 12631cb0ef41Sopenharmony_ci block$1.normal = merge$1({}, block$1); 12641cb0ef41Sopenharmony_ci /** 12651cb0ef41Sopenharmony_ci * GFM Block Grammar 12661cb0ef41Sopenharmony_ci */ 12671cb0ef41Sopenharmony_ci 12681cb0ef41Sopenharmony_ci block$1.gfm = merge$1({}, block$1.normal, { 12691cb0ef41Sopenharmony_ci table: '^ *([^\\n ].*\\|.*)\\n' // Header 12701cb0ef41Sopenharmony_ci + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align 12711cb0ef41Sopenharmony_ci + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells 12721cb0ef41Sopenharmony_ci 12731cb0ef41Sopenharmony_ci }); 12741cb0ef41Sopenharmony_ci block$1.gfm.table = edit(block$1.gfm.table).replace('hr', block$1.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt 12751cb0ef41Sopenharmony_ci .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block$1._tag) // tables can be interrupted by type (6) html blocks 12761cb0ef41Sopenharmony_ci .getRegex(); 12771cb0ef41Sopenharmony_ci /** 12781cb0ef41Sopenharmony_ci * Pedantic grammar (original John Gruber's loose markdown specification) 12791cb0ef41Sopenharmony_ci */ 12801cb0ef41Sopenharmony_ci 12811cb0ef41Sopenharmony_ci block$1.pedantic = merge$1({}, block$1.normal, { 12821cb0ef41Sopenharmony_ci html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag 12831cb0ef41Sopenharmony_ci + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block$1._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(), 12841cb0ef41Sopenharmony_ci def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, 12851cb0ef41Sopenharmony_ci heading: /^(#{1,6})(.*)(?:\n+|$)/, 12861cb0ef41Sopenharmony_ci fences: noopTest, 12871cb0ef41Sopenharmony_ci // fences not supported 12881cb0ef41Sopenharmony_ci paragraph: edit(block$1.normal._paragraph).replace('hr', block$1.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block$1.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex() 12891cb0ef41Sopenharmony_ci }); 12901cb0ef41Sopenharmony_ci /** 12911cb0ef41Sopenharmony_ci * Inline-Level Grammar 12921cb0ef41Sopenharmony_ci */ 12931cb0ef41Sopenharmony_ci 12941cb0ef41Sopenharmony_ci var inline$1 = { 12951cb0ef41Sopenharmony_ci escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, 12961cb0ef41Sopenharmony_ci autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, 12971cb0ef41Sopenharmony_ci url: noopTest, 12981cb0ef41Sopenharmony_ci tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag 12991cb0ef41Sopenharmony_ci + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag 13001cb0ef41Sopenharmony_ci + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?> 13011cb0ef41Sopenharmony_ci + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html> 13021cb0ef41Sopenharmony_ci + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>', 13031cb0ef41Sopenharmony_ci // CDATA section 13041cb0ef41Sopenharmony_ci link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/, 13051cb0ef41Sopenharmony_ci reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/, 13061cb0ef41Sopenharmony_ci nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/, 13071cb0ef41Sopenharmony_ci reflinkSearch: 'reflink|nolink(?!\\()', 13081cb0ef41Sopenharmony_ci emStrong: { 13091cb0ef41Sopenharmony_ci lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/, 13101cb0ef41Sopenharmony_ci // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right. 13111cb0ef41Sopenharmony_ci // () Skip other delimiter (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a 13121cb0ef41Sopenharmony_ci rDelimAst: /\_\_[^_*]*?\*[^_*]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/, 13131cb0ef41Sopenharmony_ci rDelimUnd: /\*\*[^_*]*?\_[^_*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _ 13141cb0ef41Sopenharmony_ci 13151cb0ef41Sopenharmony_ci }, 13161cb0ef41Sopenharmony_ci code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, 13171cb0ef41Sopenharmony_ci br: /^( {2,}|\\)\n(?!\s*$)/, 13181cb0ef41Sopenharmony_ci del: noopTest, 13191cb0ef41Sopenharmony_ci text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, 13201cb0ef41Sopenharmony_ci punctuation: /^([\spunctuation])/ 13211cb0ef41Sopenharmony_ci }; // list of punctuation marks from CommonMark spec 13221cb0ef41Sopenharmony_ci // without * and _ to handle the different emphasis markers * and _ 13231cb0ef41Sopenharmony_ci 13241cb0ef41Sopenharmony_ci inline$1._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~'; 13251cb0ef41Sopenharmony_ci inline$1.punctuation = edit(inline$1.punctuation).replace(/punctuation/g, inline$1._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html> 13261cb0ef41Sopenharmony_ci 13271cb0ef41Sopenharmony_ci inline$1.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g; 13281cb0ef41Sopenharmony_ci inline$1.escapedEmSt = /\\\*|\\_/g; 13291cb0ef41Sopenharmony_ci inline$1._comment = edit(block$1._comment).replace('(?:-->|$)', '-->').getRegex(); 13301cb0ef41Sopenharmony_ci inline$1.emStrong.lDelim = edit(inline$1.emStrong.lDelim).replace(/punct/g, inline$1._punctuation).getRegex(); 13311cb0ef41Sopenharmony_ci inline$1.emStrong.rDelimAst = edit(inline$1.emStrong.rDelimAst, 'g').replace(/punct/g, inline$1._punctuation).getRegex(); 13321cb0ef41Sopenharmony_ci inline$1.emStrong.rDelimUnd = edit(inline$1.emStrong.rDelimUnd, 'g').replace(/punct/g, inline$1._punctuation).getRegex(); 13331cb0ef41Sopenharmony_ci inline$1._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g; 13341cb0ef41Sopenharmony_ci inline$1._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; 13351cb0ef41Sopenharmony_ci inline$1._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; 13361cb0ef41Sopenharmony_ci inline$1.autolink = edit(inline$1.autolink).replace('scheme', inline$1._scheme).replace('email', inline$1._email).getRegex(); 13371cb0ef41Sopenharmony_ci inline$1._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; 13381cb0ef41Sopenharmony_ci inline$1.tag = edit(inline$1.tag).replace('comment', inline$1._comment).replace('attribute', inline$1._attribute).getRegex(); 13391cb0ef41Sopenharmony_ci inline$1._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; 13401cb0ef41Sopenharmony_ci inline$1._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/; 13411cb0ef41Sopenharmony_ci inline$1._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; 13421cb0ef41Sopenharmony_ci inline$1.link = edit(inline$1.link).replace('label', inline$1._label).replace('href', inline$1._href).replace('title', inline$1._title).getRegex(); 13431cb0ef41Sopenharmony_ci inline$1.reflink = edit(inline$1.reflink).replace('label', inline$1._label).getRegex(); 13441cb0ef41Sopenharmony_ci inline$1.reflinkSearch = edit(inline$1.reflinkSearch, 'g').replace('reflink', inline$1.reflink).replace('nolink', inline$1.nolink).getRegex(); 13451cb0ef41Sopenharmony_ci /** 13461cb0ef41Sopenharmony_ci * Normal Inline Grammar 13471cb0ef41Sopenharmony_ci */ 13481cb0ef41Sopenharmony_ci 13491cb0ef41Sopenharmony_ci inline$1.normal = merge$1({}, inline$1); 13501cb0ef41Sopenharmony_ci /** 13511cb0ef41Sopenharmony_ci * Pedantic Inline Grammar 13521cb0ef41Sopenharmony_ci */ 13531cb0ef41Sopenharmony_ci 13541cb0ef41Sopenharmony_ci inline$1.pedantic = merge$1({}, inline$1.normal, { 13551cb0ef41Sopenharmony_ci strong: { 13561cb0ef41Sopenharmony_ci start: /^__|\*\*/, 13571cb0ef41Sopenharmony_ci middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, 13581cb0ef41Sopenharmony_ci endAst: /\*\*(?!\*)/g, 13591cb0ef41Sopenharmony_ci endUnd: /__(?!_)/g 13601cb0ef41Sopenharmony_ci }, 13611cb0ef41Sopenharmony_ci em: { 13621cb0ef41Sopenharmony_ci start: /^_|\*/, 13631cb0ef41Sopenharmony_ci middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/, 13641cb0ef41Sopenharmony_ci endAst: /\*(?!\*)/g, 13651cb0ef41Sopenharmony_ci endUnd: /_(?!_)/g 13661cb0ef41Sopenharmony_ci }, 13671cb0ef41Sopenharmony_ci link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline$1._label).getRegex(), 13681cb0ef41Sopenharmony_ci reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline$1._label).getRegex() 13691cb0ef41Sopenharmony_ci }); 13701cb0ef41Sopenharmony_ci /** 13711cb0ef41Sopenharmony_ci * GFM Inline Grammar 13721cb0ef41Sopenharmony_ci */ 13731cb0ef41Sopenharmony_ci 13741cb0ef41Sopenharmony_ci inline$1.gfm = merge$1({}, inline$1.normal, { 13751cb0ef41Sopenharmony_ci escape: edit(inline$1.escape).replace('])', '~|])').getRegex(), 13761cb0ef41Sopenharmony_ci _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, 13771cb0ef41Sopenharmony_ci url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 13781cb0ef41Sopenharmony_ci _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, 13791cb0ef41Sopenharmony_ci del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, 13801cb0ef41Sopenharmony_ci text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ 13811cb0ef41Sopenharmony_ci }); 13821cb0ef41Sopenharmony_ci inline$1.gfm.url = edit(inline$1.gfm.url, 'i').replace('email', inline$1.gfm._extended_email).getRegex(); 13831cb0ef41Sopenharmony_ci /** 13841cb0ef41Sopenharmony_ci * GFM + Line Breaks Inline Grammar 13851cb0ef41Sopenharmony_ci */ 13861cb0ef41Sopenharmony_ci 13871cb0ef41Sopenharmony_ci inline$1.breaks = merge$1({}, inline$1.gfm, { 13881cb0ef41Sopenharmony_ci br: edit(inline$1.br).replace('{2,}', '*').getRegex(), 13891cb0ef41Sopenharmony_ci text: edit(inline$1.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex() 13901cb0ef41Sopenharmony_ci }); 13911cb0ef41Sopenharmony_ci var rules = { 13921cb0ef41Sopenharmony_ci block: block$1, 13931cb0ef41Sopenharmony_ci inline: inline$1 13941cb0ef41Sopenharmony_ci }; 13951cb0ef41Sopenharmony_ci 13961cb0ef41Sopenharmony_ci var Tokenizer$1 = Tokenizer_1; 13971cb0ef41Sopenharmony_ci var defaults$3 = defaults$5.exports.defaults; 13981cb0ef41Sopenharmony_ci var block = rules.block, 13991cb0ef41Sopenharmony_ci inline = rules.inline; 14001cb0ef41Sopenharmony_ci var repeatString = helpers.repeatString; 14011cb0ef41Sopenharmony_ci /** 14021cb0ef41Sopenharmony_ci * smartypants text replacement 14031cb0ef41Sopenharmony_ci */ 14041cb0ef41Sopenharmony_ci 14051cb0ef41Sopenharmony_ci function smartypants(text) { 14061cb0ef41Sopenharmony_ci return text // em-dashes 14071cb0ef41Sopenharmony_ci .replace(/---/g, "\u2014") // en-dashes 14081cb0ef41Sopenharmony_ci .replace(/--/g, "\u2013") // opening singles 14091cb0ef41Sopenharmony_ci .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes 14101cb0ef41Sopenharmony_ci .replace(/'/g, "\u2019") // opening doubles 14111cb0ef41Sopenharmony_ci .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles 14121cb0ef41Sopenharmony_ci .replace(/"/g, "\u201D") // ellipses 14131cb0ef41Sopenharmony_ci .replace(/\.{3}/g, "\u2026"); 14141cb0ef41Sopenharmony_ci } 14151cb0ef41Sopenharmony_ci /** 14161cb0ef41Sopenharmony_ci * mangle email addresses 14171cb0ef41Sopenharmony_ci */ 14181cb0ef41Sopenharmony_ci 14191cb0ef41Sopenharmony_ci 14201cb0ef41Sopenharmony_ci function mangle(text) { 14211cb0ef41Sopenharmony_ci var out = '', 14221cb0ef41Sopenharmony_ci i, 14231cb0ef41Sopenharmony_ci ch; 14241cb0ef41Sopenharmony_ci var l = text.length; 14251cb0ef41Sopenharmony_ci 14261cb0ef41Sopenharmony_ci for (i = 0; i < l; i++) { 14271cb0ef41Sopenharmony_ci ch = text.charCodeAt(i); 14281cb0ef41Sopenharmony_ci 14291cb0ef41Sopenharmony_ci if (Math.random() > 0.5) { 14301cb0ef41Sopenharmony_ci ch = 'x' + ch.toString(16); 14311cb0ef41Sopenharmony_ci } 14321cb0ef41Sopenharmony_ci 14331cb0ef41Sopenharmony_ci out += '&#' + ch + ';'; 14341cb0ef41Sopenharmony_ci } 14351cb0ef41Sopenharmony_ci 14361cb0ef41Sopenharmony_ci return out; 14371cb0ef41Sopenharmony_ci } 14381cb0ef41Sopenharmony_ci /** 14391cb0ef41Sopenharmony_ci * Block Lexer 14401cb0ef41Sopenharmony_ci */ 14411cb0ef41Sopenharmony_ci 14421cb0ef41Sopenharmony_ci 14431cb0ef41Sopenharmony_ci var Lexer_1 = /*#__PURE__*/function () { 14441cb0ef41Sopenharmony_ci function Lexer(options) { 14451cb0ef41Sopenharmony_ci this.tokens = []; 14461cb0ef41Sopenharmony_ci this.tokens.links = Object.create(null); 14471cb0ef41Sopenharmony_ci this.options = options || defaults$3; 14481cb0ef41Sopenharmony_ci this.options.tokenizer = this.options.tokenizer || new Tokenizer$1(); 14491cb0ef41Sopenharmony_ci this.tokenizer = this.options.tokenizer; 14501cb0ef41Sopenharmony_ci this.tokenizer.options = this.options; 14511cb0ef41Sopenharmony_ci this.tokenizer.lexer = this; 14521cb0ef41Sopenharmony_ci this.inlineQueue = []; 14531cb0ef41Sopenharmony_ci this.state = { 14541cb0ef41Sopenharmony_ci inLink: false, 14551cb0ef41Sopenharmony_ci inRawBlock: false, 14561cb0ef41Sopenharmony_ci top: true 14571cb0ef41Sopenharmony_ci }; 14581cb0ef41Sopenharmony_ci var rules = { 14591cb0ef41Sopenharmony_ci block: block.normal, 14601cb0ef41Sopenharmony_ci inline: inline.normal 14611cb0ef41Sopenharmony_ci }; 14621cb0ef41Sopenharmony_ci 14631cb0ef41Sopenharmony_ci if (this.options.pedantic) { 14641cb0ef41Sopenharmony_ci rules.block = block.pedantic; 14651cb0ef41Sopenharmony_ci rules.inline = inline.pedantic; 14661cb0ef41Sopenharmony_ci } else if (this.options.gfm) { 14671cb0ef41Sopenharmony_ci rules.block = block.gfm; 14681cb0ef41Sopenharmony_ci 14691cb0ef41Sopenharmony_ci if (this.options.breaks) { 14701cb0ef41Sopenharmony_ci rules.inline = inline.breaks; 14711cb0ef41Sopenharmony_ci } else { 14721cb0ef41Sopenharmony_ci rules.inline = inline.gfm; 14731cb0ef41Sopenharmony_ci } 14741cb0ef41Sopenharmony_ci } 14751cb0ef41Sopenharmony_ci 14761cb0ef41Sopenharmony_ci this.tokenizer.rules = rules; 14771cb0ef41Sopenharmony_ci } 14781cb0ef41Sopenharmony_ci /** 14791cb0ef41Sopenharmony_ci * Expose Rules 14801cb0ef41Sopenharmony_ci */ 14811cb0ef41Sopenharmony_ci 14821cb0ef41Sopenharmony_ci 14831cb0ef41Sopenharmony_ci /** 14841cb0ef41Sopenharmony_ci * Static Lex Method 14851cb0ef41Sopenharmony_ci */ 14861cb0ef41Sopenharmony_ci Lexer.lex = function lex(src, options) { 14871cb0ef41Sopenharmony_ci var lexer = new Lexer(options); 14881cb0ef41Sopenharmony_ci return lexer.lex(src); 14891cb0ef41Sopenharmony_ci } 14901cb0ef41Sopenharmony_ci /** 14911cb0ef41Sopenharmony_ci * Static Lex Inline Method 14921cb0ef41Sopenharmony_ci */ 14931cb0ef41Sopenharmony_ci ; 14941cb0ef41Sopenharmony_ci 14951cb0ef41Sopenharmony_ci Lexer.lexInline = function lexInline(src, options) { 14961cb0ef41Sopenharmony_ci var lexer = new Lexer(options); 14971cb0ef41Sopenharmony_ci return lexer.inlineTokens(src); 14981cb0ef41Sopenharmony_ci } 14991cb0ef41Sopenharmony_ci /** 15001cb0ef41Sopenharmony_ci * Preprocessing 15011cb0ef41Sopenharmony_ci */ 15021cb0ef41Sopenharmony_ci ; 15031cb0ef41Sopenharmony_ci 15041cb0ef41Sopenharmony_ci var _proto = Lexer.prototype; 15051cb0ef41Sopenharmony_ci 15061cb0ef41Sopenharmony_ci _proto.lex = function lex(src) { 15071cb0ef41Sopenharmony_ci src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' '); 15081cb0ef41Sopenharmony_ci this.blockTokens(src, this.tokens); 15091cb0ef41Sopenharmony_ci var next; 15101cb0ef41Sopenharmony_ci 15111cb0ef41Sopenharmony_ci while (next = this.inlineQueue.shift()) { 15121cb0ef41Sopenharmony_ci this.inlineTokens(next.src, next.tokens); 15131cb0ef41Sopenharmony_ci } 15141cb0ef41Sopenharmony_ci 15151cb0ef41Sopenharmony_ci return this.tokens; 15161cb0ef41Sopenharmony_ci } 15171cb0ef41Sopenharmony_ci /** 15181cb0ef41Sopenharmony_ci * Lexing 15191cb0ef41Sopenharmony_ci */ 15201cb0ef41Sopenharmony_ci ; 15211cb0ef41Sopenharmony_ci 15221cb0ef41Sopenharmony_ci _proto.blockTokens = function blockTokens(src, tokens) { 15231cb0ef41Sopenharmony_ci var _this = this; 15241cb0ef41Sopenharmony_ci 15251cb0ef41Sopenharmony_ci if (tokens === void 0) { 15261cb0ef41Sopenharmony_ci tokens = []; 15271cb0ef41Sopenharmony_ci } 15281cb0ef41Sopenharmony_ci 15291cb0ef41Sopenharmony_ci if (this.options.pedantic) { 15301cb0ef41Sopenharmony_ci src = src.replace(/^ +$/gm, ''); 15311cb0ef41Sopenharmony_ci } 15321cb0ef41Sopenharmony_ci 15331cb0ef41Sopenharmony_ci var token, lastToken, cutSrc, lastParagraphClipped; 15341cb0ef41Sopenharmony_ci 15351cb0ef41Sopenharmony_ci while (src) { 15361cb0ef41Sopenharmony_ci if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) { 15371cb0ef41Sopenharmony_ci if (token = extTokenizer.call({ 15381cb0ef41Sopenharmony_ci lexer: _this 15391cb0ef41Sopenharmony_ci }, src, tokens)) { 15401cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 15411cb0ef41Sopenharmony_ci tokens.push(token); 15421cb0ef41Sopenharmony_ci return true; 15431cb0ef41Sopenharmony_ci } 15441cb0ef41Sopenharmony_ci 15451cb0ef41Sopenharmony_ci return false; 15461cb0ef41Sopenharmony_ci })) { 15471cb0ef41Sopenharmony_ci continue; 15481cb0ef41Sopenharmony_ci } // newline 15491cb0ef41Sopenharmony_ci 15501cb0ef41Sopenharmony_ci 15511cb0ef41Sopenharmony_ci if (token = this.tokenizer.space(src)) { 15521cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 15531cb0ef41Sopenharmony_ci 15541cb0ef41Sopenharmony_ci if (token.type) { 15551cb0ef41Sopenharmony_ci tokens.push(token); 15561cb0ef41Sopenharmony_ci } 15571cb0ef41Sopenharmony_ci 15581cb0ef41Sopenharmony_ci continue; 15591cb0ef41Sopenharmony_ci } // code 15601cb0ef41Sopenharmony_ci 15611cb0ef41Sopenharmony_ci 15621cb0ef41Sopenharmony_ci if (token = this.tokenizer.code(src)) { 15631cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 15641cb0ef41Sopenharmony_ci lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph. 15651cb0ef41Sopenharmony_ci 15661cb0ef41Sopenharmony_ci if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) { 15671cb0ef41Sopenharmony_ci lastToken.raw += '\n' + token.raw; 15681cb0ef41Sopenharmony_ci lastToken.text += '\n' + token.text; 15691cb0ef41Sopenharmony_ci this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 15701cb0ef41Sopenharmony_ci } else { 15711cb0ef41Sopenharmony_ci tokens.push(token); 15721cb0ef41Sopenharmony_ci } 15731cb0ef41Sopenharmony_ci 15741cb0ef41Sopenharmony_ci continue; 15751cb0ef41Sopenharmony_ci } // fences 15761cb0ef41Sopenharmony_ci 15771cb0ef41Sopenharmony_ci 15781cb0ef41Sopenharmony_ci if (token = this.tokenizer.fences(src)) { 15791cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 15801cb0ef41Sopenharmony_ci tokens.push(token); 15811cb0ef41Sopenharmony_ci continue; 15821cb0ef41Sopenharmony_ci } // heading 15831cb0ef41Sopenharmony_ci 15841cb0ef41Sopenharmony_ci 15851cb0ef41Sopenharmony_ci if (token = this.tokenizer.heading(src)) { 15861cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 15871cb0ef41Sopenharmony_ci tokens.push(token); 15881cb0ef41Sopenharmony_ci continue; 15891cb0ef41Sopenharmony_ci } // hr 15901cb0ef41Sopenharmony_ci 15911cb0ef41Sopenharmony_ci 15921cb0ef41Sopenharmony_ci if (token = this.tokenizer.hr(src)) { 15931cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 15941cb0ef41Sopenharmony_ci tokens.push(token); 15951cb0ef41Sopenharmony_ci continue; 15961cb0ef41Sopenharmony_ci } // blockquote 15971cb0ef41Sopenharmony_ci 15981cb0ef41Sopenharmony_ci 15991cb0ef41Sopenharmony_ci if (token = this.tokenizer.blockquote(src)) { 16001cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16011cb0ef41Sopenharmony_ci tokens.push(token); 16021cb0ef41Sopenharmony_ci continue; 16031cb0ef41Sopenharmony_ci } // list 16041cb0ef41Sopenharmony_ci 16051cb0ef41Sopenharmony_ci 16061cb0ef41Sopenharmony_ci if (token = this.tokenizer.list(src)) { 16071cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16081cb0ef41Sopenharmony_ci tokens.push(token); 16091cb0ef41Sopenharmony_ci continue; 16101cb0ef41Sopenharmony_ci } // html 16111cb0ef41Sopenharmony_ci 16121cb0ef41Sopenharmony_ci 16131cb0ef41Sopenharmony_ci if (token = this.tokenizer.html(src)) { 16141cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16151cb0ef41Sopenharmony_ci tokens.push(token); 16161cb0ef41Sopenharmony_ci continue; 16171cb0ef41Sopenharmony_ci } // def 16181cb0ef41Sopenharmony_ci 16191cb0ef41Sopenharmony_ci 16201cb0ef41Sopenharmony_ci if (token = this.tokenizer.def(src)) { 16211cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16221cb0ef41Sopenharmony_ci lastToken = tokens[tokens.length - 1]; 16231cb0ef41Sopenharmony_ci 16241cb0ef41Sopenharmony_ci if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) { 16251cb0ef41Sopenharmony_ci lastToken.raw += '\n' + token.raw; 16261cb0ef41Sopenharmony_ci lastToken.text += '\n' + token.raw; 16271cb0ef41Sopenharmony_ci this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 16281cb0ef41Sopenharmony_ci } else if (!this.tokens.links[token.tag]) { 16291cb0ef41Sopenharmony_ci this.tokens.links[token.tag] = { 16301cb0ef41Sopenharmony_ci href: token.href, 16311cb0ef41Sopenharmony_ci title: token.title 16321cb0ef41Sopenharmony_ci }; 16331cb0ef41Sopenharmony_ci } 16341cb0ef41Sopenharmony_ci 16351cb0ef41Sopenharmony_ci continue; 16361cb0ef41Sopenharmony_ci } // table (gfm) 16371cb0ef41Sopenharmony_ci 16381cb0ef41Sopenharmony_ci 16391cb0ef41Sopenharmony_ci if (token = this.tokenizer.table(src)) { 16401cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16411cb0ef41Sopenharmony_ci tokens.push(token); 16421cb0ef41Sopenharmony_ci continue; 16431cb0ef41Sopenharmony_ci } // lheading 16441cb0ef41Sopenharmony_ci 16451cb0ef41Sopenharmony_ci 16461cb0ef41Sopenharmony_ci if (token = this.tokenizer.lheading(src)) { 16471cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16481cb0ef41Sopenharmony_ci tokens.push(token); 16491cb0ef41Sopenharmony_ci continue; 16501cb0ef41Sopenharmony_ci } // top-level paragraph 16511cb0ef41Sopenharmony_ci // prevent paragraph consuming extensions by clipping 'src' to extension start 16521cb0ef41Sopenharmony_ci 16531cb0ef41Sopenharmony_ci 16541cb0ef41Sopenharmony_ci cutSrc = src; 16551cb0ef41Sopenharmony_ci 16561cb0ef41Sopenharmony_ci if (this.options.extensions && this.options.extensions.startBlock) { 16571cb0ef41Sopenharmony_ci (function () { 16581cb0ef41Sopenharmony_ci var startIndex = Infinity; 16591cb0ef41Sopenharmony_ci var tempSrc = src.slice(1); 16601cb0ef41Sopenharmony_ci var tempStart = void 0; 16611cb0ef41Sopenharmony_ci 16621cb0ef41Sopenharmony_ci _this.options.extensions.startBlock.forEach(function (getStartIndex) { 16631cb0ef41Sopenharmony_ci tempStart = getStartIndex.call({ 16641cb0ef41Sopenharmony_ci lexer: this 16651cb0ef41Sopenharmony_ci }, tempSrc); 16661cb0ef41Sopenharmony_ci 16671cb0ef41Sopenharmony_ci if (typeof tempStart === 'number' && tempStart >= 0) { 16681cb0ef41Sopenharmony_ci startIndex = Math.min(startIndex, tempStart); 16691cb0ef41Sopenharmony_ci } 16701cb0ef41Sopenharmony_ci }); 16711cb0ef41Sopenharmony_ci 16721cb0ef41Sopenharmony_ci if (startIndex < Infinity && startIndex >= 0) { 16731cb0ef41Sopenharmony_ci cutSrc = src.substring(0, startIndex + 1); 16741cb0ef41Sopenharmony_ci } 16751cb0ef41Sopenharmony_ci })(); 16761cb0ef41Sopenharmony_ci } 16771cb0ef41Sopenharmony_ci 16781cb0ef41Sopenharmony_ci if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) { 16791cb0ef41Sopenharmony_ci lastToken = tokens[tokens.length - 1]; 16801cb0ef41Sopenharmony_ci 16811cb0ef41Sopenharmony_ci if (lastParagraphClipped && lastToken.type === 'paragraph') { 16821cb0ef41Sopenharmony_ci lastToken.raw += '\n' + token.raw; 16831cb0ef41Sopenharmony_ci lastToken.text += '\n' + token.text; 16841cb0ef41Sopenharmony_ci this.inlineQueue.pop(); 16851cb0ef41Sopenharmony_ci this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 16861cb0ef41Sopenharmony_ci } else { 16871cb0ef41Sopenharmony_ci tokens.push(token); 16881cb0ef41Sopenharmony_ci } 16891cb0ef41Sopenharmony_ci 16901cb0ef41Sopenharmony_ci lastParagraphClipped = cutSrc.length !== src.length; 16911cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16921cb0ef41Sopenharmony_ci continue; 16931cb0ef41Sopenharmony_ci } // text 16941cb0ef41Sopenharmony_ci 16951cb0ef41Sopenharmony_ci 16961cb0ef41Sopenharmony_ci if (token = this.tokenizer.text(src)) { 16971cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 16981cb0ef41Sopenharmony_ci lastToken = tokens[tokens.length - 1]; 16991cb0ef41Sopenharmony_ci 17001cb0ef41Sopenharmony_ci if (lastToken && lastToken.type === 'text') { 17011cb0ef41Sopenharmony_ci lastToken.raw += '\n' + token.raw; 17021cb0ef41Sopenharmony_ci lastToken.text += '\n' + token.text; 17031cb0ef41Sopenharmony_ci this.inlineQueue.pop(); 17041cb0ef41Sopenharmony_ci this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; 17051cb0ef41Sopenharmony_ci } else { 17061cb0ef41Sopenharmony_ci tokens.push(token); 17071cb0ef41Sopenharmony_ci } 17081cb0ef41Sopenharmony_ci 17091cb0ef41Sopenharmony_ci continue; 17101cb0ef41Sopenharmony_ci } 17111cb0ef41Sopenharmony_ci 17121cb0ef41Sopenharmony_ci if (src) { 17131cb0ef41Sopenharmony_ci var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); 17141cb0ef41Sopenharmony_ci 17151cb0ef41Sopenharmony_ci if (this.options.silent) { 17161cb0ef41Sopenharmony_ci console.error(errMsg); 17171cb0ef41Sopenharmony_ci break; 17181cb0ef41Sopenharmony_ci } else { 17191cb0ef41Sopenharmony_ci throw new Error(errMsg); 17201cb0ef41Sopenharmony_ci } 17211cb0ef41Sopenharmony_ci } 17221cb0ef41Sopenharmony_ci } 17231cb0ef41Sopenharmony_ci 17241cb0ef41Sopenharmony_ci this.state.top = true; 17251cb0ef41Sopenharmony_ci return tokens; 17261cb0ef41Sopenharmony_ci }; 17271cb0ef41Sopenharmony_ci 17281cb0ef41Sopenharmony_ci _proto.inline = function inline(src, tokens) { 17291cb0ef41Sopenharmony_ci this.inlineQueue.push({ 17301cb0ef41Sopenharmony_ci src: src, 17311cb0ef41Sopenharmony_ci tokens: tokens 17321cb0ef41Sopenharmony_ci }); 17331cb0ef41Sopenharmony_ci } 17341cb0ef41Sopenharmony_ci /** 17351cb0ef41Sopenharmony_ci * Lexing/Compiling 17361cb0ef41Sopenharmony_ci */ 17371cb0ef41Sopenharmony_ci ; 17381cb0ef41Sopenharmony_ci 17391cb0ef41Sopenharmony_ci _proto.inlineTokens = function inlineTokens(src, tokens) { 17401cb0ef41Sopenharmony_ci var _this2 = this; 17411cb0ef41Sopenharmony_ci 17421cb0ef41Sopenharmony_ci if (tokens === void 0) { 17431cb0ef41Sopenharmony_ci tokens = []; 17441cb0ef41Sopenharmony_ci } 17451cb0ef41Sopenharmony_ci 17461cb0ef41Sopenharmony_ci var token, lastToken, cutSrc; // String with links masked to avoid interference with em and strong 17471cb0ef41Sopenharmony_ci 17481cb0ef41Sopenharmony_ci var maskedSrc = src; 17491cb0ef41Sopenharmony_ci var match; 17501cb0ef41Sopenharmony_ci var keepPrevChar, prevChar; // Mask out reflinks 17511cb0ef41Sopenharmony_ci 17521cb0ef41Sopenharmony_ci if (this.tokens.links) { 17531cb0ef41Sopenharmony_ci var links = Object.keys(this.tokens.links); 17541cb0ef41Sopenharmony_ci 17551cb0ef41Sopenharmony_ci if (links.length > 0) { 17561cb0ef41Sopenharmony_ci while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) { 17571cb0ef41Sopenharmony_ci if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) { 17581cb0ef41Sopenharmony_ci maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); 17591cb0ef41Sopenharmony_ci } 17601cb0ef41Sopenharmony_ci } 17611cb0ef41Sopenharmony_ci } 17621cb0ef41Sopenharmony_ci } // Mask out other blocks 17631cb0ef41Sopenharmony_ci 17641cb0ef41Sopenharmony_ci 17651cb0ef41Sopenharmony_ci while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) { 17661cb0ef41Sopenharmony_ci maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); 17671cb0ef41Sopenharmony_ci } // Mask out escaped em & strong delimiters 17681cb0ef41Sopenharmony_ci 17691cb0ef41Sopenharmony_ci 17701cb0ef41Sopenharmony_ci while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) { 17711cb0ef41Sopenharmony_ci maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex); 17721cb0ef41Sopenharmony_ci } 17731cb0ef41Sopenharmony_ci 17741cb0ef41Sopenharmony_ci while (src) { 17751cb0ef41Sopenharmony_ci if (!keepPrevChar) { 17761cb0ef41Sopenharmony_ci prevChar = ''; 17771cb0ef41Sopenharmony_ci } 17781cb0ef41Sopenharmony_ci 17791cb0ef41Sopenharmony_ci keepPrevChar = false; // extensions 17801cb0ef41Sopenharmony_ci 17811cb0ef41Sopenharmony_ci if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) { 17821cb0ef41Sopenharmony_ci if (token = extTokenizer.call({ 17831cb0ef41Sopenharmony_ci lexer: _this2 17841cb0ef41Sopenharmony_ci }, src, tokens)) { 17851cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 17861cb0ef41Sopenharmony_ci tokens.push(token); 17871cb0ef41Sopenharmony_ci return true; 17881cb0ef41Sopenharmony_ci } 17891cb0ef41Sopenharmony_ci 17901cb0ef41Sopenharmony_ci return false; 17911cb0ef41Sopenharmony_ci })) { 17921cb0ef41Sopenharmony_ci continue; 17931cb0ef41Sopenharmony_ci } // escape 17941cb0ef41Sopenharmony_ci 17951cb0ef41Sopenharmony_ci 17961cb0ef41Sopenharmony_ci if (token = this.tokenizer.escape(src)) { 17971cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 17981cb0ef41Sopenharmony_ci tokens.push(token); 17991cb0ef41Sopenharmony_ci continue; 18001cb0ef41Sopenharmony_ci } // tag 18011cb0ef41Sopenharmony_ci 18021cb0ef41Sopenharmony_ci 18031cb0ef41Sopenharmony_ci if (token = this.tokenizer.tag(src)) { 18041cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18051cb0ef41Sopenharmony_ci lastToken = tokens[tokens.length - 1]; 18061cb0ef41Sopenharmony_ci 18071cb0ef41Sopenharmony_ci if (lastToken && token.type === 'text' && lastToken.type === 'text') { 18081cb0ef41Sopenharmony_ci lastToken.raw += token.raw; 18091cb0ef41Sopenharmony_ci lastToken.text += token.text; 18101cb0ef41Sopenharmony_ci } else { 18111cb0ef41Sopenharmony_ci tokens.push(token); 18121cb0ef41Sopenharmony_ci } 18131cb0ef41Sopenharmony_ci 18141cb0ef41Sopenharmony_ci continue; 18151cb0ef41Sopenharmony_ci } // link 18161cb0ef41Sopenharmony_ci 18171cb0ef41Sopenharmony_ci 18181cb0ef41Sopenharmony_ci if (token = this.tokenizer.link(src)) { 18191cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18201cb0ef41Sopenharmony_ci tokens.push(token); 18211cb0ef41Sopenharmony_ci continue; 18221cb0ef41Sopenharmony_ci } // reflink, nolink 18231cb0ef41Sopenharmony_ci 18241cb0ef41Sopenharmony_ci 18251cb0ef41Sopenharmony_ci if (token = this.tokenizer.reflink(src, this.tokens.links)) { 18261cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18271cb0ef41Sopenharmony_ci lastToken = tokens[tokens.length - 1]; 18281cb0ef41Sopenharmony_ci 18291cb0ef41Sopenharmony_ci if (lastToken && token.type === 'text' && lastToken.type === 'text') { 18301cb0ef41Sopenharmony_ci lastToken.raw += token.raw; 18311cb0ef41Sopenharmony_ci lastToken.text += token.text; 18321cb0ef41Sopenharmony_ci } else { 18331cb0ef41Sopenharmony_ci tokens.push(token); 18341cb0ef41Sopenharmony_ci } 18351cb0ef41Sopenharmony_ci 18361cb0ef41Sopenharmony_ci continue; 18371cb0ef41Sopenharmony_ci } // em & strong 18381cb0ef41Sopenharmony_ci 18391cb0ef41Sopenharmony_ci 18401cb0ef41Sopenharmony_ci if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) { 18411cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18421cb0ef41Sopenharmony_ci tokens.push(token); 18431cb0ef41Sopenharmony_ci continue; 18441cb0ef41Sopenharmony_ci } // code 18451cb0ef41Sopenharmony_ci 18461cb0ef41Sopenharmony_ci 18471cb0ef41Sopenharmony_ci if (token = this.tokenizer.codespan(src)) { 18481cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18491cb0ef41Sopenharmony_ci tokens.push(token); 18501cb0ef41Sopenharmony_ci continue; 18511cb0ef41Sopenharmony_ci } // br 18521cb0ef41Sopenharmony_ci 18531cb0ef41Sopenharmony_ci 18541cb0ef41Sopenharmony_ci if (token = this.tokenizer.br(src)) { 18551cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18561cb0ef41Sopenharmony_ci tokens.push(token); 18571cb0ef41Sopenharmony_ci continue; 18581cb0ef41Sopenharmony_ci } // del (gfm) 18591cb0ef41Sopenharmony_ci 18601cb0ef41Sopenharmony_ci 18611cb0ef41Sopenharmony_ci if (token = this.tokenizer.del(src)) { 18621cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18631cb0ef41Sopenharmony_ci tokens.push(token); 18641cb0ef41Sopenharmony_ci continue; 18651cb0ef41Sopenharmony_ci } // autolink 18661cb0ef41Sopenharmony_ci 18671cb0ef41Sopenharmony_ci 18681cb0ef41Sopenharmony_ci if (token = this.tokenizer.autolink(src, mangle)) { 18691cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18701cb0ef41Sopenharmony_ci tokens.push(token); 18711cb0ef41Sopenharmony_ci continue; 18721cb0ef41Sopenharmony_ci } // url (gfm) 18731cb0ef41Sopenharmony_ci 18741cb0ef41Sopenharmony_ci 18751cb0ef41Sopenharmony_ci if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) { 18761cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 18771cb0ef41Sopenharmony_ci tokens.push(token); 18781cb0ef41Sopenharmony_ci continue; 18791cb0ef41Sopenharmony_ci } // text 18801cb0ef41Sopenharmony_ci // prevent inlineText consuming extensions by clipping 'src' to extension start 18811cb0ef41Sopenharmony_ci 18821cb0ef41Sopenharmony_ci 18831cb0ef41Sopenharmony_ci cutSrc = src; 18841cb0ef41Sopenharmony_ci 18851cb0ef41Sopenharmony_ci if (this.options.extensions && this.options.extensions.startInline) { 18861cb0ef41Sopenharmony_ci (function () { 18871cb0ef41Sopenharmony_ci var startIndex = Infinity; 18881cb0ef41Sopenharmony_ci var tempSrc = src.slice(1); 18891cb0ef41Sopenharmony_ci var tempStart = void 0; 18901cb0ef41Sopenharmony_ci 18911cb0ef41Sopenharmony_ci _this2.options.extensions.startInline.forEach(function (getStartIndex) { 18921cb0ef41Sopenharmony_ci tempStart = getStartIndex.call({ 18931cb0ef41Sopenharmony_ci lexer: this 18941cb0ef41Sopenharmony_ci }, tempSrc); 18951cb0ef41Sopenharmony_ci 18961cb0ef41Sopenharmony_ci if (typeof tempStart === 'number' && tempStart >= 0) { 18971cb0ef41Sopenharmony_ci startIndex = Math.min(startIndex, tempStart); 18981cb0ef41Sopenharmony_ci } 18991cb0ef41Sopenharmony_ci }); 19001cb0ef41Sopenharmony_ci 19011cb0ef41Sopenharmony_ci if (startIndex < Infinity && startIndex >= 0) { 19021cb0ef41Sopenharmony_ci cutSrc = src.substring(0, startIndex + 1); 19031cb0ef41Sopenharmony_ci } 19041cb0ef41Sopenharmony_ci })(); 19051cb0ef41Sopenharmony_ci } 19061cb0ef41Sopenharmony_ci 19071cb0ef41Sopenharmony_ci if (token = this.tokenizer.inlineText(cutSrc, smartypants)) { 19081cb0ef41Sopenharmony_ci src = src.substring(token.raw.length); 19091cb0ef41Sopenharmony_ci 19101cb0ef41Sopenharmony_ci if (token.raw.slice(-1) !== '_') { 19111cb0ef41Sopenharmony_ci // Track prevChar before string of ____ started 19121cb0ef41Sopenharmony_ci prevChar = token.raw.slice(-1); 19131cb0ef41Sopenharmony_ci } 19141cb0ef41Sopenharmony_ci 19151cb0ef41Sopenharmony_ci keepPrevChar = true; 19161cb0ef41Sopenharmony_ci lastToken = tokens[tokens.length - 1]; 19171cb0ef41Sopenharmony_ci 19181cb0ef41Sopenharmony_ci if (lastToken && lastToken.type === 'text') { 19191cb0ef41Sopenharmony_ci lastToken.raw += token.raw; 19201cb0ef41Sopenharmony_ci lastToken.text += token.text; 19211cb0ef41Sopenharmony_ci } else { 19221cb0ef41Sopenharmony_ci tokens.push(token); 19231cb0ef41Sopenharmony_ci } 19241cb0ef41Sopenharmony_ci 19251cb0ef41Sopenharmony_ci continue; 19261cb0ef41Sopenharmony_ci } 19271cb0ef41Sopenharmony_ci 19281cb0ef41Sopenharmony_ci if (src) { 19291cb0ef41Sopenharmony_ci var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); 19301cb0ef41Sopenharmony_ci 19311cb0ef41Sopenharmony_ci if (this.options.silent) { 19321cb0ef41Sopenharmony_ci console.error(errMsg); 19331cb0ef41Sopenharmony_ci break; 19341cb0ef41Sopenharmony_ci } else { 19351cb0ef41Sopenharmony_ci throw new Error(errMsg); 19361cb0ef41Sopenharmony_ci } 19371cb0ef41Sopenharmony_ci } 19381cb0ef41Sopenharmony_ci } 19391cb0ef41Sopenharmony_ci 19401cb0ef41Sopenharmony_ci return tokens; 19411cb0ef41Sopenharmony_ci }; 19421cb0ef41Sopenharmony_ci 19431cb0ef41Sopenharmony_ci _createClass(Lexer, null, [{ 19441cb0ef41Sopenharmony_ci key: "rules", 19451cb0ef41Sopenharmony_ci get: function get() { 19461cb0ef41Sopenharmony_ci return { 19471cb0ef41Sopenharmony_ci block: block, 19481cb0ef41Sopenharmony_ci inline: inline 19491cb0ef41Sopenharmony_ci }; 19501cb0ef41Sopenharmony_ci } 19511cb0ef41Sopenharmony_ci }]); 19521cb0ef41Sopenharmony_ci 19531cb0ef41Sopenharmony_ci return Lexer; 19541cb0ef41Sopenharmony_ci }(); 19551cb0ef41Sopenharmony_ci 19561cb0ef41Sopenharmony_ci var defaults$2 = defaults$5.exports.defaults; 19571cb0ef41Sopenharmony_ci var cleanUrl = helpers.cleanUrl, 19581cb0ef41Sopenharmony_ci escape$1 = helpers.escape; 19591cb0ef41Sopenharmony_ci /** 19601cb0ef41Sopenharmony_ci * Renderer 19611cb0ef41Sopenharmony_ci */ 19621cb0ef41Sopenharmony_ci 19631cb0ef41Sopenharmony_ci var Renderer_1 = /*#__PURE__*/function () { 19641cb0ef41Sopenharmony_ci function Renderer(options) { 19651cb0ef41Sopenharmony_ci this.options = options || defaults$2; 19661cb0ef41Sopenharmony_ci } 19671cb0ef41Sopenharmony_ci 19681cb0ef41Sopenharmony_ci var _proto = Renderer.prototype; 19691cb0ef41Sopenharmony_ci 19701cb0ef41Sopenharmony_ci _proto.code = function code(_code, infostring, escaped) { 19711cb0ef41Sopenharmony_ci var lang = (infostring || '').match(/\S*/)[0]; 19721cb0ef41Sopenharmony_ci 19731cb0ef41Sopenharmony_ci if (this.options.highlight) { 19741cb0ef41Sopenharmony_ci var out = this.options.highlight(_code, lang); 19751cb0ef41Sopenharmony_ci 19761cb0ef41Sopenharmony_ci if (out != null && out !== _code) { 19771cb0ef41Sopenharmony_ci escaped = true; 19781cb0ef41Sopenharmony_ci _code = out; 19791cb0ef41Sopenharmony_ci } 19801cb0ef41Sopenharmony_ci } 19811cb0ef41Sopenharmony_ci 19821cb0ef41Sopenharmony_ci _code = _code.replace(/\n$/, '') + '\n'; 19831cb0ef41Sopenharmony_ci 19841cb0ef41Sopenharmony_ci if (!lang) { 19851cb0ef41Sopenharmony_ci return '<pre><code>' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n'; 19861cb0ef41Sopenharmony_ci } 19871cb0ef41Sopenharmony_ci 19881cb0ef41Sopenharmony_ci return '<pre><code class="' + this.options.langPrefix + escape$1(lang, true) + '">' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n'; 19891cb0ef41Sopenharmony_ci }; 19901cb0ef41Sopenharmony_ci 19911cb0ef41Sopenharmony_ci _proto.blockquote = function blockquote(quote) { 19921cb0ef41Sopenharmony_ci return '<blockquote>\n' + quote + '</blockquote>\n'; 19931cb0ef41Sopenharmony_ci }; 19941cb0ef41Sopenharmony_ci 19951cb0ef41Sopenharmony_ci _proto.html = function html(_html) { 19961cb0ef41Sopenharmony_ci return _html; 19971cb0ef41Sopenharmony_ci }; 19981cb0ef41Sopenharmony_ci 19991cb0ef41Sopenharmony_ci _proto.heading = function heading(text, level, raw, slugger) { 20001cb0ef41Sopenharmony_ci if (this.options.headerIds) { 20011cb0ef41Sopenharmony_ci return '<h' + level + ' id="' + this.options.headerPrefix + slugger.slug(raw) + '">' + text + '</h' + level + '>\n'; 20021cb0ef41Sopenharmony_ci } // ignore IDs 20031cb0ef41Sopenharmony_ci 20041cb0ef41Sopenharmony_ci 20051cb0ef41Sopenharmony_ci return '<h' + level + '>' + text + '</h' + level + '>\n'; 20061cb0ef41Sopenharmony_ci }; 20071cb0ef41Sopenharmony_ci 20081cb0ef41Sopenharmony_ci _proto.hr = function hr() { 20091cb0ef41Sopenharmony_ci return this.options.xhtml ? '<hr/>\n' : '<hr>\n'; 20101cb0ef41Sopenharmony_ci }; 20111cb0ef41Sopenharmony_ci 20121cb0ef41Sopenharmony_ci _proto.list = function list(body, ordered, start) { 20131cb0ef41Sopenharmony_ci var type = ordered ? 'ol' : 'ul', 20141cb0ef41Sopenharmony_ci startatt = ordered && start !== 1 ? ' start="' + start + '"' : ''; 20151cb0ef41Sopenharmony_ci return '<' + type + startatt + '>\n' + body + '</' + type + '>\n'; 20161cb0ef41Sopenharmony_ci }; 20171cb0ef41Sopenharmony_ci 20181cb0ef41Sopenharmony_ci _proto.listitem = function listitem(text) { 20191cb0ef41Sopenharmony_ci return '<li>' + text + '</li>\n'; 20201cb0ef41Sopenharmony_ci }; 20211cb0ef41Sopenharmony_ci 20221cb0ef41Sopenharmony_ci _proto.checkbox = function checkbox(checked) { 20231cb0ef41Sopenharmony_ci return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> '; 20241cb0ef41Sopenharmony_ci }; 20251cb0ef41Sopenharmony_ci 20261cb0ef41Sopenharmony_ci _proto.paragraph = function paragraph(text) { 20271cb0ef41Sopenharmony_ci return '<p>' + text + '</p>\n'; 20281cb0ef41Sopenharmony_ci }; 20291cb0ef41Sopenharmony_ci 20301cb0ef41Sopenharmony_ci _proto.table = function table(header, body) { 20311cb0ef41Sopenharmony_ci if (body) body = '<tbody>' + body + '</tbody>'; 20321cb0ef41Sopenharmony_ci return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n'; 20331cb0ef41Sopenharmony_ci }; 20341cb0ef41Sopenharmony_ci 20351cb0ef41Sopenharmony_ci _proto.tablerow = function tablerow(content) { 20361cb0ef41Sopenharmony_ci return '<tr>\n' + content + '</tr>\n'; 20371cb0ef41Sopenharmony_ci }; 20381cb0ef41Sopenharmony_ci 20391cb0ef41Sopenharmony_ci _proto.tablecell = function tablecell(content, flags) { 20401cb0ef41Sopenharmony_ci var type = flags.header ? 'th' : 'td'; 20411cb0ef41Sopenharmony_ci var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>'; 20421cb0ef41Sopenharmony_ci return tag + content + '</' + type + '>\n'; 20431cb0ef41Sopenharmony_ci } // span level renderer 20441cb0ef41Sopenharmony_ci ; 20451cb0ef41Sopenharmony_ci 20461cb0ef41Sopenharmony_ci _proto.strong = function strong(text) { 20471cb0ef41Sopenharmony_ci return '<strong>' + text + '</strong>'; 20481cb0ef41Sopenharmony_ci }; 20491cb0ef41Sopenharmony_ci 20501cb0ef41Sopenharmony_ci _proto.em = function em(text) { 20511cb0ef41Sopenharmony_ci return '<em>' + text + '</em>'; 20521cb0ef41Sopenharmony_ci }; 20531cb0ef41Sopenharmony_ci 20541cb0ef41Sopenharmony_ci _proto.codespan = function codespan(text) { 20551cb0ef41Sopenharmony_ci return '<code>' + text + '</code>'; 20561cb0ef41Sopenharmony_ci }; 20571cb0ef41Sopenharmony_ci 20581cb0ef41Sopenharmony_ci _proto.br = function br() { 20591cb0ef41Sopenharmony_ci return this.options.xhtml ? '<br/>' : '<br>'; 20601cb0ef41Sopenharmony_ci }; 20611cb0ef41Sopenharmony_ci 20621cb0ef41Sopenharmony_ci _proto.del = function del(text) { 20631cb0ef41Sopenharmony_ci return '<del>' + text + '</del>'; 20641cb0ef41Sopenharmony_ci }; 20651cb0ef41Sopenharmony_ci 20661cb0ef41Sopenharmony_ci _proto.link = function link(href, title, text) { 20671cb0ef41Sopenharmony_ci href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); 20681cb0ef41Sopenharmony_ci 20691cb0ef41Sopenharmony_ci if (href === null) { 20701cb0ef41Sopenharmony_ci return text; 20711cb0ef41Sopenharmony_ci } 20721cb0ef41Sopenharmony_ci 20731cb0ef41Sopenharmony_ci var out = '<a href="' + escape$1(href) + '"'; 20741cb0ef41Sopenharmony_ci 20751cb0ef41Sopenharmony_ci if (title) { 20761cb0ef41Sopenharmony_ci out += ' title="' + title + '"'; 20771cb0ef41Sopenharmony_ci } 20781cb0ef41Sopenharmony_ci 20791cb0ef41Sopenharmony_ci out += '>' + text + '</a>'; 20801cb0ef41Sopenharmony_ci return out; 20811cb0ef41Sopenharmony_ci }; 20821cb0ef41Sopenharmony_ci 20831cb0ef41Sopenharmony_ci _proto.image = function image(href, title, text) { 20841cb0ef41Sopenharmony_ci href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); 20851cb0ef41Sopenharmony_ci 20861cb0ef41Sopenharmony_ci if (href === null) { 20871cb0ef41Sopenharmony_ci return text; 20881cb0ef41Sopenharmony_ci } 20891cb0ef41Sopenharmony_ci 20901cb0ef41Sopenharmony_ci var out = '<img src="' + href + '" alt="' + text + '"'; 20911cb0ef41Sopenharmony_ci 20921cb0ef41Sopenharmony_ci if (title) { 20931cb0ef41Sopenharmony_ci out += ' title="' + title + '"'; 20941cb0ef41Sopenharmony_ci } 20951cb0ef41Sopenharmony_ci 20961cb0ef41Sopenharmony_ci out += this.options.xhtml ? '/>' : '>'; 20971cb0ef41Sopenharmony_ci return out; 20981cb0ef41Sopenharmony_ci }; 20991cb0ef41Sopenharmony_ci 21001cb0ef41Sopenharmony_ci _proto.text = function text(_text) { 21011cb0ef41Sopenharmony_ci return _text; 21021cb0ef41Sopenharmony_ci }; 21031cb0ef41Sopenharmony_ci 21041cb0ef41Sopenharmony_ci return Renderer; 21051cb0ef41Sopenharmony_ci }(); 21061cb0ef41Sopenharmony_ci 21071cb0ef41Sopenharmony_ci /** 21081cb0ef41Sopenharmony_ci * TextRenderer 21091cb0ef41Sopenharmony_ci * returns only the textual part of the token 21101cb0ef41Sopenharmony_ci */ 21111cb0ef41Sopenharmony_ci 21121cb0ef41Sopenharmony_ci var TextRenderer_1 = /*#__PURE__*/function () { 21131cb0ef41Sopenharmony_ci function TextRenderer() {} 21141cb0ef41Sopenharmony_ci 21151cb0ef41Sopenharmony_ci var _proto = TextRenderer.prototype; 21161cb0ef41Sopenharmony_ci 21171cb0ef41Sopenharmony_ci // no need for block level renderers 21181cb0ef41Sopenharmony_ci _proto.strong = function strong(text) { 21191cb0ef41Sopenharmony_ci return text; 21201cb0ef41Sopenharmony_ci }; 21211cb0ef41Sopenharmony_ci 21221cb0ef41Sopenharmony_ci _proto.em = function em(text) { 21231cb0ef41Sopenharmony_ci return text; 21241cb0ef41Sopenharmony_ci }; 21251cb0ef41Sopenharmony_ci 21261cb0ef41Sopenharmony_ci _proto.codespan = function codespan(text) { 21271cb0ef41Sopenharmony_ci return text; 21281cb0ef41Sopenharmony_ci }; 21291cb0ef41Sopenharmony_ci 21301cb0ef41Sopenharmony_ci _proto.del = function del(text) { 21311cb0ef41Sopenharmony_ci return text; 21321cb0ef41Sopenharmony_ci }; 21331cb0ef41Sopenharmony_ci 21341cb0ef41Sopenharmony_ci _proto.html = function html(text) { 21351cb0ef41Sopenharmony_ci return text; 21361cb0ef41Sopenharmony_ci }; 21371cb0ef41Sopenharmony_ci 21381cb0ef41Sopenharmony_ci _proto.text = function text(_text) { 21391cb0ef41Sopenharmony_ci return _text; 21401cb0ef41Sopenharmony_ci }; 21411cb0ef41Sopenharmony_ci 21421cb0ef41Sopenharmony_ci _proto.link = function link(href, title, text) { 21431cb0ef41Sopenharmony_ci return '' + text; 21441cb0ef41Sopenharmony_ci }; 21451cb0ef41Sopenharmony_ci 21461cb0ef41Sopenharmony_ci _proto.image = function image(href, title, text) { 21471cb0ef41Sopenharmony_ci return '' + text; 21481cb0ef41Sopenharmony_ci }; 21491cb0ef41Sopenharmony_ci 21501cb0ef41Sopenharmony_ci _proto.br = function br() { 21511cb0ef41Sopenharmony_ci return ''; 21521cb0ef41Sopenharmony_ci }; 21531cb0ef41Sopenharmony_ci 21541cb0ef41Sopenharmony_ci return TextRenderer; 21551cb0ef41Sopenharmony_ci }(); 21561cb0ef41Sopenharmony_ci 21571cb0ef41Sopenharmony_ci /** 21581cb0ef41Sopenharmony_ci * Slugger generates header id 21591cb0ef41Sopenharmony_ci */ 21601cb0ef41Sopenharmony_ci 21611cb0ef41Sopenharmony_ci var Slugger_1 = /*#__PURE__*/function () { 21621cb0ef41Sopenharmony_ci function Slugger() { 21631cb0ef41Sopenharmony_ci this.seen = {}; 21641cb0ef41Sopenharmony_ci } 21651cb0ef41Sopenharmony_ci 21661cb0ef41Sopenharmony_ci var _proto = Slugger.prototype; 21671cb0ef41Sopenharmony_ci 21681cb0ef41Sopenharmony_ci _proto.serialize = function serialize(value) { 21691cb0ef41Sopenharmony_ci return value.toLowerCase().trim() // remove html tags 21701cb0ef41Sopenharmony_ci .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars 21711cb0ef41Sopenharmony_ci .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-'); 21721cb0ef41Sopenharmony_ci } 21731cb0ef41Sopenharmony_ci /** 21741cb0ef41Sopenharmony_ci * Finds the next safe (unique) slug to use 21751cb0ef41Sopenharmony_ci */ 21761cb0ef41Sopenharmony_ci ; 21771cb0ef41Sopenharmony_ci 21781cb0ef41Sopenharmony_ci _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) { 21791cb0ef41Sopenharmony_ci var slug = originalSlug; 21801cb0ef41Sopenharmony_ci var occurenceAccumulator = 0; 21811cb0ef41Sopenharmony_ci 21821cb0ef41Sopenharmony_ci if (this.seen.hasOwnProperty(slug)) { 21831cb0ef41Sopenharmony_ci occurenceAccumulator = this.seen[originalSlug]; 21841cb0ef41Sopenharmony_ci 21851cb0ef41Sopenharmony_ci do { 21861cb0ef41Sopenharmony_ci occurenceAccumulator++; 21871cb0ef41Sopenharmony_ci slug = originalSlug + '-' + occurenceAccumulator; 21881cb0ef41Sopenharmony_ci } while (this.seen.hasOwnProperty(slug)); 21891cb0ef41Sopenharmony_ci } 21901cb0ef41Sopenharmony_ci 21911cb0ef41Sopenharmony_ci if (!isDryRun) { 21921cb0ef41Sopenharmony_ci this.seen[originalSlug] = occurenceAccumulator; 21931cb0ef41Sopenharmony_ci this.seen[slug] = 0; 21941cb0ef41Sopenharmony_ci } 21951cb0ef41Sopenharmony_ci 21961cb0ef41Sopenharmony_ci return slug; 21971cb0ef41Sopenharmony_ci } 21981cb0ef41Sopenharmony_ci /** 21991cb0ef41Sopenharmony_ci * Convert string to unique id 22001cb0ef41Sopenharmony_ci * @param {object} options 22011cb0ef41Sopenharmony_ci * @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator. 22021cb0ef41Sopenharmony_ci */ 22031cb0ef41Sopenharmony_ci ; 22041cb0ef41Sopenharmony_ci 22051cb0ef41Sopenharmony_ci _proto.slug = function slug(value, options) { 22061cb0ef41Sopenharmony_ci if (options === void 0) { 22071cb0ef41Sopenharmony_ci options = {}; 22081cb0ef41Sopenharmony_ci } 22091cb0ef41Sopenharmony_ci 22101cb0ef41Sopenharmony_ci var slug = this.serialize(value); 22111cb0ef41Sopenharmony_ci return this.getNextSafeSlug(slug, options.dryrun); 22121cb0ef41Sopenharmony_ci }; 22131cb0ef41Sopenharmony_ci 22141cb0ef41Sopenharmony_ci return Slugger; 22151cb0ef41Sopenharmony_ci }(); 22161cb0ef41Sopenharmony_ci 22171cb0ef41Sopenharmony_ci var Renderer$1 = Renderer_1; 22181cb0ef41Sopenharmony_ci var TextRenderer$1 = TextRenderer_1; 22191cb0ef41Sopenharmony_ci var Slugger$1 = Slugger_1; 22201cb0ef41Sopenharmony_ci var defaults$1 = defaults$5.exports.defaults; 22211cb0ef41Sopenharmony_ci var unescape = helpers.unescape; 22221cb0ef41Sopenharmony_ci /** 22231cb0ef41Sopenharmony_ci * Parsing & Compiling 22241cb0ef41Sopenharmony_ci */ 22251cb0ef41Sopenharmony_ci 22261cb0ef41Sopenharmony_ci var Parser_1 = /*#__PURE__*/function () { 22271cb0ef41Sopenharmony_ci function Parser(options) { 22281cb0ef41Sopenharmony_ci this.options = options || defaults$1; 22291cb0ef41Sopenharmony_ci this.options.renderer = this.options.renderer || new Renderer$1(); 22301cb0ef41Sopenharmony_ci this.renderer = this.options.renderer; 22311cb0ef41Sopenharmony_ci this.renderer.options = this.options; 22321cb0ef41Sopenharmony_ci this.textRenderer = new TextRenderer$1(); 22331cb0ef41Sopenharmony_ci this.slugger = new Slugger$1(); 22341cb0ef41Sopenharmony_ci } 22351cb0ef41Sopenharmony_ci /** 22361cb0ef41Sopenharmony_ci * Static Parse Method 22371cb0ef41Sopenharmony_ci */ 22381cb0ef41Sopenharmony_ci 22391cb0ef41Sopenharmony_ci 22401cb0ef41Sopenharmony_ci Parser.parse = function parse(tokens, options) { 22411cb0ef41Sopenharmony_ci var parser = new Parser(options); 22421cb0ef41Sopenharmony_ci return parser.parse(tokens); 22431cb0ef41Sopenharmony_ci } 22441cb0ef41Sopenharmony_ci /** 22451cb0ef41Sopenharmony_ci * Static Parse Inline Method 22461cb0ef41Sopenharmony_ci */ 22471cb0ef41Sopenharmony_ci ; 22481cb0ef41Sopenharmony_ci 22491cb0ef41Sopenharmony_ci Parser.parseInline = function parseInline(tokens, options) { 22501cb0ef41Sopenharmony_ci var parser = new Parser(options); 22511cb0ef41Sopenharmony_ci return parser.parseInline(tokens); 22521cb0ef41Sopenharmony_ci } 22531cb0ef41Sopenharmony_ci /** 22541cb0ef41Sopenharmony_ci * Parse Loop 22551cb0ef41Sopenharmony_ci */ 22561cb0ef41Sopenharmony_ci ; 22571cb0ef41Sopenharmony_ci 22581cb0ef41Sopenharmony_ci var _proto = Parser.prototype; 22591cb0ef41Sopenharmony_ci 22601cb0ef41Sopenharmony_ci _proto.parse = function parse(tokens, top) { 22611cb0ef41Sopenharmony_ci if (top === void 0) { 22621cb0ef41Sopenharmony_ci top = true; 22631cb0ef41Sopenharmony_ci } 22641cb0ef41Sopenharmony_ci 22651cb0ef41Sopenharmony_ci var out = '', 22661cb0ef41Sopenharmony_ci i, 22671cb0ef41Sopenharmony_ci j, 22681cb0ef41Sopenharmony_ci k, 22691cb0ef41Sopenharmony_ci l2, 22701cb0ef41Sopenharmony_ci l3, 22711cb0ef41Sopenharmony_ci row, 22721cb0ef41Sopenharmony_ci cell, 22731cb0ef41Sopenharmony_ci header, 22741cb0ef41Sopenharmony_ci body, 22751cb0ef41Sopenharmony_ci token, 22761cb0ef41Sopenharmony_ci ordered, 22771cb0ef41Sopenharmony_ci start, 22781cb0ef41Sopenharmony_ci loose, 22791cb0ef41Sopenharmony_ci itemBody, 22801cb0ef41Sopenharmony_ci item, 22811cb0ef41Sopenharmony_ci checked, 22821cb0ef41Sopenharmony_ci task, 22831cb0ef41Sopenharmony_ci checkbox, 22841cb0ef41Sopenharmony_ci ret; 22851cb0ef41Sopenharmony_ci var l = tokens.length; 22861cb0ef41Sopenharmony_ci 22871cb0ef41Sopenharmony_ci for (i = 0; i < l; i++) { 22881cb0ef41Sopenharmony_ci token = tokens[i]; // Run any renderer extensions 22891cb0ef41Sopenharmony_ci 22901cb0ef41Sopenharmony_ci if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { 22911cb0ef41Sopenharmony_ci ret = this.options.extensions.renderers[token.type].call({ 22921cb0ef41Sopenharmony_ci parser: this 22931cb0ef41Sopenharmony_ci }, token); 22941cb0ef41Sopenharmony_ci 22951cb0ef41Sopenharmony_ci if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) { 22961cb0ef41Sopenharmony_ci out += ret || ''; 22971cb0ef41Sopenharmony_ci continue; 22981cb0ef41Sopenharmony_ci } 22991cb0ef41Sopenharmony_ci } 23001cb0ef41Sopenharmony_ci 23011cb0ef41Sopenharmony_ci switch (token.type) { 23021cb0ef41Sopenharmony_ci case 'space': 23031cb0ef41Sopenharmony_ci { 23041cb0ef41Sopenharmony_ci continue; 23051cb0ef41Sopenharmony_ci } 23061cb0ef41Sopenharmony_ci 23071cb0ef41Sopenharmony_ci case 'hr': 23081cb0ef41Sopenharmony_ci { 23091cb0ef41Sopenharmony_ci out += this.renderer.hr(); 23101cb0ef41Sopenharmony_ci continue; 23111cb0ef41Sopenharmony_ci } 23121cb0ef41Sopenharmony_ci 23131cb0ef41Sopenharmony_ci case 'heading': 23141cb0ef41Sopenharmony_ci { 23151cb0ef41Sopenharmony_ci out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger); 23161cb0ef41Sopenharmony_ci continue; 23171cb0ef41Sopenharmony_ci } 23181cb0ef41Sopenharmony_ci 23191cb0ef41Sopenharmony_ci case 'code': 23201cb0ef41Sopenharmony_ci { 23211cb0ef41Sopenharmony_ci out += this.renderer.code(token.text, token.lang, token.escaped); 23221cb0ef41Sopenharmony_ci continue; 23231cb0ef41Sopenharmony_ci } 23241cb0ef41Sopenharmony_ci 23251cb0ef41Sopenharmony_ci case 'table': 23261cb0ef41Sopenharmony_ci { 23271cb0ef41Sopenharmony_ci header = ''; // header 23281cb0ef41Sopenharmony_ci 23291cb0ef41Sopenharmony_ci cell = ''; 23301cb0ef41Sopenharmony_ci l2 = token.header.length; 23311cb0ef41Sopenharmony_ci 23321cb0ef41Sopenharmony_ci for (j = 0; j < l2; j++) { 23331cb0ef41Sopenharmony_ci cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), { 23341cb0ef41Sopenharmony_ci header: true, 23351cb0ef41Sopenharmony_ci align: token.align[j] 23361cb0ef41Sopenharmony_ci }); 23371cb0ef41Sopenharmony_ci } 23381cb0ef41Sopenharmony_ci 23391cb0ef41Sopenharmony_ci header += this.renderer.tablerow(cell); 23401cb0ef41Sopenharmony_ci body = ''; 23411cb0ef41Sopenharmony_ci l2 = token.rows.length; 23421cb0ef41Sopenharmony_ci 23431cb0ef41Sopenharmony_ci for (j = 0; j < l2; j++) { 23441cb0ef41Sopenharmony_ci row = token.rows[j]; 23451cb0ef41Sopenharmony_ci cell = ''; 23461cb0ef41Sopenharmony_ci l3 = row.length; 23471cb0ef41Sopenharmony_ci 23481cb0ef41Sopenharmony_ci for (k = 0; k < l3; k++) { 23491cb0ef41Sopenharmony_ci cell += this.renderer.tablecell(this.parseInline(row[k].tokens), { 23501cb0ef41Sopenharmony_ci header: false, 23511cb0ef41Sopenharmony_ci align: token.align[k] 23521cb0ef41Sopenharmony_ci }); 23531cb0ef41Sopenharmony_ci } 23541cb0ef41Sopenharmony_ci 23551cb0ef41Sopenharmony_ci body += this.renderer.tablerow(cell); 23561cb0ef41Sopenharmony_ci } 23571cb0ef41Sopenharmony_ci 23581cb0ef41Sopenharmony_ci out += this.renderer.table(header, body); 23591cb0ef41Sopenharmony_ci continue; 23601cb0ef41Sopenharmony_ci } 23611cb0ef41Sopenharmony_ci 23621cb0ef41Sopenharmony_ci case 'blockquote': 23631cb0ef41Sopenharmony_ci { 23641cb0ef41Sopenharmony_ci body = this.parse(token.tokens); 23651cb0ef41Sopenharmony_ci out += this.renderer.blockquote(body); 23661cb0ef41Sopenharmony_ci continue; 23671cb0ef41Sopenharmony_ci } 23681cb0ef41Sopenharmony_ci 23691cb0ef41Sopenharmony_ci case 'list': 23701cb0ef41Sopenharmony_ci { 23711cb0ef41Sopenharmony_ci ordered = token.ordered; 23721cb0ef41Sopenharmony_ci start = token.start; 23731cb0ef41Sopenharmony_ci loose = token.loose; 23741cb0ef41Sopenharmony_ci l2 = token.items.length; 23751cb0ef41Sopenharmony_ci body = ''; 23761cb0ef41Sopenharmony_ci 23771cb0ef41Sopenharmony_ci for (j = 0; j < l2; j++) { 23781cb0ef41Sopenharmony_ci item = token.items[j]; 23791cb0ef41Sopenharmony_ci checked = item.checked; 23801cb0ef41Sopenharmony_ci task = item.task; 23811cb0ef41Sopenharmony_ci itemBody = ''; 23821cb0ef41Sopenharmony_ci 23831cb0ef41Sopenharmony_ci if (item.task) { 23841cb0ef41Sopenharmony_ci checkbox = this.renderer.checkbox(checked); 23851cb0ef41Sopenharmony_ci 23861cb0ef41Sopenharmony_ci if (loose) { 23871cb0ef41Sopenharmony_ci if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') { 23881cb0ef41Sopenharmony_ci item.tokens[0].text = checkbox + ' ' + item.tokens[0].text; 23891cb0ef41Sopenharmony_ci 23901cb0ef41Sopenharmony_ci if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') { 23911cb0ef41Sopenharmony_ci item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text; 23921cb0ef41Sopenharmony_ci } 23931cb0ef41Sopenharmony_ci } else { 23941cb0ef41Sopenharmony_ci item.tokens.unshift({ 23951cb0ef41Sopenharmony_ci type: 'text', 23961cb0ef41Sopenharmony_ci text: checkbox 23971cb0ef41Sopenharmony_ci }); 23981cb0ef41Sopenharmony_ci } 23991cb0ef41Sopenharmony_ci } else { 24001cb0ef41Sopenharmony_ci itemBody += checkbox; 24011cb0ef41Sopenharmony_ci } 24021cb0ef41Sopenharmony_ci } 24031cb0ef41Sopenharmony_ci 24041cb0ef41Sopenharmony_ci itemBody += this.parse(item.tokens, loose); 24051cb0ef41Sopenharmony_ci body += this.renderer.listitem(itemBody, task, checked); 24061cb0ef41Sopenharmony_ci } 24071cb0ef41Sopenharmony_ci 24081cb0ef41Sopenharmony_ci out += this.renderer.list(body, ordered, start); 24091cb0ef41Sopenharmony_ci continue; 24101cb0ef41Sopenharmony_ci } 24111cb0ef41Sopenharmony_ci 24121cb0ef41Sopenharmony_ci case 'html': 24131cb0ef41Sopenharmony_ci { 24141cb0ef41Sopenharmony_ci // TODO parse inline content if parameter markdown=1 24151cb0ef41Sopenharmony_ci out += this.renderer.html(token.text); 24161cb0ef41Sopenharmony_ci continue; 24171cb0ef41Sopenharmony_ci } 24181cb0ef41Sopenharmony_ci 24191cb0ef41Sopenharmony_ci case 'paragraph': 24201cb0ef41Sopenharmony_ci { 24211cb0ef41Sopenharmony_ci out += this.renderer.paragraph(this.parseInline(token.tokens)); 24221cb0ef41Sopenharmony_ci continue; 24231cb0ef41Sopenharmony_ci } 24241cb0ef41Sopenharmony_ci 24251cb0ef41Sopenharmony_ci case 'text': 24261cb0ef41Sopenharmony_ci { 24271cb0ef41Sopenharmony_ci body = token.tokens ? this.parseInline(token.tokens) : token.text; 24281cb0ef41Sopenharmony_ci 24291cb0ef41Sopenharmony_ci while (i + 1 < l && tokens[i + 1].type === 'text') { 24301cb0ef41Sopenharmony_ci token = tokens[++i]; 24311cb0ef41Sopenharmony_ci body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text); 24321cb0ef41Sopenharmony_ci } 24331cb0ef41Sopenharmony_ci 24341cb0ef41Sopenharmony_ci out += top ? this.renderer.paragraph(body) : body; 24351cb0ef41Sopenharmony_ci continue; 24361cb0ef41Sopenharmony_ci } 24371cb0ef41Sopenharmony_ci 24381cb0ef41Sopenharmony_ci default: 24391cb0ef41Sopenharmony_ci { 24401cb0ef41Sopenharmony_ci var errMsg = 'Token with "' + token.type + '" type was not found.'; 24411cb0ef41Sopenharmony_ci 24421cb0ef41Sopenharmony_ci if (this.options.silent) { 24431cb0ef41Sopenharmony_ci console.error(errMsg); 24441cb0ef41Sopenharmony_ci return; 24451cb0ef41Sopenharmony_ci } else { 24461cb0ef41Sopenharmony_ci throw new Error(errMsg); 24471cb0ef41Sopenharmony_ci } 24481cb0ef41Sopenharmony_ci } 24491cb0ef41Sopenharmony_ci } 24501cb0ef41Sopenharmony_ci } 24511cb0ef41Sopenharmony_ci 24521cb0ef41Sopenharmony_ci return out; 24531cb0ef41Sopenharmony_ci } 24541cb0ef41Sopenharmony_ci /** 24551cb0ef41Sopenharmony_ci * Parse Inline Tokens 24561cb0ef41Sopenharmony_ci */ 24571cb0ef41Sopenharmony_ci ; 24581cb0ef41Sopenharmony_ci 24591cb0ef41Sopenharmony_ci _proto.parseInline = function parseInline(tokens, renderer) { 24601cb0ef41Sopenharmony_ci renderer = renderer || this.renderer; 24611cb0ef41Sopenharmony_ci var out = '', 24621cb0ef41Sopenharmony_ci i, 24631cb0ef41Sopenharmony_ci token, 24641cb0ef41Sopenharmony_ci ret; 24651cb0ef41Sopenharmony_ci var l = tokens.length; 24661cb0ef41Sopenharmony_ci 24671cb0ef41Sopenharmony_ci for (i = 0; i < l; i++) { 24681cb0ef41Sopenharmony_ci token = tokens[i]; // Run any renderer extensions 24691cb0ef41Sopenharmony_ci 24701cb0ef41Sopenharmony_ci if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { 24711cb0ef41Sopenharmony_ci ret = this.options.extensions.renderers[token.type].call({ 24721cb0ef41Sopenharmony_ci parser: this 24731cb0ef41Sopenharmony_ci }, token); 24741cb0ef41Sopenharmony_ci 24751cb0ef41Sopenharmony_ci if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) { 24761cb0ef41Sopenharmony_ci out += ret || ''; 24771cb0ef41Sopenharmony_ci continue; 24781cb0ef41Sopenharmony_ci } 24791cb0ef41Sopenharmony_ci } 24801cb0ef41Sopenharmony_ci 24811cb0ef41Sopenharmony_ci switch (token.type) { 24821cb0ef41Sopenharmony_ci case 'escape': 24831cb0ef41Sopenharmony_ci { 24841cb0ef41Sopenharmony_ci out += renderer.text(token.text); 24851cb0ef41Sopenharmony_ci break; 24861cb0ef41Sopenharmony_ci } 24871cb0ef41Sopenharmony_ci 24881cb0ef41Sopenharmony_ci case 'html': 24891cb0ef41Sopenharmony_ci { 24901cb0ef41Sopenharmony_ci out += renderer.html(token.text); 24911cb0ef41Sopenharmony_ci break; 24921cb0ef41Sopenharmony_ci } 24931cb0ef41Sopenharmony_ci 24941cb0ef41Sopenharmony_ci case 'link': 24951cb0ef41Sopenharmony_ci { 24961cb0ef41Sopenharmony_ci out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer)); 24971cb0ef41Sopenharmony_ci break; 24981cb0ef41Sopenharmony_ci } 24991cb0ef41Sopenharmony_ci 25001cb0ef41Sopenharmony_ci case 'image': 25011cb0ef41Sopenharmony_ci { 25021cb0ef41Sopenharmony_ci out += renderer.image(token.href, token.title, token.text); 25031cb0ef41Sopenharmony_ci break; 25041cb0ef41Sopenharmony_ci } 25051cb0ef41Sopenharmony_ci 25061cb0ef41Sopenharmony_ci case 'strong': 25071cb0ef41Sopenharmony_ci { 25081cb0ef41Sopenharmony_ci out += renderer.strong(this.parseInline(token.tokens, renderer)); 25091cb0ef41Sopenharmony_ci break; 25101cb0ef41Sopenharmony_ci } 25111cb0ef41Sopenharmony_ci 25121cb0ef41Sopenharmony_ci case 'em': 25131cb0ef41Sopenharmony_ci { 25141cb0ef41Sopenharmony_ci out += renderer.em(this.parseInline(token.tokens, renderer)); 25151cb0ef41Sopenharmony_ci break; 25161cb0ef41Sopenharmony_ci } 25171cb0ef41Sopenharmony_ci 25181cb0ef41Sopenharmony_ci case 'codespan': 25191cb0ef41Sopenharmony_ci { 25201cb0ef41Sopenharmony_ci out += renderer.codespan(token.text); 25211cb0ef41Sopenharmony_ci break; 25221cb0ef41Sopenharmony_ci } 25231cb0ef41Sopenharmony_ci 25241cb0ef41Sopenharmony_ci case 'br': 25251cb0ef41Sopenharmony_ci { 25261cb0ef41Sopenharmony_ci out += renderer.br(); 25271cb0ef41Sopenharmony_ci break; 25281cb0ef41Sopenharmony_ci } 25291cb0ef41Sopenharmony_ci 25301cb0ef41Sopenharmony_ci case 'del': 25311cb0ef41Sopenharmony_ci { 25321cb0ef41Sopenharmony_ci out += renderer.del(this.parseInline(token.tokens, renderer)); 25331cb0ef41Sopenharmony_ci break; 25341cb0ef41Sopenharmony_ci } 25351cb0ef41Sopenharmony_ci 25361cb0ef41Sopenharmony_ci case 'text': 25371cb0ef41Sopenharmony_ci { 25381cb0ef41Sopenharmony_ci out += renderer.text(token.text); 25391cb0ef41Sopenharmony_ci break; 25401cb0ef41Sopenharmony_ci } 25411cb0ef41Sopenharmony_ci 25421cb0ef41Sopenharmony_ci default: 25431cb0ef41Sopenharmony_ci { 25441cb0ef41Sopenharmony_ci var errMsg = 'Token with "' + token.type + '" type was not found.'; 25451cb0ef41Sopenharmony_ci 25461cb0ef41Sopenharmony_ci if (this.options.silent) { 25471cb0ef41Sopenharmony_ci console.error(errMsg); 25481cb0ef41Sopenharmony_ci return; 25491cb0ef41Sopenharmony_ci } else { 25501cb0ef41Sopenharmony_ci throw new Error(errMsg); 25511cb0ef41Sopenharmony_ci } 25521cb0ef41Sopenharmony_ci } 25531cb0ef41Sopenharmony_ci } 25541cb0ef41Sopenharmony_ci } 25551cb0ef41Sopenharmony_ci 25561cb0ef41Sopenharmony_ci return out; 25571cb0ef41Sopenharmony_ci }; 25581cb0ef41Sopenharmony_ci 25591cb0ef41Sopenharmony_ci return Parser; 25601cb0ef41Sopenharmony_ci }(); 25611cb0ef41Sopenharmony_ci 25621cb0ef41Sopenharmony_ci var Lexer = Lexer_1; 25631cb0ef41Sopenharmony_ci var Parser = Parser_1; 25641cb0ef41Sopenharmony_ci var Tokenizer = Tokenizer_1; 25651cb0ef41Sopenharmony_ci var Renderer = Renderer_1; 25661cb0ef41Sopenharmony_ci var TextRenderer = TextRenderer_1; 25671cb0ef41Sopenharmony_ci var Slugger = Slugger_1; 25681cb0ef41Sopenharmony_ci var merge = helpers.merge, 25691cb0ef41Sopenharmony_ci checkSanitizeDeprecation = helpers.checkSanitizeDeprecation, 25701cb0ef41Sopenharmony_ci escape = helpers.escape; 25711cb0ef41Sopenharmony_ci var getDefaults = defaults$5.exports.getDefaults, 25721cb0ef41Sopenharmony_ci changeDefaults = defaults$5.exports.changeDefaults, 25731cb0ef41Sopenharmony_ci defaults = defaults$5.exports.defaults; 25741cb0ef41Sopenharmony_ci /** 25751cb0ef41Sopenharmony_ci * Marked 25761cb0ef41Sopenharmony_ci */ 25771cb0ef41Sopenharmony_ci 25781cb0ef41Sopenharmony_ci function marked(src, opt, callback) { 25791cb0ef41Sopenharmony_ci // throw error in case of non string input 25801cb0ef41Sopenharmony_ci if (typeof src === 'undefined' || src === null) { 25811cb0ef41Sopenharmony_ci throw new Error('marked(): input parameter is undefined or null'); 25821cb0ef41Sopenharmony_ci } 25831cb0ef41Sopenharmony_ci 25841cb0ef41Sopenharmony_ci if (typeof src !== 'string') { 25851cb0ef41Sopenharmony_ci throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected'); 25861cb0ef41Sopenharmony_ci } 25871cb0ef41Sopenharmony_ci 25881cb0ef41Sopenharmony_ci if (typeof opt === 'function') { 25891cb0ef41Sopenharmony_ci callback = opt; 25901cb0ef41Sopenharmony_ci opt = null; 25911cb0ef41Sopenharmony_ci } 25921cb0ef41Sopenharmony_ci 25931cb0ef41Sopenharmony_ci opt = merge({}, marked.defaults, opt || {}); 25941cb0ef41Sopenharmony_ci checkSanitizeDeprecation(opt); 25951cb0ef41Sopenharmony_ci 25961cb0ef41Sopenharmony_ci if (callback) { 25971cb0ef41Sopenharmony_ci var highlight = opt.highlight; 25981cb0ef41Sopenharmony_ci var tokens; 25991cb0ef41Sopenharmony_ci 26001cb0ef41Sopenharmony_ci try { 26011cb0ef41Sopenharmony_ci tokens = Lexer.lex(src, opt); 26021cb0ef41Sopenharmony_ci } catch (e) { 26031cb0ef41Sopenharmony_ci return callback(e); 26041cb0ef41Sopenharmony_ci } 26051cb0ef41Sopenharmony_ci 26061cb0ef41Sopenharmony_ci var done = function done(err) { 26071cb0ef41Sopenharmony_ci var out; 26081cb0ef41Sopenharmony_ci 26091cb0ef41Sopenharmony_ci if (!err) { 26101cb0ef41Sopenharmony_ci try { 26111cb0ef41Sopenharmony_ci if (opt.walkTokens) { 26121cb0ef41Sopenharmony_ci marked.walkTokens(tokens, opt.walkTokens); 26131cb0ef41Sopenharmony_ci } 26141cb0ef41Sopenharmony_ci 26151cb0ef41Sopenharmony_ci out = Parser.parse(tokens, opt); 26161cb0ef41Sopenharmony_ci } catch (e) { 26171cb0ef41Sopenharmony_ci err = e; 26181cb0ef41Sopenharmony_ci } 26191cb0ef41Sopenharmony_ci } 26201cb0ef41Sopenharmony_ci 26211cb0ef41Sopenharmony_ci opt.highlight = highlight; 26221cb0ef41Sopenharmony_ci return err ? callback(err) : callback(null, out); 26231cb0ef41Sopenharmony_ci }; 26241cb0ef41Sopenharmony_ci 26251cb0ef41Sopenharmony_ci if (!highlight || highlight.length < 3) { 26261cb0ef41Sopenharmony_ci return done(); 26271cb0ef41Sopenharmony_ci } 26281cb0ef41Sopenharmony_ci 26291cb0ef41Sopenharmony_ci delete opt.highlight; 26301cb0ef41Sopenharmony_ci if (!tokens.length) return done(); 26311cb0ef41Sopenharmony_ci var pending = 0; 26321cb0ef41Sopenharmony_ci marked.walkTokens(tokens, function (token) { 26331cb0ef41Sopenharmony_ci if (token.type === 'code') { 26341cb0ef41Sopenharmony_ci pending++; 26351cb0ef41Sopenharmony_ci setTimeout(function () { 26361cb0ef41Sopenharmony_ci highlight(token.text, token.lang, function (err, code) { 26371cb0ef41Sopenharmony_ci if (err) { 26381cb0ef41Sopenharmony_ci return done(err); 26391cb0ef41Sopenharmony_ci } 26401cb0ef41Sopenharmony_ci 26411cb0ef41Sopenharmony_ci if (code != null && code !== token.text) { 26421cb0ef41Sopenharmony_ci token.text = code; 26431cb0ef41Sopenharmony_ci token.escaped = true; 26441cb0ef41Sopenharmony_ci } 26451cb0ef41Sopenharmony_ci 26461cb0ef41Sopenharmony_ci pending--; 26471cb0ef41Sopenharmony_ci 26481cb0ef41Sopenharmony_ci if (pending === 0) { 26491cb0ef41Sopenharmony_ci done(); 26501cb0ef41Sopenharmony_ci } 26511cb0ef41Sopenharmony_ci }); 26521cb0ef41Sopenharmony_ci }, 0); 26531cb0ef41Sopenharmony_ci } 26541cb0ef41Sopenharmony_ci }); 26551cb0ef41Sopenharmony_ci 26561cb0ef41Sopenharmony_ci if (pending === 0) { 26571cb0ef41Sopenharmony_ci done(); 26581cb0ef41Sopenharmony_ci } 26591cb0ef41Sopenharmony_ci 26601cb0ef41Sopenharmony_ci return; 26611cb0ef41Sopenharmony_ci } 26621cb0ef41Sopenharmony_ci 26631cb0ef41Sopenharmony_ci try { 26641cb0ef41Sopenharmony_ci var _tokens = Lexer.lex(src, opt); 26651cb0ef41Sopenharmony_ci 26661cb0ef41Sopenharmony_ci if (opt.walkTokens) { 26671cb0ef41Sopenharmony_ci marked.walkTokens(_tokens, opt.walkTokens); 26681cb0ef41Sopenharmony_ci } 26691cb0ef41Sopenharmony_ci 26701cb0ef41Sopenharmony_ci return Parser.parse(_tokens, opt); 26711cb0ef41Sopenharmony_ci } catch (e) { 26721cb0ef41Sopenharmony_ci e.message += '\nPlease report this to https://github.com/markedjs/marked.'; 26731cb0ef41Sopenharmony_ci 26741cb0ef41Sopenharmony_ci if (opt.silent) { 26751cb0ef41Sopenharmony_ci return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>'; 26761cb0ef41Sopenharmony_ci } 26771cb0ef41Sopenharmony_ci 26781cb0ef41Sopenharmony_ci throw e; 26791cb0ef41Sopenharmony_ci } 26801cb0ef41Sopenharmony_ci } 26811cb0ef41Sopenharmony_ci /** 26821cb0ef41Sopenharmony_ci * Options 26831cb0ef41Sopenharmony_ci */ 26841cb0ef41Sopenharmony_ci 26851cb0ef41Sopenharmony_ci 26861cb0ef41Sopenharmony_ci marked.options = marked.setOptions = function (opt) { 26871cb0ef41Sopenharmony_ci merge(marked.defaults, opt); 26881cb0ef41Sopenharmony_ci changeDefaults(marked.defaults); 26891cb0ef41Sopenharmony_ci return marked; 26901cb0ef41Sopenharmony_ci }; 26911cb0ef41Sopenharmony_ci 26921cb0ef41Sopenharmony_ci marked.getDefaults = getDefaults; 26931cb0ef41Sopenharmony_ci marked.defaults = defaults; 26941cb0ef41Sopenharmony_ci /** 26951cb0ef41Sopenharmony_ci * Use Extension 26961cb0ef41Sopenharmony_ci */ 26971cb0ef41Sopenharmony_ci 26981cb0ef41Sopenharmony_ci marked.use = function () { 26991cb0ef41Sopenharmony_ci var _this = this; 27001cb0ef41Sopenharmony_ci 27011cb0ef41Sopenharmony_ci for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 27021cb0ef41Sopenharmony_ci args[_key] = arguments[_key]; 27031cb0ef41Sopenharmony_ci } 27041cb0ef41Sopenharmony_ci 27051cb0ef41Sopenharmony_ci var opts = merge.apply(void 0, [{}].concat(args)); 27061cb0ef41Sopenharmony_ci var extensions = marked.defaults.extensions || { 27071cb0ef41Sopenharmony_ci renderers: {}, 27081cb0ef41Sopenharmony_ci childTokens: {} 27091cb0ef41Sopenharmony_ci }; 27101cb0ef41Sopenharmony_ci var hasExtensions; 27111cb0ef41Sopenharmony_ci args.forEach(function (pack) { 27121cb0ef41Sopenharmony_ci // ==-- Parse "addon" extensions --== // 27131cb0ef41Sopenharmony_ci if (pack.extensions) { 27141cb0ef41Sopenharmony_ci hasExtensions = true; 27151cb0ef41Sopenharmony_ci pack.extensions.forEach(function (ext) { 27161cb0ef41Sopenharmony_ci if (!ext.name) { 27171cb0ef41Sopenharmony_ci throw new Error('extension name required'); 27181cb0ef41Sopenharmony_ci } 27191cb0ef41Sopenharmony_ci 27201cb0ef41Sopenharmony_ci if (ext.renderer) { 27211cb0ef41Sopenharmony_ci // Renderer extensions 27221cb0ef41Sopenharmony_ci var prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null; 27231cb0ef41Sopenharmony_ci 27241cb0ef41Sopenharmony_ci if (prevRenderer) { 27251cb0ef41Sopenharmony_ci // Replace extension with func to run new extension but fall back if false 27261cb0ef41Sopenharmony_ci extensions.renderers[ext.name] = function () { 27271cb0ef41Sopenharmony_ci for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 27281cb0ef41Sopenharmony_ci args[_key2] = arguments[_key2]; 27291cb0ef41Sopenharmony_ci } 27301cb0ef41Sopenharmony_ci 27311cb0ef41Sopenharmony_ci var ret = ext.renderer.apply(this, args); 27321cb0ef41Sopenharmony_ci 27331cb0ef41Sopenharmony_ci if (ret === false) { 27341cb0ef41Sopenharmony_ci ret = prevRenderer.apply(this, args); 27351cb0ef41Sopenharmony_ci } 27361cb0ef41Sopenharmony_ci 27371cb0ef41Sopenharmony_ci return ret; 27381cb0ef41Sopenharmony_ci }; 27391cb0ef41Sopenharmony_ci } else { 27401cb0ef41Sopenharmony_ci extensions.renderers[ext.name] = ext.renderer; 27411cb0ef41Sopenharmony_ci } 27421cb0ef41Sopenharmony_ci } 27431cb0ef41Sopenharmony_ci 27441cb0ef41Sopenharmony_ci if (ext.tokenizer) { 27451cb0ef41Sopenharmony_ci // Tokenizer Extensions 27461cb0ef41Sopenharmony_ci if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') { 27471cb0ef41Sopenharmony_ci throw new Error("extension level must be 'block' or 'inline'"); 27481cb0ef41Sopenharmony_ci } 27491cb0ef41Sopenharmony_ci 27501cb0ef41Sopenharmony_ci if (extensions[ext.level]) { 27511cb0ef41Sopenharmony_ci extensions[ext.level].unshift(ext.tokenizer); 27521cb0ef41Sopenharmony_ci } else { 27531cb0ef41Sopenharmony_ci extensions[ext.level] = [ext.tokenizer]; 27541cb0ef41Sopenharmony_ci } 27551cb0ef41Sopenharmony_ci 27561cb0ef41Sopenharmony_ci if (ext.start) { 27571cb0ef41Sopenharmony_ci // Function to check for start of token 27581cb0ef41Sopenharmony_ci if (ext.level === 'block') { 27591cb0ef41Sopenharmony_ci if (extensions.startBlock) { 27601cb0ef41Sopenharmony_ci extensions.startBlock.push(ext.start); 27611cb0ef41Sopenharmony_ci } else { 27621cb0ef41Sopenharmony_ci extensions.startBlock = [ext.start]; 27631cb0ef41Sopenharmony_ci } 27641cb0ef41Sopenharmony_ci } else if (ext.level === 'inline') { 27651cb0ef41Sopenharmony_ci if (extensions.startInline) { 27661cb0ef41Sopenharmony_ci extensions.startInline.push(ext.start); 27671cb0ef41Sopenharmony_ci } else { 27681cb0ef41Sopenharmony_ci extensions.startInline = [ext.start]; 27691cb0ef41Sopenharmony_ci } 27701cb0ef41Sopenharmony_ci } 27711cb0ef41Sopenharmony_ci } 27721cb0ef41Sopenharmony_ci } 27731cb0ef41Sopenharmony_ci 27741cb0ef41Sopenharmony_ci if (ext.childTokens) { 27751cb0ef41Sopenharmony_ci // Child tokens to be visited by walkTokens 27761cb0ef41Sopenharmony_ci extensions.childTokens[ext.name] = ext.childTokens; 27771cb0ef41Sopenharmony_ci } 27781cb0ef41Sopenharmony_ci }); 27791cb0ef41Sopenharmony_ci } // ==-- Parse "overwrite" extensions --== // 27801cb0ef41Sopenharmony_ci 27811cb0ef41Sopenharmony_ci 27821cb0ef41Sopenharmony_ci if (pack.renderer) { 27831cb0ef41Sopenharmony_ci (function () { 27841cb0ef41Sopenharmony_ci var renderer = marked.defaults.renderer || new Renderer(); 27851cb0ef41Sopenharmony_ci 27861cb0ef41Sopenharmony_ci var _loop = function _loop(prop) { 27871cb0ef41Sopenharmony_ci var prevRenderer = renderer[prop]; // Replace renderer with func to run extension, but fall back if false 27881cb0ef41Sopenharmony_ci 27891cb0ef41Sopenharmony_ci renderer[prop] = function () { 27901cb0ef41Sopenharmony_ci for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 27911cb0ef41Sopenharmony_ci args[_key3] = arguments[_key3]; 27921cb0ef41Sopenharmony_ci } 27931cb0ef41Sopenharmony_ci 27941cb0ef41Sopenharmony_ci var ret = pack.renderer[prop].apply(renderer, args); 27951cb0ef41Sopenharmony_ci 27961cb0ef41Sopenharmony_ci if (ret === false) { 27971cb0ef41Sopenharmony_ci ret = prevRenderer.apply(renderer, args); 27981cb0ef41Sopenharmony_ci } 27991cb0ef41Sopenharmony_ci 28001cb0ef41Sopenharmony_ci return ret; 28011cb0ef41Sopenharmony_ci }; 28021cb0ef41Sopenharmony_ci }; 28031cb0ef41Sopenharmony_ci 28041cb0ef41Sopenharmony_ci for (var prop in pack.renderer) { 28051cb0ef41Sopenharmony_ci _loop(prop); 28061cb0ef41Sopenharmony_ci } 28071cb0ef41Sopenharmony_ci 28081cb0ef41Sopenharmony_ci opts.renderer = renderer; 28091cb0ef41Sopenharmony_ci })(); 28101cb0ef41Sopenharmony_ci } 28111cb0ef41Sopenharmony_ci 28121cb0ef41Sopenharmony_ci if (pack.tokenizer) { 28131cb0ef41Sopenharmony_ci (function () { 28141cb0ef41Sopenharmony_ci var tokenizer = marked.defaults.tokenizer || new Tokenizer(); 28151cb0ef41Sopenharmony_ci 28161cb0ef41Sopenharmony_ci var _loop2 = function _loop2(prop) { 28171cb0ef41Sopenharmony_ci var prevTokenizer = tokenizer[prop]; // Replace tokenizer with func to run extension, but fall back if false 28181cb0ef41Sopenharmony_ci 28191cb0ef41Sopenharmony_ci tokenizer[prop] = function () { 28201cb0ef41Sopenharmony_ci for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { 28211cb0ef41Sopenharmony_ci args[_key4] = arguments[_key4]; 28221cb0ef41Sopenharmony_ci } 28231cb0ef41Sopenharmony_ci 28241cb0ef41Sopenharmony_ci var ret = pack.tokenizer[prop].apply(tokenizer, args); 28251cb0ef41Sopenharmony_ci 28261cb0ef41Sopenharmony_ci if (ret === false) { 28271cb0ef41Sopenharmony_ci ret = prevTokenizer.apply(tokenizer, args); 28281cb0ef41Sopenharmony_ci } 28291cb0ef41Sopenharmony_ci 28301cb0ef41Sopenharmony_ci return ret; 28311cb0ef41Sopenharmony_ci }; 28321cb0ef41Sopenharmony_ci }; 28331cb0ef41Sopenharmony_ci 28341cb0ef41Sopenharmony_ci for (var prop in pack.tokenizer) { 28351cb0ef41Sopenharmony_ci _loop2(prop); 28361cb0ef41Sopenharmony_ci } 28371cb0ef41Sopenharmony_ci 28381cb0ef41Sopenharmony_ci opts.tokenizer = tokenizer; 28391cb0ef41Sopenharmony_ci })(); 28401cb0ef41Sopenharmony_ci } // ==-- Parse WalkTokens extensions --== // 28411cb0ef41Sopenharmony_ci 28421cb0ef41Sopenharmony_ci 28431cb0ef41Sopenharmony_ci if (pack.walkTokens) { 28441cb0ef41Sopenharmony_ci var walkTokens = marked.defaults.walkTokens; 28451cb0ef41Sopenharmony_ci 28461cb0ef41Sopenharmony_ci opts.walkTokens = function (token) { 28471cb0ef41Sopenharmony_ci pack.walkTokens.call(_this, token); 28481cb0ef41Sopenharmony_ci 28491cb0ef41Sopenharmony_ci if (walkTokens) { 28501cb0ef41Sopenharmony_ci walkTokens(token); 28511cb0ef41Sopenharmony_ci } 28521cb0ef41Sopenharmony_ci }; 28531cb0ef41Sopenharmony_ci } 28541cb0ef41Sopenharmony_ci 28551cb0ef41Sopenharmony_ci if (hasExtensions) { 28561cb0ef41Sopenharmony_ci opts.extensions = extensions; 28571cb0ef41Sopenharmony_ci } 28581cb0ef41Sopenharmony_ci 28591cb0ef41Sopenharmony_ci marked.setOptions(opts); 28601cb0ef41Sopenharmony_ci }); 28611cb0ef41Sopenharmony_ci }; 28621cb0ef41Sopenharmony_ci /** 28631cb0ef41Sopenharmony_ci * Run callback for every token 28641cb0ef41Sopenharmony_ci */ 28651cb0ef41Sopenharmony_ci 28661cb0ef41Sopenharmony_ci 28671cb0ef41Sopenharmony_ci marked.walkTokens = function (tokens, callback) { 28681cb0ef41Sopenharmony_ci var _loop3 = function _loop3() { 28691cb0ef41Sopenharmony_ci var token = _step.value; 28701cb0ef41Sopenharmony_ci callback(token); 28711cb0ef41Sopenharmony_ci 28721cb0ef41Sopenharmony_ci switch (token.type) { 28731cb0ef41Sopenharmony_ci case 'table': 28741cb0ef41Sopenharmony_ci { 28751cb0ef41Sopenharmony_ci for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done;) { 28761cb0ef41Sopenharmony_ci var cell = _step2.value; 28771cb0ef41Sopenharmony_ci marked.walkTokens(cell.tokens, callback); 28781cb0ef41Sopenharmony_ci } 28791cb0ef41Sopenharmony_ci 28801cb0ef41Sopenharmony_ci for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) { 28811cb0ef41Sopenharmony_ci var row = _step3.value; 28821cb0ef41Sopenharmony_ci 28831cb0ef41Sopenharmony_ci for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) { 28841cb0ef41Sopenharmony_ci var _cell = _step4.value; 28851cb0ef41Sopenharmony_ci marked.walkTokens(_cell.tokens, callback); 28861cb0ef41Sopenharmony_ci } 28871cb0ef41Sopenharmony_ci } 28881cb0ef41Sopenharmony_ci 28891cb0ef41Sopenharmony_ci break; 28901cb0ef41Sopenharmony_ci } 28911cb0ef41Sopenharmony_ci 28921cb0ef41Sopenharmony_ci case 'list': 28931cb0ef41Sopenharmony_ci { 28941cb0ef41Sopenharmony_ci marked.walkTokens(token.items, callback); 28951cb0ef41Sopenharmony_ci break; 28961cb0ef41Sopenharmony_ci } 28971cb0ef41Sopenharmony_ci 28981cb0ef41Sopenharmony_ci default: 28991cb0ef41Sopenharmony_ci { 29001cb0ef41Sopenharmony_ci if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) { 29011cb0ef41Sopenharmony_ci // Walk any extensions 29021cb0ef41Sopenharmony_ci marked.defaults.extensions.childTokens[token.type].forEach(function (childTokens) { 29031cb0ef41Sopenharmony_ci marked.walkTokens(token[childTokens], callback); 29041cb0ef41Sopenharmony_ci }); 29051cb0ef41Sopenharmony_ci } else if (token.tokens) { 29061cb0ef41Sopenharmony_ci marked.walkTokens(token.tokens, callback); 29071cb0ef41Sopenharmony_ci } 29081cb0ef41Sopenharmony_ci } 29091cb0ef41Sopenharmony_ci } 29101cb0ef41Sopenharmony_ci }; 29111cb0ef41Sopenharmony_ci 29121cb0ef41Sopenharmony_ci for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) { 29131cb0ef41Sopenharmony_ci _loop3(); 29141cb0ef41Sopenharmony_ci } 29151cb0ef41Sopenharmony_ci }; 29161cb0ef41Sopenharmony_ci /** 29171cb0ef41Sopenharmony_ci * Parse Inline 29181cb0ef41Sopenharmony_ci */ 29191cb0ef41Sopenharmony_ci 29201cb0ef41Sopenharmony_ci 29211cb0ef41Sopenharmony_ci marked.parseInline = function (src, opt) { 29221cb0ef41Sopenharmony_ci // throw error in case of non string input 29231cb0ef41Sopenharmony_ci if (typeof src === 'undefined' || src === null) { 29241cb0ef41Sopenharmony_ci throw new Error('marked.parseInline(): input parameter is undefined or null'); 29251cb0ef41Sopenharmony_ci } 29261cb0ef41Sopenharmony_ci 29271cb0ef41Sopenharmony_ci if (typeof src !== 'string') { 29281cb0ef41Sopenharmony_ci throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected'); 29291cb0ef41Sopenharmony_ci } 29301cb0ef41Sopenharmony_ci 29311cb0ef41Sopenharmony_ci opt = merge({}, marked.defaults, opt || {}); 29321cb0ef41Sopenharmony_ci checkSanitizeDeprecation(opt); 29331cb0ef41Sopenharmony_ci 29341cb0ef41Sopenharmony_ci try { 29351cb0ef41Sopenharmony_ci var tokens = Lexer.lexInline(src, opt); 29361cb0ef41Sopenharmony_ci 29371cb0ef41Sopenharmony_ci if (opt.walkTokens) { 29381cb0ef41Sopenharmony_ci marked.walkTokens(tokens, opt.walkTokens); 29391cb0ef41Sopenharmony_ci } 29401cb0ef41Sopenharmony_ci 29411cb0ef41Sopenharmony_ci return Parser.parseInline(tokens, opt); 29421cb0ef41Sopenharmony_ci } catch (e) { 29431cb0ef41Sopenharmony_ci e.message += '\nPlease report this to https://github.com/markedjs/marked.'; 29441cb0ef41Sopenharmony_ci 29451cb0ef41Sopenharmony_ci if (opt.silent) { 29461cb0ef41Sopenharmony_ci return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>'; 29471cb0ef41Sopenharmony_ci } 29481cb0ef41Sopenharmony_ci 29491cb0ef41Sopenharmony_ci throw e; 29501cb0ef41Sopenharmony_ci } 29511cb0ef41Sopenharmony_ci }; 29521cb0ef41Sopenharmony_ci /** 29531cb0ef41Sopenharmony_ci * Expose 29541cb0ef41Sopenharmony_ci */ 29551cb0ef41Sopenharmony_ci 29561cb0ef41Sopenharmony_ci 29571cb0ef41Sopenharmony_ci marked.Parser = Parser; 29581cb0ef41Sopenharmony_ci marked.parser = Parser.parse; 29591cb0ef41Sopenharmony_ci marked.Renderer = Renderer; 29601cb0ef41Sopenharmony_ci marked.TextRenderer = TextRenderer; 29611cb0ef41Sopenharmony_ci marked.Lexer = Lexer; 29621cb0ef41Sopenharmony_ci marked.lexer = Lexer.lex; 29631cb0ef41Sopenharmony_ci marked.Tokenizer = Tokenizer; 29641cb0ef41Sopenharmony_ci marked.Slugger = Slugger; 29651cb0ef41Sopenharmony_ci marked.parse = marked; 29661cb0ef41Sopenharmony_ci var marked_1 = marked; 29671cb0ef41Sopenharmony_ci 29681cb0ef41Sopenharmony_ci return marked_1; 29691cb0ef41Sopenharmony_ci 29701cb0ef41Sopenharmony_ci}))); 2971