Hey 👋, this is a gist which stores the final bundle results of the bundlejs api, learn more on the website https://bundlejs.com. This is the result of https://deno.bundlejs.com/?q=remark-stringify.
Created
September 25, 2023 23:15
-
-
Save bundle-js/5b08620ec5de3e018526bd891bd1b173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var X={}.hasOwnProperty;function K(r,t){let e=t||{};function n(i,...a){let o=n.invalid,f=n.handlers;if(i&&X.call(i,r)){let c=String(i[r]);o=X.call(f,c)?f[c]:n.unknown}if(o)return o.call(this,i,...a)}return n.handlers=e.handlers||{},n.invalid=e.invalid,n.unknown=e.unknown,n}var Re={}.hasOwnProperty;function P(r,t){let e=-1,n;if(t.extensions)for(;++e<t.extensions.length;)P(r,t.extensions[e]);for(n in t)if(Re.call(t,n))switch(n){case"extensions":break;case"unsafe":{Z(r[n],t[n]);break}case"join":{Z(r[n],t[n]);break}case"handlers":{Oe(r[n],t[n]);break}default:r.options[n]=t[n]}return r}function Z(r,t){t&&r.push(...t)}function Oe(r,t){t&&Object.assign(r,t)}function W(r,t,e,n){let i=e.enter("blockquote"),a=e.createTracker(n);a.move("> "),a.shift(2);let o=e.indentLines(e.containerFlow(r,a.current()),je);return i(),o}function je(r,t,e){return">"+(e?"":" ")+r}function I(r,t){return Y(r,t.inConstruct,!0)&&!Y(r,t.notInConstruct,!1)}function Y(r,t,e){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return e;let n=-1;for(;++n<t.length;)if(r.includes(t[n]))return!0;return!1}function F(r,t,e,n){let i=-1;for(;++i<e.unsafe.length;)if(e.unsafe[i].character===` | |
`&&I(e.stack,e.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\ | |
`}function J(r,t){let e=String(r),n=e.indexOf(t),i=n,a=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++a>o&&(o=a):a=1,i=n+t.length,n=e.indexOf(t,i);return o}function C(r,t){return!!(t.options.fences===!1&&r.value&&!r.lang&&/[^ \r\n]/.test(r.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(r.value))}function V(r){let t=r.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function ee(r,t,e,n){let i=V(e),a=r.value||"",o=i==="`"?"GraveAccent":"Tilde";if(C(r,e)){let s=e.enter("codeIndented"),h=e.indentLines(a,ze);return s(),h}let f=e.createTracker(n),c=i.repeat(Math.max(J(a,i)+1,3)),l=e.enter("codeFenced"),u=f.move(c);if(r.lang){let s=e.enter(`codeFencedLang${o}`);u+=f.move(e.safe(r.lang,{before:u,after:" ",encode:["`"],...f.current()})),s()}if(r.lang&&r.meta){let s=e.enter(`codeFencedMeta${o}`);u+=f.move(" "),u+=f.move(e.safe(r.meta,{before:u,after:` | |
`,encode:["`"],...f.current()})),s()}return u+=f.move(` | |
`),a&&(u+=f.move(a+` | |
`)),u+=f.move(c),l(),u}function ze(r,t,e){return(e?"":" ")+r}function g(r){let t=r.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function re(r,t,e,n){let i=g(e),a=i==='"'?"Quote":"Apostrophe",o=e.enter("definition"),f=e.enter("label"),c=e.createTracker(n),l=c.move("[");return l+=c.move(e.safe(e.associationId(r),{before:l,after:"]",...c.current()})),l+=c.move("]: "),f(),!r.url||/[\0- \u007F]/.test(r.url)?(f=e.enter("destinationLiteral"),l+=c.move("<"),l+=c.move(e.safe(r.url,{before:l,after:">",...c.current()})),l+=c.move(">")):(f=e.enter("destinationRaw"),l+=c.move(e.safe(r.url,{before:l,after:r.title?" ":` | |
`,...c.current()}))),f(),r.title&&(f=e.enter(`title${a}`),l+=c.move(" "+i),l+=c.move(e.safe(r.title,{before:l,after:i,...c.current()})),l+=c.move(i),f()),o(),l}function te(r){let t=r.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}T.peek=Ne;function T(r,t,e,n){let i=te(e),a=e.enter("emphasis"),o=e.createTracker(n),f=o.move(i);return f+=o.move(e.containerPhrasing(r,{before:f,after:i,...o.current()})),f+=o.move(i),a(),f}function Ne(r,t,e){return e.options.emphasis||"*"}var b=function(r){if(r==null)return $e;if(typeof r=="function")return A(r);if(typeof r=="object")return Array.isArray(r)?Me(r):qe(r);if(typeof r=="string")return Ue(r);throw new Error("Expected function, string, or object as test")};function Me(r){let t=[],e=-1;for(;++e<r.length;)t[e]=b(r[e]);return A(n);function n(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function qe(r){let t=r;return A(e);function e(n){let i=n,a;for(a in r)if(i[a]!==t[a])return!1;return!0}}function Ue(r){return A(t);function t(e){return e&&e.type===r}}function A(r){return t;function t(e,n,i){return!!(Ge(e)&&r.call(this,e,typeof n=="number"?n:void 0,i||void 0))}}function $e(){return!0}function Ge(r){return r!==null&&typeof r=="object"&&"type"in r}var ne=[],_=!0,k=!1,S="skip";function L(r,t,e,n){let i;typeof t=="function"&&typeof e!="function"?(n=e,e=t):i=t;let a=b(i),o=n?-1:1;f(r,void 0,[])();function f(c,l,u){let s=c&&typeof c=="object"?c:{};if(typeof s.type=="string"){let p=typeof s.tagName=="string"?s.tagName:typeof s.name=="string"?s.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=ne,d,m,D;if((!t||a(c,l,u[u.length-1]||void 0))&&(p=Qe(e(c,u)),p[0]===k))return p;if("children"in c&&c.children){let v=c;if(v.children&&p[0]!==S)for(m=(n?v.children.length:-1)+o,D=u.concat(v);m>-1&&m<v.children.length;){let Le=v.children[m];if(d=f(Le,m,D)(),d[0]===k)return d;m=typeof d[1]=="number"?d[1]:m+o}}return p}}}function Qe(r){return Array.isArray(r)?r:typeof r=="number"?[_,r]:r==null?ne:[r]}function R(r,t,e,n){let i,a,o;typeof t=="function"&&typeof e!="function"?(a=void 0,o=t,i=e):(a=t,o=e,i=n),L(r,a,f,i);function f(c,l){let u=l[l.length-1],s=u?u.children.indexOf(c):void 0;return o(c,s,u)}}var He={};function y(r,t){let e=t||He,n=typeof e.includeImageAlt=="boolean"?e.includeImageAlt:!0,i=typeof e.includeHtml=="boolean"?e.includeHtml:!0;return ie(r,n,i)}function ie(r,t,e){if(De(r)){if("value"in r)return r.type==="html"&&!e?"":r.value;if(t&&"alt"in r&&r.alt)return r.alt;if("children"in r)return oe(r.children,t,e)}return Array.isArray(r)?oe(r,t,e):""}function oe(r,t,e){let n=[],i=-1;for(;++i<r.length;)n[i]=ie(r[i],t,e);return n.join("")}function De(r){return!!(r&&typeof r=="object")}function E(r,t){let e=!1;return R(r,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return e=!0,k}),!!((!r.depth||r.depth<3)&&y(r)&&(t.options.setext||e))}function ce(r,t,e,n){let i=Math.max(Math.min(6,r.depth||1),1),a=e.createTracker(n);if(E(r,e)){let u=e.enter("headingSetext"),s=e.enter("phrasing"),h=e.containerPhrasing(r,{...a.current(),before:` | |
`,after:` | |
`});return s(),u(),h+` | |
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` | |
`))+1))}let o="#".repeat(i),f=e.enter("headingAtx"),c=e.enter("phrasing");a.move(o+" ");let l=e.containerPhrasing(r,{before:"# ",after:` | |
`,...a.current()});return/^[\t ]/.test(l)&&(l="&#x"+l.charCodeAt(0).toString(16).toUpperCase()+";"+l.slice(1)),l=l?o+" "+l:o,e.options.closeAtx&&(l+=" "+o),c(),f(),l}O.peek=Xe;function O(r){return r.value||""}function Xe(){return"<"}j.peek=Ke;function j(r,t,e,n){let i=g(e),a=i==='"'?"Quote":"Apostrophe",o=e.enter("image"),f=e.enter("label"),c=e.createTracker(n),l=c.move("![");return l+=c.move(e.safe(r.alt,{before:l,after:"]",...c.current()})),l+=c.move("]("),f(),!r.url&&r.title||/[\0- \u007F]/.test(r.url)?(f=e.enter("destinationLiteral"),l+=c.move("<"),l+=c.move(e.safe(r.url,{before:l,after:">",...c.current()})),l+=c.move(">")):(f=e.enter("destinationRaw"),l+=c.move(e.safe(r.url,{before:l,after:r.title?" ":")",...c.current()}))),f(),r.title&&(f=e.enter(`title${a}`),l+=c.move(" "+i),l+=c.move(e.safe(r.title,{before:l,after:i,...c.current()})),l+=c.move(i),f()),l+=c.move(")"),o(),l}function Ke(){return"!"}z.peek=Ze;function z(r,t,e,n){let i=r.referenceType,a=e.enter("imageReference"),o=e.enter("label"),f=e.createTracker(n),c=f.move("!["),l=e.safe(r.alt,{before:c,after:"]",...f.current()});c+=f.move(l+"]["),o();let u=e.stack;e.stack=[],o=e.enter("reference");let s=e.safe(e.associationId(r),{before:c,after:"]",...f.current()});return o(),e.stack=u,a(),i==="full"||!l||l!==s?c+=f.move(s+"]"):i==="shortcut"?c=c.slice(0,-1):c+=f.move("]"),c}function Ze(){return"!"}N.peek=We;function N(r,t,e){let n=r.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++a<e.unsafe.length;){let o=e.unsafe[a],f=e.compilePattern(o),c;if(o.atBreak)for(;c=f.exec(n);){let l=c.index;n.charCodeAt(l)===10&&n.charCodeAt(l-1)===13&&l--,n=n.slice(0,l)+" "+n.slice(c.index+1)}}return i+n+i}function We(){return"`"}function M(r,t){let e=y(r);return!!(!t.options.resourceLink&&r.url&&!r.title&&r.children&&r.children.length===1&&r.children[0].type==="text"&&(e===r.url||"mailto:"+e===r.url)&&/^[a-z][a-z+.-]+:/i.test(r.url)&&!/[\0- <>\u007F]/.test(r.url))}q.peek=Ye;function q(r,t,e,n){let i=g(e),a=i==='"'?"Quote":"Apostrophe",o=e.createTracker(n),f,c;if(M(r,e)){let u=e.stack;e.stack=[],f=e.enter("autolink");let s=o.move("<");return s+=o.move(e.containerPhrasing(r,{before:s,after:">",...o.current()})),s+=o.move(">"),f(),e.stack=u,s}f=e.enter("link"),c=e.enter("label");let l=o.move("[");return l+=o.move(e.containerPhrasing(r,{before:l,after:"](",...o.current()})),l+=o.move("]("),c(),!r.url&&r.title||/[\0- \u007F]/.test(r.url)?(c=e.enter("destinationLiteral"),l+=o.move("<"),l+=o.move(e.safe(r.url,{before:l,after:">",...o.current()})),l+=o.move(">")):(c=e.enter("destinationRaw"),l+=o.move(e.safe(r.url,{before:l,after:r.title?" ":")",...o.current()}))),c(),r.title&&(c=e.enter(`title${a}`),l+=o.move(" "+i),l+=o.move(e.safe(r.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(")"),f(),l}function Ye(r,t,e){return M(r,e)?"<":"["}U.peek=Je;function U(r,t,e,n){let i=r.referenceType,a=e.enter("linkReference"),o=e.enter("label"),f=e.createTracker(n),c=f.move("["),l=e.containerPhrasing(r,{before:c,after:"]",...f.current()});c+=f.move(l+"]["),o();let u=e.stack;e.stack=[],o=e.enter("reference");let s=e.safe(e.associationId(r),{before:c,after:"]",...f.current()});return o(),e.stack=u,a(),i==="full"||!l||l!==s?c+=f.move(s+"]"):i==="shortcut"?c=c.slice(0,-1):c+=f.move("]"),c}function Je(){return"["}function w(r){let t=r.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function ae(r){let t=w(r),e=r.options.bulletOther;if(!e)return t==="*"?"-":"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(e===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+e+"`) to be different");return e}function fe(r){let t=r.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function B(r){let t=r.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function le(r,t,e,n){let i=e.enter("list"),a=e.bulletCurrent,o=r.ordered?fe(e):w(e),f=r.ordered?o==="."?")":".":ae(e),c=t&&e.bulletLastUsed?o===e.bulletLastUsed:!1;if(!r.ordered){let u=r.children?r.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&e.stack[e.stack.length-1]==="list"&&e.stack[e.stack.length-2]==="listItem"&&e.stack[e.stack.length-3]==="list"&&e.stack[e.stack.length-4]==="listItem"&&e.indexStack[e.indexStack.length-1]===0&&e.indexStack[e.indexStack.length-2]===0&&e.indexStack[e.indexStack.length-3]===0&&(c=!0),B(e)===o&&u){let s=-1;for(;++s<r.children.length;){let h=r.children[s];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=f),e.bulletCurrent=o;let l=e.containerFlow(r,n);return e.bulletLastUsed=o,e.bulletCurrent=a,i(),l}function ue(r){let t=r.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function se(r,t,e,n){let i=ue(e),a=e.bulletCurrent||w(e);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(e.options.incrementListMarker===!1?0:t.children.indexOf(r))+a);let o=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||r.spread))&&(o=Math.ceil(o/4)*4);let f=e.createTracker(n);f.move(a+" ".repeat(o-a.length)),f.shift(o);let c=e.enter("listItem"),l=e.indentLines(e.containerFlow(r,f.current()),u);return c(),l;function u(s,h,p){return h?(p?"":" ".repeat(o))+s:(p?a:a+" ".repeat(o-a.length))+s}}function he(r,t,e,n){let i=e.enter("paragraph"),a=e.enter("phrasing"),o=e.containerPhrasing(r,n);return a(),i(),o}var $=b(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","link","linkReference","strong","text"]);function pe(r,t,e,n){return(r.children.some(function(o){return $(o)})?e.containerPhrasing:e.containerFlow).call(e,r,n)}function me(r){let t=r.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}G.peek=Ve;function G(r,t,e,n){let i=me(e),a=e.enter("strong"),o=e.createTracker(n),f=o.move(i+i);return f+=o.move(e.containerPhrasing(r,{before:f,after:i,...o.current()})),f+=o.move(i+i),a(),f}function Ve(r,t,e){return e.options.strong||"*"}function de(r,t,e,n){return e.safe(r.value,n)}function ke(r){let t=r.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function xe(r,t,e){let n=(B(e)+(e.options.ruleSpaces?" ":"")).repeat(ke(e));return e.options.ruleSpaces?n.slice(0,-1):n}var ge={blockquote:W,break:F,code:ee,definition:re,emphasis:T,hardBreak:F,heading:ce,html:O,image:j,imageReference:z,inlineCode:N,link:q,linkReference:U,list:le,listItem:se,paragraph:he,root:pe,strong:G,text:de,thematicBreak:xe};var be=[er];function er(r,t,e,n){if(t.type==="code"&&C(t,n)&&(r.type==="list"||r.type===t.type&&C(r,n)))return!1;if("spread"in e&&typeof e.spread=="boolean")return r.type==="paragraph"&&(r.type===t.type||t.type==="definition"||t.type==="heading"&&E(t,n))?void 0:e.spread?1:0}var x=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],we=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:` | |
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:x},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r | |
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:x},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r | |
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:x},{atBreak:!0,character:"+",after:`(?:[ \r | |
])`},{atBreak:!0,character:"-",after:`(?:[ \r | |
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r | |
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:x},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:x},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:x},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:x},{atBreak:!0,character:"~"}];var ve=document.createElement("i");function Ce(r){let t="&"+r+";";ve.innerHTML=t;let e=ve.textContent;return e.charCodeAt(e.length-1)===59&&r!=="semi"||e===t?!1:e}function ye(r,t){let e=Number.parseInt(r,t);return e<9||e===11||e>13&&e<32||e>126&&e<160||e>55295&&e<57344||e>64975&&e<65008||(e&65535)===65535||(e&65535)===65534||e>1114111?"\uFFFD":String.fromCharCode(e)}var rr=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ie(r){return r.replace(rr,tr)}function tr(r,t,e){if(t)return t;if(e.charCodeAt(0)===35){let i=e.charCodeAt(1),a=i===120||i===88;return ye(e.slice(a?2:1),a?16:10)}return Ce(e)||r}function Ae(r){return r.label||!r.identifier?r.label||"":Ie(r.identifier)}function _e(r){if(!r._compiled){let t=(r.atBreak?"[\\r\\n][\\t ]*":"")+(r.before?"(?:"+r.before+")":"");r._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(r.character)?"\\":"")+r.character+(r.after?"(?:"+r.after+")":""),"g")}return r._compiled}function Se(r,t,e){let n=t.indexStack,i=r.children||[],a=[],o=-1,f=e.before;n.push(-1);let c=t.createTracker(e);for(;++o<i.length;){let l=i[o],u;if(n[n.length-1]=o,o+1<i.length){let s=t.handle.handlers[i[o+1].type];s&&s.peek&&(s=s.peek),u=s?s(i[o+1],r,t,{before:"",after:"",...c.current()}).charAt(0):""}else u=e.after;a.length>0&&(f==="\r"||f===` | |
`)&&l.type==="html"&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/," "),f=" ",c=t.createTracker(e),c.move(a.join(""))),a.push(c.move(t.handle(l,r,t,{...c.current(),before:f,after:u}))),f=a[a.length-1].slice(-1)}return n.pop(),a.join("")}function Ee(r,t,e){let n=t.indexStack,i=r.children||[],a=t.createTracker(e),o=[],f=-1;for(n.push(-1);++f<i.length;){let c=i[f];n[n.length-1]=f,o.push(a.move(t.handle(c,r,t,{before:` | |
`,after:` | |
`,...a.current()}))),c.type!=="list"&&(t.bulletLastUsed=void 0),f<i.length-1&&o.push(a.move(nr(c,i[f+1],r,t)))}return n.pop(),o.join("")}function nr(r,t,e,n){let i=n.join.length;for(;i--;){let a=n.join[i](r,t,e,n);if(a===!0||a===1)break;if(typeof a=="number")return` | |
`.repeat(1+a);if(a===!1)return` | |
<!----> | |
`}return` | |
`}var or=/\r?\n|\r/g;function Be(r,t){let e=[],n=0,i=0,a;for(;a=or.exec(r);)o(r.slice(n,a.index)),e.push(a[0]),n=a.index+a[0].length,i++;return o(r.slice(n)),e.join("");function o(f){e.push(t(f,i,!f))}}function Fe(r,t,e){let n=(e.before||"")+(t||"")+(e.after||""),i=[],a=[],o={},f=-1;for(;++f<r.unsafe.length;){let u=r.unsafe[f];if(!I(r.stack,u))continue;let s=r.compilePattern(u),h;for(;h=s.exec(n);){let p="before"in u||!!u.atBreak,d="after"in u,m=h.index+(p?h[1].length:0);i.includes(m)?(o[m].before&&!p&&(o[m].before=!1),o[m].after&&!d&&(o[m].after=!1)):(i.push(m),o[m]={before:p,after:d})}}i.sort(ir);let c=e.before?e.before.length:0,l=n.length-(e.after?e.after.length:0);for(f=-1;++f<i.length;){let u=i[f];u<c||u>=l||u+1<l&&i[f+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||i[f-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(c!==u&&a.push(Pe(n.slice(c,u),"\\")),c=u,/[!-/:-@[-`{-~]/.test(n.charAt(u))&&(!e.encode||!e.encode.includes(n.charAt(u)))?a.push("\\"):(a.push("&#x"+n.charCodeAt(u).toString(16).toUpperCase()+";"),c++))}return a.push(Pe(n.slice(c,l),e.after)),a.join("")}function ir(r,t){return r-t}function Pe(r,t){let e=/\\(?=[!-/:-@[-`{-~])/g,n=[],i=[],a=r+t,o=-1,f=0,c;for(;c=e.exec(a);)n.push(c.index);for(;++o<n.length;)f!==n[o]&&i.push(r.slice(f,n[o])),i.push("\\"),f=n[o];return i.push(r.slice(f)),i.join("")}function Te(r){let t=r||{},e=t.now||{},n=t.lineShift||0,i=e.line||1,a=e.column||1;return{move:c,current:o,shift:f};function o(){return{now:{line:i,column:a},lineShift:n}}function f(l){n+=l}function c(l){let u=l||"",s=u.split(/\r?\n|\r/g),h=s[s.length-1];return i+=s.length-1,a=s.length===1?a+h.length:1+h.length+n,u}}function Q(r,t={}){let e={enter:i,indentLines:Be,associationId:Ae,containerPhrasing:lr,containerFlow:ur,createTracker:Te,compilePattern:_e,safe:sr,stack:[],unsafe:[...we],join:[...be],handlers:{...ge},options:{},indexStack:[],handle:void 0};P(e,t),e.options.tightDefinitions&&e.join.push(fr),e.handle=K("type",{invalid:cr,unknown:ar,handlers:e.handlers});let n=e.handle(r,void 0,e,{before:` | |
`,after:` | |
`,now:{line:1,column:1},lineShift:0});return n&&n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=` | |
`),n;function i(a){return e.stack.push(a),o;function o(){e.stack.pop()}}}function cr(r){throw new Error("Cannot handle value `"+r+"`, expected node")}function ar(r){let t=r;throw new Error("Cannot handle unknown node `"+t.type+"`")}function fr(r,t){if(r.type==="definition"&&r.type===t.type)return 0}function lr(r,t){return Se(r,this,t)}function ur(r,t){return Ee(r,this,t)}function sr(r,t){return Fe(this,r,t)}function H(r){let t=this;t.compiler=e;function e(n){return Q(n,{...t.data("settings"),...r,extensions:t.data("toMarkdownExtensions")||[]})}}export{H as default}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment