/i.test(cap[0])) {\n this.inLink = false;\n }\n\n src = src.substring(cap[0].length);\n out += this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];\n continue;\n } // link\n\n\n if (cap = this.rules.link.exec(src)) {\n src = src.substring(cap[0].length);\n this.inLink = true;\n out += this.outputLink(cap, {\n href: cap[2],\n title: cap[3]\n });\n this.inLink = false;\n continue;\n } // reflink, nolink\n\n\n if ((cap = this.rules.reflink.exec(src)) || (cap = this.rules.nolink.exec(src))) {\n src = src.substring(cap[0].length);\n link = (cap[2] || cap[1]).replace(/\\s+/g, ' ');\n link = this.links[link.toLowerCase()];\n\n if (!link || !link.href) {\n out += cap[0].charAt(0);\n src = cap[0].substring(1) + src;\n continue;\n }\n\n this.inLink = true;\n out += this.outputLink(cap, link);\n this.inLink = false;\n continue;\n } // strong\n\n\n if (cap = this.rules.strong.exec(src)) {\n src = src.substring(cap[0].length);\n out += this.renderer.strong(this.output(cap[2] || cap[1]));\n continue;\n } // em\n\n\n if (cap = this.rules.em.exec(src)) {\n src = src.substring(cap[0].length);\n out += this.renderer.em(this.output(cap[2] || cap[1]));\n continue;\n } // code\n\n\n if (cap = this.rules.code.exec(src)) {\n src = src.substring(cap[0].length);\n out += this.renderer.codespan(escape(cap[2].trim(), true));\n continue;\n } // br\n\n\n if (cap = this.rules.br.exec(src)) {\n src = src.substring(cap[0].length);\n out += this.renderer.br();\n continue;\n } // del (gfm)\n\n\n if (cap = this.rules.del.exec(src)) {\n src = src.substring(cap[0].length);\n out += this.renderer.del(this.output(cap[1]));\n continue;\n } // text\n\n\n if (cap = this.rules.text.exec(src)) {\n src = src.substring(cap[0].length);\n out += this.renderer.text(escape(this.smartypants(cap[0])));\n continue;\n }\n\n if (src) {\n throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));\n }\n }\n\n return out;\n };\n /**\n * Compile Link\n */\n\n\n InlineLexer.prototype.outputLink = function (cap, link) {\n var href = escape(link.href),\n title = link.title ? escape(link.title) : null;\n return cap[0].charAt(0) !== '!' ? this.renderer.link(href, title, this.output(cap[1])) : this.renderer.image(href, title, escape(cap[1]));\n };\n /**\n * Smartypants Transformations\n */\n\n\n InlineLexer.prototype.smartypants = function (text) {\n if (!this.options.smartypants) return text;\n return text // em-dashes\n .replace(/---/g, \"\\u2014\") // en-dashes\n .replace(/--/g, \"\\u2013\") // opening singles\n .replace(/(^|[-\\u2014/(\\[{\"\\s])'/g, \"$1\\u2018\") // closing singles & apostrophes\n .replace(/'/g, \"\\u2019\") // opening doubles\n .replace(/(^|[-\\u2014/(\\[{\\u2018\\s])\"/g, \"$1\\u201C\") // closing doubles\n .replace(/\"/g, \"\\u201D\") // ellipses\n .replace(/\\.{3}/g, \"\\u2026\");\n };\n /**\n * Mangle Links\n */\n\n\n InlineLexer.prototype.mangle = function (text) {\n if (!this.options.mangle) return text;\n var out = '',\n l = text.length,\n i = 0,\n ch;\n\n for (; i < l; i++) {\n ch = text.charCodeAt(i);\n\n if (Math.random() > 0.5) {\n ch = 'x' + ch.toString(16);\n }\n\n out += '' + ch + ';';\n }\n\n return out;\n };\n /**\n * Renderer\n */\n\n\n function Renderer(options) {\n this.options = options || {};\n }\n\n Renderer.prototype.code = function (code, lang, escaped) {\n if (this.options.highlight) {\n var out = this.options.highlight(code, lang);\n\n if (out != null && out !== code) {\n escaped = true;\n code = out;\n }\n }\n\n if (!lang) {\n return '' + (escaped ? code : escape(code, true)) + '\\n
';\n }\n\n return '' + (escaped ? code : escape(code, true)) + '\\n
\\n';\n };\n\n Renderer.prototype.blockquote = function (quote) {\n return '\\n' + quote + '
\\n';\n };\n\n Renderer.prototype.html = function (html) {\n return html;\n };\n\n Renderer.prototype.heading = function (text, level, raw) {\n return '' + text + '\\n';\n };\n\n Renderer.prototype.hr = function () {\n return this.options.xhtml ? '
\\n' : '
\\n';\n };\n\n Renderer.prototype.list = function (body, ordered, start) {\n var type = ordered ? 'ol' : 'ul',\n startatt = ordered && start !== 1 ? ' start=\"' + start + '\"' : '';\n return '<' + type + startatt + '>\\n' + body + '' + type + '>\\n';\n };\n\n Renderer.prototype.listitem = function (text) {\n return '' + text + '\\n';\n };\n\n Renderer.prototype.paragraph = function (text) {\n return '' + text + '
\\n';\n };\n\n Renderer.prototype.table = function (header, body) {\n return '