2023-08-19 16:55:56 -06:00
|
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,function(t){"use strict";function e(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!1,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!1,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function n(e){t.defaults=e}t.defaults=e();const s=/[&<>"']/,r=new RegExp(s.source,"g"),i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l=new RegExp(i.source,"g"),a={"&":"&","<":"<",">":">",'"':""","'":"'"},o=e=>a[e];function h(e,t){if(t){if(s.test(e))return e.replace(r,o)}else if(i.test(e))return e.replace(l,o);return e}const c=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function m(e){return e.replace(c,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")}const p=/(^|[^\[])\^/g;function u(n,e){n="string"==typeof n?n:n.source,e=e||"";const s={replace:(e,t)=>(t=(t="object"==typeof t&&"source"in t?t.source:t).replace(p,"$1"),n=n.replace(e,t),s),getRegex:()=>new RegExp(n,e)};return s}const g=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(e,t,n){if(e){let e;try{e=decodeURIComponent(m(n)).replace(g,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}var s;t&&!d.test(n)&&(e=t,t=n,f[" "+e]||(x.test(e)?f[" "+e]=e+"/":f[" "+e]=y(e,"/",!0)),s=-1===(e=f[" "+e]).indexOf(":"),n="//"===t.substring(0,2)?s?t:e.replace(j,"$1")+t:"/"===t.charAt(0)?s?t:e.replace(D,"$1")+t:e+t);try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n}const f={},x=/^[^:]+:\/*[^/]*$/,j=/^([^:]+:)[\s\S]*$/,D=/^([^:]+:\/*[^/]*)[\s\S]*$/;var b={exec:()=>null};function w(e,t){var n=e.replace(/\|/g,(e,t,n)=>{let s=!1,r=t;for(;0<=--r&&"\\"===n[r];)s=!s;return s?"|":" |"}).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),0<n.length&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function y(e,t,n){var s=e.length;if(0===s)return"";let r=0;for(;r<s;){var i=e.charAt(s-r-1);if((i!==t||n)&&(i===t||!n))break;r++}return e.slice(0,s-r)}function _(e,t,n,s){var r=t.href,t=t.title?h(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?(s.state.inLink=!0,e={type:"link",raw:n,href:r,title:t,text:i,tokens:s.inlineTokens(i)},s.state.inLink=!1,e):{type:"image",raw:n,href:r,title:t,text:h(i)}}class ${options;rules;lexer;constructor(e){this.options=e||t.defaults}space(e){e=this.rules.block.newline.exec(e);if(e&&0<e[0].length)return{type:"space",raw:e[0]}}code(e){var t,e=this.rules.block.code.exec(e);if(e)return t=e[0].replace(/^ {1,4}/gm,""),{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:y(t,"\n")}}fences(e){var t,n,e=this.rules.block.fences.exec(e);if(e)return n=function(e,t){if(null===(e=e.match(/^(\s+)(?:```)/)))return t;const n=e[1];return t.split("\n").map(e=>{var t=e.match(/^\s+/);return null!==t&&([t]=t,t.length>=n.length)?e.slice(n.length):e}).join("\n")}(t=e[0],e[3]||""),{type:"code",raw:t,lang:e[2]&&e[2].trim().replace(this.rules.inline._escapes,"$1"),text:n}}heading(t){var n,t=this.rules.block.heading.exec(t);if(t){let e=t[2].trim();return/#$/.test(e)&&(n=y(e,"#"),!this.options.pedantic&&n&&!/ $/.test(n)||(e=n.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:e[0]}}blockquote(e){var t,n,s,e=this.rules.block.blockquote.exec(e);if(e)return t=e[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top,this.lexer.state.top=!0,s=this.lexer.blockTokens(t),this.lexer.state.top=n,{type:"blockquote",raw:e[0],tokens:s,text:t}}list(c){let p=this.rules.block.list.exec(c);if(p){let e=p
|
2023-08-19 16:55:56 -06:00
|
|
|
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){var s=k(this.options.sanitize,this.options.baseUrl,e);if(null===s)return n;let r='<a href="'+(e=s)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"}image(e,t,n){var s=k(this.options.sanitize,this.options.baseUrl,e);if(null===s)return n;let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=this.options.xhtml?"/>":">"}text(e){return e}}class A{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class I{seen;constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,s=0;if(this.seen.hasOwnProperty(n))for(s=this.seen[e];s++,n=e+"-"+s,this.seen.hasOwnProperty(n););return t||(this.seen[e]=s,this.seen[n]=0),n}slug(e,t={}){e=this.serialize(e);return this.getNextSafeSlug(e,t.dryrun)}}class E{options;renderer;textRenderer;slugger;constructor(e){this.options=e||t.defaults,this.options.renderer=this.options.renderer||new T,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new A,this.slugger=new I}static parse(e,t){return new E(t).parse(e)}static parseInline(e,t){return new E(t).parseInline(e)}parse(s,r=!0){let i="";for(let n=0;n<s.length;n++){var l=s[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){var e=l,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){i+=t||"";continue}}switch(l.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":var a=l;i+=this.renderer.heading(this.parseInline(a.tokens),a.depth,m(this.parseInline(a.tokens,this.textRenderer)),this.slugger);continue;case"code":i+=this.renderer.code(l.text,l.lang,!!l.escaped);continue;case"table":{var o=l,a="";let t="";for(let e=0;e<o.header.length;e++)t+=this.renderer.tablecell(this.parseInline(o.header[e].tokens),{header:!0,align:o.align[e]});a+=this.renderer.tablerow(t);let n="";for(let e=0;e<o.rows.length;e++){var h=o.rows[e];t="";for(let e=0;e<h.length;e++)t+=this.renderer.tablecell(this.parseInline(h[e].tokens),{header:!1,align:o.align[e]});n+=this.renderer.tablerow(t)}i+=this.renderer.table(a,n);continue}case"blockquote":var c=this.parse(l.tokens);i+=this.renderer.blockquote(c);continue;case"list":{var p=l,c=p.ordered,u=p.start,g=p.loose;let n="";for(let t=0;t<p.items.length;t++){var d,k=p.items[t],f=k.checked,x=k.task;let e="";k.task&&(d=this.renderer.checkbox(!!f),g?0<k.tokens.length&&"paragraph"===k.tokens[0].type?(k.tokens[0].text=d+" "+k.tokens[0].text,k.tokens[0].tokens&&0<k.tokens[0].tokens.length&&"text"===k.tokens[0].tokens[0].type&&(k.tokens[0].tokens[0].text=d+" "+k.tokens[0].tokens[0].text)):k.tokens.unshift({type:"text",text:d}):e+=d),e+=this.parse(k.tokens,g),n+=this.renderer.listitem(e,x,!!f)}i+=this.renderer.list(n,c,u);continue}case"html":i+=this.renderer.html(l.text,l.block);continue;case"paragraph":i+=this.renderer.paragraph(this.parseInline(l.tokens));continue;case"text":{let e=l,t=e.tokens?this.parseInline(e.tokens):e.text;for(;n+1<s.length&&"text"===s[n+1].type;)e=s[++n],t+="\n"+(e.tokens?this.parseInline(e.tokens):e.text);i+=r?this.renderer.paragraph(t):t;continue}default:u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}return i}parseInline(t,n){n=n||this.renderer;let s="";for(let e=0;e<t.length;e++){var r=t[e];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){var i=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==i||!["escape","html","link","image","strong","em
|