@lowlighter/markdown 2.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -33
- package/mod.d.ts +34 -0
- package/mod.js +22 -0
- package/package.json +117 -40
- package/plugins/anchors.d.ts +11 -0
- package/plugins/anchors.js +39 -0
- package/plugins/callouts.d.ts +14 -0
- package/plugins/callouts.js +31 -0
- package/plugins/directives.d.ts +24 -0
- package/plugins/directives.js +76 -0
- package/plugins/emojis.d.ts +11 -0
- package/plugins/emojis.js +15 -0
- package/plugins/frontmatter.d.ts +20 -0
- package/plugins/frontmatter.js +49 -0
- package/plugins/gfm.d.ts +18 -0
- package/plugins/gfm.js +43 -0
- package/plugins/{highlighting.ts → highlighting.d.ts} +2 -11
- package/plugins/highlighting.js +24 -0
- package/plugins/markers.d.ts +15 -0
- package/plugins/markers.js +30 -0
- package/plugins/math.d.ts +21 -0
- package/plugins/math.js +75 -0
- package/plugins/mermaid.d.ts +25 -0
- package/plugins/mermaid.js +32 -0
- package/plugins/mod.d.ts +15 -0
- package/plugins/mod.js +14 -0
- package/plugins/{ruby.ts → ruby.d.ts} +2 -11
- package/plugins/ruby.js +28 -0
- package/plugins/uncomments.d.ts +13 -0
- package/plugins/uncomments.js +28 -0
- package/plugins/wikilinks.d.ts +26 -0
- package/plugins/wikilinks.js +45 -0
- package/presets/default.d.ts +3 -0
- package/presets/default.js +9 -0
- package/presets/svg.d.ts +3 -0
- package/presets/svg.js +11 -0
- package/presets/text.d.ts +3 -0
- package/presets/text.js +11 -0
- package/presets/web.d.ts +3 -0
- package/presets/web.js +12 -0
- package/renderer.d.ts +62 -0
- package/renderer.js +70 -0
- package/types.d.ts +85 -0
- package/types.js +10 -0
- package/deno.jsonc +0 -124
- package/deno.lock +0 -2282
- package/mod.mjs +0 -1
- package/mod.ts +0 -2
- package/mod_test.ts +0 -1
- package/plugins/anchors.mjs +0 -1
- package/plugins/anchors.ts +0 -21
- package/plugins/anchors_test.ts +0 -8
- package/plugins/directives.mjs +0 -1
- package/plugins/directives.ts +0 -112
- package/plugins/directives_test.ts +0 -13
- package/plugins/emojis.mjs +0 -1
- package/plugins/emojis.ts +0 -20
- package/plugins/emojis_test.ts +0 -8
- package/plugins/frontmatter.mjs +0 -1
- package/plugins/frontmatter.ts +0 -43
- package/plugins/frontmatter_test.ts +0 -18
- package/plugins/gfm.mjs +0 -1
- package/plugins/gfm.ts +0 -14
- package/plugins/gfm_test.ts +0 -28
- package/plugins/highlighting.mjs +0 -1
- package/plugins/highlighting_test.ts +0 -8
- package/plugins/linebreaks.mjs +0 -1
- package/plugins/linebreaks.ts +0 -21
- package/plugins/linebreaks_test.ts +0 -8
- package/plugins/markers.mjs +0 -1
- package/plugins/markers.ts +0 -25
- package/plugins/markers_test.ts +0 -13
- package/plugins/math.mjs +0 -1
- package/plugins/math.ts +0 -25
- package/plugins/math_test.ts +0 -8
- package/plugins/mermaid.mjs +0 -1
- package/plugins/mermaid.ts +0 -41
- package/plugins/mermaid_test.ts +0 -8
- package/plugins/mod.mjs +0 -1
- package/plugins/mod.ts +0 -14
- package/plugins/ruby.mjs +0 -1
- package/plugins/ruby_test.ts +0 -8
- package/plugins/sanitize.mjs +0 -1
- package/plugins/sanitize.ts +0 -26
- package/plugins/sanitize_test.ts +0 -15
- package/plugins/uncomments.mjs +0 -1
- package/plugins/uncomments.ts +0 -20
- package/plugins/uncomments_test.ts +0 -8
- package/plugins/wikilinks.mjs +0 -1
- package/plugins/wikilinks.ts +0 -40
- package/plugins/wikilinks_test.ts +0 -14
- package/renderer.mjs +0 -1
- package/renderer.ts +0 -138
- package/renderer_test.ts +0 -19
package/plugins/emojis.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Imports
|
|
2
|
-
import type { Plugin } from "../renderer.ts"
|
|
3
|
-
import remarkEmoji from "remark-emoji"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Add support for emojis.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```md
|
|
10
|
-
* :bento:
|
|
11
|
-
* ```
|
|
12
|
-
* ```html
|
|
13
|
-
* <p>🍱</p>
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export default {
|
|
17
|
-
remark(processor) {
|
|
18
|
-
return processor.use(remarkEmoji)
|
|
19
|
-
},
|
|
20
|
-
} as Plugin
|
package/plugins/emojis_test.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "@libs/testing"
|
|
2
|
-
import { Renderer } from "../renderer.ts"
|
|
3
|
-
import plugin from "./emojis.ts"
|
|
4
|
-
|
|
5
|
-
test("deno")("`Plugin.emojis` renders emojis", async () => {
|
|
6
|
-
const markdown = new Renderer({ plugins: [plugin] })
|
|
7
|
-
await expect(markdown.render(":bento:")).resolves.toMatch(/🍱/)
|
|
8
|
-
})
|
package/plugins/frontmatter.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t,e,n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,o=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,l=(t={"node_modules/.deno/format@0.2.2/node_modules/format/format.js"(t,e){!function(){var t;function n(t){for(var e,n,r,i,s=1,o=[].slice.call(arguments),a=0,l=t.length,h="",c=!1,u=!1,p=function(){return o[s++]},f=function(){for(var n="";/\d/.test(t[a]);)n+=t[a++],e=t[a];return n.length>0?parseInt(n):null};a<l;++a)if(e=t[a],c)switch(c=!1,"."==e?(u=!1,e=t[++a]):"0"==e&&"."==t[a+1]?(u=!0,e=t[a+=2]):u=!0,i=f(),e){case"b":h+=parseInt(p(),10).toString(2);break;case"c":h+="string"==typeof(n=p())||n instanceof String?n:String.fromCharCode(parseInt(n,10));break;case"d":h+=parseInt(p(),10);break;case"f":r=String(parseFloat(p()).toFixed(i||6)),h+=u?r:r.replace(/^0/,"");break;case"j":h+=JSON.stringify(p());break;case"o":h+="0"+parseInt(p(),10).toString(8);break;case"s":h+=p();break;case"x":h+="0x"+parseInt(p(),10).toString(16);break;case"X":h+="0x"+parseInt(p(),10).toString(16).toUpperCase();break;default:h+=e}else"%"===e?c=!0:h+=e;return h}(t=void 0!==e?e.exports=n:function(){return this||(0,eval)("this")}()).format=n,t.vsprintf=function(t,e){return n.apply(null,[t].concat(e))},"undefined"!=typeof console&&"function"==typeof console.log&&(t.printf=function(){console.log(n.apply(null,arguments))})}()}},function(){return e||(0,t[s(t)[0]])((e={exports:{}}).exports,e),e.exports});u(/[A-Za-z]/),u(/[\dA-Za-z]/),u(/[#-'*+\--9=?A-Z^-~]/),u(/\d/),u(/[\dA-Fa-f]/),u(/[!-/:-@[-`{-~]/);function h(t){return null!==t&&t<-2}function c(t){return-2===t||-1===t||32===t}u(/\p{P}|\p{S}/u),u(/\s/);function u(t){return function(e){return null!==e&&e>-1&&t.test(String.fromCharCode(e))}}var p=((t,e,l)=>(l=null!=t?n(o(t)):{},((t,e,n,o)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let l of s(e))a.call(t,l)||l===n||r(t,l,{get:()=>e[l],enumerable:!(o=i(e,l))||o.enumerable});return t})(!e&&t&&t.__esModule?l:r(l,"default",{value:t,enumerable:!0}),t)))(l(),1),f=Object.assign(d(Error),{eval:d(EvalError),range:d(RangeError),reference:d(ReferenceError),syntax:d(SyntaxError),type:d(TypeError),uri:d(URIError)});function d(t){return e.displayName=t.displayName||t.name,e;function e(e,...n){const r=e?(0,p.default)(e,...n):e;return new t(r)}}var g={}.hasOwnProperty,m={yaml:"-",toml:"+"};function k(t){const e=[];let n=-1;const r=Array.isArray(t)?t:t?[t]:["yaml"];for(;++n<r.length;)e[n]=y(r[n]);return e}function y(t){let e=t;if("string"==typeof e){if(!g.call(m,e))throw f("Missing matter definition for `%s`",e);e={type:e,marker:m[e]}}else if("object"!=typeof e)throw f("Expected matter to be an object, not `%j`",e);if(!g.call(e,"type"))throw f("Missing `type` in matter `%j`",e);if(!g.call(e,"fence")&&!g.call(e,"marker"))throw f("Missing `marker` or `fence` in matter `%j`",e);return e}function w(t){const e=t.anywhere,n=t.type,r=n+"Fence",i=r+"Sequence",s=n+"Value",o={tokenize:function(t,e,n){let s=0;return function(e){if(e===a.charCodeAt(s))return t.enter(r),t.enter(i),o(e);return n(e)};function o(e){return s===a.length?(t.exit(i),c(e)?(t.enter("whitespace"),l(e)):u(e)):e===a.charCodeAt(s++)?(t.consume(e),o):n(e)}function l(e){return c(e)?(t.consume(e),l):(t.exit("whitespace"),u(e))}function u(i){return null===i||h(i)?(t.exit(r),e(i)):n(i)}},partial:!0};let a,l=0;return{tokenize:function(u,p,f){const d=this;return function(s){const o=d.now();if(1===o.column&&(1===o.line||e)&&(a=b(t,"open"),l=0,s===a.charCodeAt(l)))return u.enter(n),u.enter(r),u.enter(i),g(s);return f(s)};function g(t){return l===a.length?(u.exit(i),c(t)?(u.enter("whitespace"),m(t)):k(t)):t===a.charCodeAt(l++)?(u.consume(t),g):f(t)}function m(t){return c(t)?(u.consume(t),m):(u.exit("whitespace"),k(t))}function k(e){return h(e)?(u.exit(r),u.enter("lineEnding"),u.consume(e),u.exit("lineEnding"),a=b(t,"close"),l=0,u.attempt(o,v,y)):f(e)}function y(t){return null===t||h(t)?x(t):(u.enter(s),w(t))}function w(t){return null===t||h(t)?(u.exit(s),x(t)):(u.consume(t),w)}function x(t){return null===t?f(t):(u.enter("lineEnding"),u.consume(t),u.exit("lineEnding"),u.attempt(o,v,y))}function v(t){return u.exit(n),p(t)}},concrete:!0}}function b(t,e){return t.marker?x(t.marker,e).repeat(3):x(t.fence,e)}function x(t,e){return"string"==typeof t?t:t[e]}function v(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function S(t){return function(e){this.enter({type:t.type,value:""},e),this.buffer()}}function E(t){const e=this.resume(),n=this.stack[this.stack.length-1];this.exit(t),n.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function C(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function I(t){const e=A(t,"open"),n=A(t,"close");return function(t){return e+(t.value?"\n"+t.value:"")+"\n"+n}}function A(t,e){return t.marker?M(t.marker,e).repeat(3):M(t.fence,e)}function M(t,e){return"string"==typeof t?t:t[e]}function N(t){const e=t||"yaml",n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(t){const e=k(t),n={};let r=-1;for(;++r<e.length;){const t=e[r],i=b(t,"open").charCodeAt(0),s=w(t),o=n[i];Array.isArray(o)?o.push(s):n[i]=[s]}return{flow:n}}(e)),i.push(function(t){const e=k(t),n={},r={};let i=-1;for(;++i<e.length;){const t=e[i];n[t.type]=S(t),r[t.type]=E,r[t.type+"Value"]=C}return{enter:n,exit:r}}(e)),s.push(function(t){const e=[],n={},r=k(t);let i=-1;for(;++i<r.length;){const t=r[i];n[t.type]=I(t);const s=A(t,"open");e.push({atBreak:!0,character:s.charAt(0),after:v(s.charAt(1))})}return{unsafe:e,handlers:n}}(e))}var O=function(t){if(null==t)return j;if("function"==typeof t)return F(t);if("object"==typeof t)return Array.isArray(t)?function(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=O(t[n]);return F(r);function r(...t){let n=-1;for(;++n<e.length;)if(e[n].apply(this,t))return!0;return!1}}(t):function(t){const e=t;return F(n);function n(n){const r=n;let i;for(i in t)if(r[i]!==e[i])return!1;return!0}}(t);if("string"==typeof t)return function(t){return F(e);function e(e){return e&&e.type===t}}(t);throw new Error("Expected function, string, or object as test")};function F(t){return function(e,n,r){return Boolean(function(t){return null!==t&&"object"==typeof t&&"type"in t}(e)&&t.call(this,e,"number"==typeof n?n:void 0,r||void 0))}}function j(){return!0}var T=[],$=!0,D=!1;function L(t,e,n,r){let i;"function"==typeof e&&"function"!=typeof n?(r=n,n=e):i=e;const s=O(i),o=r?-1:1;!function t(i,a,l){const h=i&&"object"==typeof i?i:{};if("string"==typeof h.type){const t="string"==typeof h.tagName?h.tagName:"string"==typeof h.name?h.name:void 0;Object.defineProperty(c,"name",{value:"node ("+i.type+(t?"<"+t+">":"")+")"})}return c;function c(){let h,c,u,p=T;if((!e||s(i,a,l[l.length-1]||void 0))&&(p=function(t){if(Array.isArray(t))return t;if("number"==typeof t)return[$,t];return null==t?T:[t]}(n(i,l)),p[0]===D))return p;if("children"in i&&i.children){const e=i;if(e.children&&"skip"!==p[0])for(c=(r?e.children.length:-1)+o,u=l.concat(e);c>-1&&c<e.children.length;){const n=e.children[c];if(h=t(n,c,u)(),h[0]===D)return h;c="number"==typeof h[1]?h[1]:c+o}}return p}}(t,void 0,[])()}var P=45;function _(t){return 10===t||13===t}function B(t){return 9===t||32===t}function q(t){return B(t)||_(t)}function U(t){return 44===t||91===t||93===t||123===t||125===t}var Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var R={tag:"tag:yaml.org,2002:binary",construct:function(t){const e=t.replace(/[\r\n=]/g,""),n=e.length,r=Y,i=[];let s=0;for(let t=0;t<n;t++)t%4==0&&t&&(i.push(s>>16&255),i.push(s>>8&255),i.push(255&s)),s=s<<6|r.indexOf(e.charAt(t));const o=n%4*6;return 0===o?(i.push(s>>16&255),i.push(s>>8&255),i.push(255&s)):18===o?(i.push(s>>10&255),i.push(s>>2&255)):12===o&&i.push(s>>4&255),new Uint8Array(i)},kind:"scalar",predicate:function(t){return t instanceof Uint8Array},represent:function(t){const e=t.length,n=Y;let r="",i=0;for(let s=0;s<e;s++)s%3==0&&s&&(r+=n[i>>18&63],r+=n[i>>12&63],r+=n[i>>6&63],r+=n[63&i]),i=(i<<8)+t[s];const s=e%3;return 0===s?(r+=n[i>>18&63],r+=n[i>>12&63],r+=n[i>>6&63],r+=n[63&i]):2===s?(r+=n[i>>10&63],r+=n[i>>4&63],r+=n[i<<2&63],r+=n[64]):1===s&&(r+=n[i>>2&63],r+=n[i<<4&63],r+=n[64],r+=n[64]),r},resolve:function(t){if(null===t)return!1;let e,n=0;const r=t.length,i=Y;for(let s=0;s<r;s++)if(e=i.indexOf(t.charAt(s)),!(e>64)){if(e<0)return!1;n+=6}return n%8==0}},W=["true","True","TRUE"],z=[...W,"false","False","FALSE"],V={tag:"tag:yaml.org,2002:bool",kind:"scalar",defaultStyle:"lowercase",predicate:t=>"boolean"==typeof t||t instanceof Boolean,construct:t=>W.includes(t),resolve:t=>z.includes(t),represent:{lowercase:t=>(t instanceof Boolean?t.valueOf():t)?"true":"false",uppercase:t=>(t instanceof Boolean?t.valueOf():t)?"TRUE":"FALSE",camelcase:t=>(t instanceof Boolean?t.valueOf():t)?"True":"False"}};function G(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t}function H(t){return"[object Object]"===Object.prototype.toString.call(t)}var K=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var Q=/^[-+]?[0-9]+e/;var Z={tag:"tag:yaml.org,2002:float",construct:function(t){let e=t.replace(/_/g,"").toLowerCase();const n="-"===e[0]?-1:1;return e[0]&&"+-".includes(e[0])&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:n*parseFloat(e)},defaultStyle:"lowercase",kind:"scalar",predicate:function(t){return t instanceof Number&&(t=t.valueOf()),"number"==typeof t&&(t%1!=0||G(t))},represent:function(t,e){const n=t instanceof Number?t.valueOf():t;if(isNaN(n))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===n)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===n)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(G(n))return"-0.0";const r=n.toString(10);return Q.test(r)?r.replace("e",".e"):r},resolve:function(t){return!(!K.test(t)||"_"===t[t.length-1])}};function J(t,e,n){return e<=t&&t<=n}function X(t){return J(t,48,55)}function tt(t){return J(t,48,57)}var et={tag:"tag:yaml.org,2002:int",construct:function(t){let e=t;e.includes("_")&&(e=e.replace(/_/g,""));let n=1,r=e[0];return"-"!==r&&"+"!==r||("-"===r&&(n=-1),e=e.slice(1),r=e[0]),"0"===e?0:"0"===r?"b"===e[1]?n*parseInt(e.slice(2),2):"x"===e[1]?n*parseInt(e,16):n*parseInt(e,8):n*parseInt(e,10)},defaultStyle:"decimal",kind:"scalar",predicate:function(t){return t instanceof Number&&(t=t.valueOf()),"number"==typeof t&&t%1==0&&!G(t)},represent:{binary(t){const e=t instanceof Number?t.valueOf():t;return e>=0?`0b${e.toString(2)}`:`-0b${e.toString(2).slice(1)}`},octal(t){const e=t instanceof Number?t.valueOf():t;return e>=0?`0${e.toString(8)}`:`-0${e.toString(8).slice(1)}`},decimal:t=>(t instanceof Number?t.valueOf():t).toString(10),hexadecimal(t){const e=t instanceof Number?t.valueOf():t;return e>=0?`0x${e.toString(16).toUpperCase()}`:`-0x${e.toString(16).toUpperCase().slice(1)}`}},resolve:function(t){const e=t.length;let n=0,r=!1;if(!e)return!1;let i=t[n];if("-"!==i&&"+"!==i||(i=t[++n]),"0"===i){if(n+1===e)return!0;if(i=t[++n],"b"===i){for(n++;n<e;n++)if(i=t[n],"_"!==i){if("0"!==i&&"1"!==i)return!1;r=!0}return r&&"_"!==i}if("x"===i){for(n++;n<e;n++)if(i=t[n],"_"!==i){if(!(J(s=t.charCodeAt(n),48,57)||J(s,65,70)||J(s,97,102)))return!1;r=!0}return r&&"_"!==i}for(;n<e;n++)if(i=t[n],"_"!==i){if(!X(t.charCodeAt(n)))return!1;r=!0}return r&&"_"!==i}var s;if("_"===i)return!1;for(;n<e;n++)if(i=t[n],"_"!==i){if(!tt(t.charCodeAt(n)))return!1;r=!0}return!(!r||"_"===i)&&/^(:[0-5]?[0-9])+$/.test(t.slice(n))}},nt={tag:"tag:yaml.org,2002:map",resolve:()=>!0,construct:t=>null!==t?t:{},kind:"mapping"};var rt={tag:"tag:yaml.org,2002:omap",kind:"sequence",resolve:function(t){const e=new Set;for(const n of t){if(!H(n))return!1;const t=Object.keys(n);if(1!==t.length)return!1;for(const n of t){if(e.has(n))return!1;e.add(n)}}return!0},construct:t=>t};var it={tag:"tag:yaml.org,2002:pairs",construct:t=>t?.flatMap(Object.entries)??[],kind:"sequence",resolve:function(t){return null===t||t.every((t=>H(t)&&1===Object.keys(t).length))}},st=/^\/(?<regexp>[\s\S]+)\/(?<modifiers>[gismuy]*)$/,ot={tag:"tag:yaml.org,2002:js/regexp",kind:"scalar",resolve(t){if(null===t||!t.length)return!1;if("/"===t.charAt(0)){const e=t.match(st)?.groups;if(!e)return!1;const n=e.modifiers??"";if(new Set(n).size<n.length)return!1}return!0},construct(t){const{regexp:e=t,modifiers:n=""}=t.match(st)?.groups??{};return new RegExp(e,n)},predicate:t=>t instanceof RegExp,represent:t=>t.toString()},at={tag:"tag:yaml.org,2002:set",kind:"mapping",construct:t=>null!==t?t:{},resolve:t=>null===t||Object.values(t).every((t=>null===t))},lt=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ht=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var ct={tag:"tag:yaml.org,2002:timestamp",construct:function(t){let e=lt.exec(t);if(null===e&&(e=ht.exec(t)),null===e)throw new Error("Cannot construct YAML timestamp: date resolve error");const n=+e[1],r=+e[2]-1,i=+e[3];if(!e[4])return new Date(Date.UTC(n,r,i));const s=+e[4],o=+e[5],a=+e[6];let l=0;if(e[7]){let t=e[7].slice(0,3);for(;t.length<3;)t+="0";l=+t}let h=null;if(e[9]&&e[10]){h=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(h=-h)}const c=new Date(Date.UTC(n,r,i,s,o,a,l));return h&&c.setTime(c.getTime()-h),c},predicate:t=>t instanceof Date,kind:"scalar",represent:function(t){return t.toISOString()},resolve:function(t){return null!==t&&(null!==lt.exec(t)||null!==ht.exec(t))}},ut={tag:"tag:yaml.org,2002:js/undefined",kind:"scalar",resolve:()=>!0,construct(){},predicate:t=>void 0===t,represent:()=>""};function pt({explicitTypes:t=[],implicitTypes:e=[],include:n}){n&&(e.push(...n.implicitTypes),t.push(...n.explicitTypes));const r=function(t,e){const n={fallback:new Map,mapping:new Map,scalar:new Map,sequence:new Map},r=n.fallback;for(const i of[...t,...e])n[i.kind].set(i.tag,i),r.set(i.tag,i);return n}(e,t);return{implicitTypes:e,explicitTypes:t,typeMap:r}}var ft=pt({explicitTypes:[{tag:"tag:yaml.org,2002:str",kind:"scalar",resolve:()=>!0,construct:t=>null!==t?t:""},{tag:"tag:yaml.org,2002:seq",kind:"sequence",resolve:()=>!0,construct:t=>null!==t?t:[]},nt]}),dt=pt({implicitTypes:[{tag:"tag:yaml.org,2002:null",kind:"scalar",defaultStyle:"lowercase",predicate:t=>null===t,construct:()=>null,resolve:t=>"~"===t||"null"===t||"Null"===t||"NULL"===t,represent:{lowercase:()=>"null",uppercase:()=>"NULL",camelcase:()=>"Null"}},V,et,Z],include:ft}),gt=pt({include:dt}),mt=pt({explicitTypes:[R,rt,it,at],implicitTypes:[ct,{tag:"tag:yaml.org,2002:merge",kind:"scalar",resolve:t=>"<<"===t||null===t,construct:t=>t}],include:gt}),kt=pt({explicitTypes:[ot,ut],include:mt}),yt=new Map([["core",gt],["default",mt],["failsafe",ft],["json",dt],["extended",kt]]),wt=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,bt=/[\x85\u2028\u2029]/,xt=/[,\[\]\{\}]/,vt=/^(?:!|!!|![a-z\-]+!)$/i,St=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i,Et=new Map([[120,2],[117,4],[85,8]]),Ct=new Map([[48,"\0"],[97,""],[98,"\b"],[116,"\t"],[9,"\t"],[110,"\n"],[118,"\v"],[102,"\f"],[114,"\r"],[101,""],[32," "],[34,'"'],[47,"/"],[92,"\\"],[78,"
"],[95," "],[76,"\u2028"],[80,"\u2029"]]);function It(t){if(48<=t&&t<=57)return t-48;const e=32|t;return 97<=e&&e<=102?e-97+10:-1}var At="\0\r\n
\u2028\u2029";function Mt(t,e,n,r){let i=`at line ${n+1}, column ${r+1}`;const s=function(t,e){if(!t)return null;let n=e,r=e,i="",s="";for(;n>0&&!At.includes(t.charAt(n-1));)if(n--,e-n>36.5){i=" ... ",n+=5;break}for(;r<t.length&&!At.includes(t.charAt(r));)if(r++,r-e>36.5){s=" ... ",r-=5;break}const o=t.slice(n,r);return`${" ".repeat(4)+i+o+s}\n${" ".repeat(4+e-n+i.length)}^`}(t,e);return s&&(i+=`:\n${s}`),i}var Nt=class{input;length;lineIndent=0;lineStart=0;position=0;line=0;onWarning;allowDuplicateKeys;implicitTypes;typeMap;version;checkLineBreaks=!1;tagMap=new Map;anchorMap=new Map;tag;anchor;kind;result="";constructor(t,{schema:e=mt,onWarning:n,allowDuplicateKeys:r=!1}){this.input=t,this.onWarning=n,this.allowDuplicateKeys=r,this.implicitTypes=e.implicitTypes,this.typeMap=e.typeMap,this.length=t.length,this.version=null,this.readIndent()}readIndent(){let t=this.peek();for(;32===t;)this.lineIndent+=1,t=this.next()}peek(t=0){return this.input.charCodeAt(this.position+t)}next(){return this.position+=1,this.peek()}#t(t){const e=Mt(this.input,this.position,this.line,this.position-this.lineStart);return new SyntaxError(`${t} ${e}`)}throwError(t){throw this.#t(t)}dispatchWarning(t){const e=this.#t(t);this.onWarning?.(e)}yamlDirectiveHandler(...t){if(null!==this.version)return this.throwError("Cannot handle YAML directive: duplication of %YAML directive");if(1!==t.length)return this.throwError("Cannot handle YAML directive: YAML directive accepts exactly one argument");const e=/^([0-9]+)\.([0-9]+)$/.exec(t[0]);if(null===e)return this.throwError("Cannot handle YAML directive: ill-formed argument");const n=parseInt(e[1],10),r=parseInt(e[2],10);return 1!==n?this.throwError("Cannot handle YAML directive: unacceptable YAML version"):(this.version=t[0]??null,this.checkLineBreaks=r<2,1!==r&&2!==r?this.dispatchWarning("Cannot handle YAML directive: unsupported YAML version"):void 0)}tagDirectiveHandler(...t){if(2!==t.length)return this.throwError(`Cannot handle tag directive: directive accepts exactly two arguments, received ${t.length}`);const e=t[0],n=t[1];return vt.test(e)?this.tagMap.has(e)?this.throwError(`Cannot handle tag directive: previously declared suffix for "${e}" tag handle`):St.test(n)?void this.tagMap.set(e,n):this.throwError("Cannot handle tag directive: ill-formed tag prefix (second argument) of the TAG directive"):this.throwError(`Cannot handle tag directive: ill-formed handle (first argument) in "${e}"`)}captureSegment(t,e,n){let r;if(t<e){if(r=this.input.slice(t,e),n)for(let t=0;t<r.length;t++){const e=r.charCodeAt(t);if(!(9===e||32<=e&&e<=1114111))return this.throwError(`Expected valid JSON character: received "${e}"`)}else if(wt.test(r))return this.throwError("Stream contains non-printable characters");this.result+=r}}readBlockSequence(t){let e,n,r,i=!1;const s=this.tag,o=this.anchor,a=[];for(null!==this.anchor&&void 0!==this.anchor&&this.anchorMap.set(this.anchor,a),r=this.peek();0!==r&&r===P&&(n=this.peek(1),q(n));)if(i=!0,this.position++,this.skipSeparationSpace(!0,-1)&&this.lineIndent<=t)a.push(null),r=this.peek();else{if(e=this.line,this.composeNode(t,3,!1,!0),a.push(this.result),this.skipSeparationSpace(!0,-1),r=this.peek(),(this.line===e||this.lineIndent>t)&&0!==r)return this.throwError("Cannot read block sequence: bad indentation of a sequence entry");if(this.lineIndent<t)break}return!!i&&(this.tag=s,this.anchor=o,this.kind="sequence",this.result=a,!0)}mergeMappings(t,e,n){if(null===(r=e)||"object"!=typeof r)return this.throwError("Cannot merge mappings: the provided source object is unacceptable");var r;for(const[r,i]of Object.entries(e))Object.hasOwn(t,r)||(Object.defineProperty(t,r,{value:i,writable:!0,enumerable:!0,configurable:!0}),n.add(r))}storeMappingPair(t,e,n,r,i,s,o){if(Array.isArray(r)){r=Array.prototype.slice.call(r);for(let t=0;t<r.length;t++){if(Array.isArray(r[t]))return this.throwError("Cannot store mapping pair: nested arrays are not supported inside keys");"object"==typeof r&&H(r[t])&&(r[t]="[object Object]")}}if("object"==typeof r&&H(r)&&(r="[object Object]"),r=String(r),"tag:yaml.org,2002:merge"===n)if(Array.isArray(i))for(let n=0;n<i.length;n++)this.mergeMappings(t,i[n],e);else this.mergeMappings(t,i,e);else{if(!this.allowDuplicateKeys&&!e.has(r)&&Object.hasOwn(t,r))return this.line=s||this.line,this.position=o||this.position,this.throwError("Cannot store mapping pair: duplicated key");Object.defineProperty(t,r,{value:i,writable:!0,enumerable:!0,configurable:!0}),e.delete(r)}return t}readLineBreak(){const t=this.peek();if(10===t)this.position++;else{if(13!==t)return this.throwError("Cannot read line: line break not found");this.position++,10===this.peek()&&this.position++}this.line+=1,this.lineStart=this.position}skipSeparationSpace(t,e){let n=0,r=this.peek();for(;0!==r;){for(;B(r);)r=this.next();if(t&&35===r)do{r=this.next()}while(10!==r&&13!==r&&0!==r);if(!_(r))break;this.readLineBreak(),r=this.peek(),n++,this.lineIndent=0,this.readIndent(),r=this.peek()}return-1!==e&&0!==n&&this.lineIndent<e&&this.dispatchWarning("deficient indentation"),n}testDocumentSeparator(){let t=this.peek();return!(t!==P&&46!==t||t!==this.peek(1)||t!==this.peek(2)||(t=this.peek(3),0!==t&&!q(t)))}writeFoldedLines(t){1===t?this.result+=" ":t>1&&(this.result+="\n".repeat(t-1))}readPlainScalar(t,e){const n=this.kind,r=this.result;let i,s=this.peek();if(q(s)||U(s)||35===s||38===s||42===s||33===s||124===s||62===s||39===s||34===s||37===s||64===s||96===s)return!1;if((63===s||s===P)&&(i=this.peek(1),q(i)||e&&U(i)))return!1;this.kind="scalar",this.result="";let o=this.position,a=this.position,l=!1,h=0;for(;0!==s;){if(58===s){if(i=this.peek(1),q(i)||e&&U(i))break}else if(35===s){if(q(this.peek(-1)))break}else{if(this.position===this.lineStart&&this.testDocumentSeparator()||e&&U(s))break;if(_(s)){h=this.line;const e=this.lineStart,n=this.lineIndent;if(this.skipSeparationSpace(!1,-1),this.lineIndent>=t){l=!0,s=this.peek();continue}this.position=o,this.line=h,this.lineStart=e,this.lineIndent=n;break}}l&&(this.captureSegment(a,o,!1),this.writeFoldedLines(this.line-h),a=o=this.position,l=!1),B(s)||(o=this.position+1),s=this.next()}return this.captureSegment(a,o,!1),!!this.result||(this.kind=n,this.result=r,!1)}readSingleQuotedScalar(t){let e,n,r;if(e=this.peek(),39!==e)return!1;for(this.kind="scalar",this.result="",this.position++,n=r=this.position;0!==(e=this.peek());)if(39===e){if(this.captureSegment(n,this.position,!0),e=this.next(),39!==e)return!0;n=this.position,this.position++,r=this.position}else if(_(e))this.captureSegment(n,r,!0),this.writeFoldedLines(this.skipSeparationSpace(!1,t)),n=r=this.position;else{if(this.position===this.lineStart&&this.testDocumentSeparator())return this.throwError("Unexpected end of the document within a single quoted scalar");this.position++,r=this.position}return this.throwError("Unexpected end of the stream within a single quoted scalar")}readDoubleQuotedScalar(t){let e=this.peek();if(34!==e)return!1;this.kind="scalar",this.result="",this.position++;let n,r=this.position,i=this.position;for(;0!==(e=this.peek());){if(34===e)return this.captureSegment(i,this.position,!0),this.position++,!0;if(92===e){if(this.captureSegment(i,this.position,!0),e=this.next(),_(e))this.skipSeparationSpace(!1,t);else if(e<256&&Ct.has(e))this.result+=Ct.get(e),this.position++;else{if(!((n=Et.get(e)??0)>0))return this.throwError("Cannot read double quoted scalar: unknown escape sequence");{let t=n,r=0;for(;t>0;t--){if(e=this.next(),!((n=It(e))>=0))return this.throwError("Cannot read double quoted scalar: expected hexadecimal character");r=(r<<4)+n}this.result+=(s=r)<=65535?String.fromCharCode(s):String.fromCharCode(55296+(s-65536>>10),56320+(s-65536&1023)),this.position++}}i=r=this.position}else if(_(e))this.captureSegment(i,r,!0),this.writeFoldedLines(this.skipSeparationSpace(!1,t)),i=r=this.position;else{if(this.position===this.lineStart&&this.testDocumentSeparator())return this.throwError("Unexpected end of the document within a double quoted scalar");this.position++,r=this.position}}var s;return this.throwError("Unexpected end of the stream within a double quoted scalar")}readFlowCollection(t){let e,n=this.peek(),r=!0,i={};if(91===n)e=93,r=!1,i=[];else{if(123!==n)return!1;e=125}null!==this.anchor&&void 0!==this.anchor&&this.anchorMap.set(this.anchor,i),n=this.next();const s=this.tag,o=this.anchor;let a=!0,l=null,h=null,c=null,u=!1,p=!1,f=0,d=0;const g=new Set;for(;0!==n;){if(this.skipSeparationSpace(!0,t),n=this.peek(),n===e)return this.position++,this.tag=s,this.anchor=o,this.kind=r?"mapping":"sequence",this.result=i,!0;if(!a)return this.throwError("Cannot read flow collection: missing comma between flow collection entries");c=h=l=null,p=u=!1,63===n&&(f=this.peek(1),q(f)&&(p=u=!0,this.position++,this.skipSeparationSpace(!0,t))),d=this.line,this.composeNode(t,1,!1,!0),c=this.tag||null,h=this.result,this.skipSeparationSpace(!0,t),n=this.peek(),!u&&this.line!==d||58!==n||(p=!0,n=this.next(),this.skipSeparationSpace(!0,t),this.composeNode(t,1,!1,!0),l=this.result),r?this.storeMappingPair(i,g,c,h,l):p?i.push(this.storeMappingPair({},g,c,h,l)):i.push(h),this.skipSeparationSpace(!0,t),n=this.peek(),44===n?(a=!0,n=this.next()):a=!1}return this.throwError("Cannot read flow collection: unexpected end of the stream within a flow collection")}readBlockScalar(t){let e=1,n=!1,r=!1,i=t,s=0,o=!1,a=this.peek(),l=!1;if(124===a)l=!1;else{if(62!==a)return!1;l=!0}this.kind="scalar",this.result="";let h=0;for(;0!==a;)if(a=this.next(),43===a||a===P){if(1!==e)return this.throwError("Cannot read block: chomping mode identifier repeated");e=43===a?3:2}else{if(!((h=48<=(c=a)&&c<=57?c-48:-1)>=0))break;if(0===h)return this.throwError("Cannot read block: indentation width must be greater than 0");if(r)return this.throwError("Cannot read block: indentation width identifier repeated");i=t+h-1,r=!0}var c;if(B(a)){do{a=this.next()}while(B(a));if(35===a)do{a=this.next()}while(!_(a)&&0!==a)}for(;0!==a;){for(this.readLineBreak(),this.lineIndent=0,a=this.peek();(!r||this.lineIndent<i)&&32===a;)this.lineIndent++,a=this.next();if(!r&&this.lineIndent>i&&(i=this.lineIndent),_(a)){s++;continue}if(this.lineIndent<i){3===e?this.result+="\n".repeat(n?1+s:s):1===e&&n&&(this.result+="\n");break}l?B(a)?(o=!0,this.result+="\n".repeat(n?1+s:s)):o?(o=!1,this.result+="\n".repeat(s+1)):0===s?n&&(this.result+=" "):this.result+="\n".repeat(s):this.result+="\n".repeat(n?1+s:s),n=!0,r=!0,s=0;const t=this.position;for(;!_(a)&&0!==a;)a=this.next();this.captureSegment(t,this.position,!1)}return!0}readBlockMapping(t,e){const n=this.tag,r=this.anchor,i={},s=new Set;let o,a,l,h,c=!1,u=null,p=null,f=null,d=!1,g=!1;for(null!==this.anchor&&void 0!==this.anchor&&this.anchorMap.set(this.anchor,i),h=this.peek();0!==h;){if(o=this.peek(1),a=this.line,l=this.position,63!==h&&58!==h||!q(o)){if(!this.composeNode(e,2,!1,!0))break;if(this.line!==a)return g?this.throwError("Cannot read a block mapping entry: a multiline key may not be an implicit key"):(this.tag=n,this.anchor=r,!0);for(h=this.peek();B(h);)h=this.next();if(58!==h)return g?this.throwError("Cannot read an implicit mapping pair: missing colon"):(this.tag=n,this.anchor=r,!0);if(h=this.next(),!q(h))return this.throwError("Cannot read block: a whitespace character is expected after the key-value separator within a block mapping");d&&(this.storeMappingPair(i,s,u,p,null),u=p=f=null),g=!0,d=!1,c=!1,u=this.tag,p=this.result}else{if(63===h)d&&(this.storeMappingPair(i,s,u,p,null),u=p=f=null),g=!0,d=!0,c=!0;else{if(!d)return this.throwError("Cannot read block as explicit mapping pair is incomplete: a key node is missed or followed by a non-tabulated empty line");d=!1,c=!0}this.position+=1,h=o}if((this.line===a||this.lineIndent>t)&&(this.composeNode(t,4,!0,c)&&(d?p=this.result:f=this.result),d||(this.storeMappingPair(i,s,u,p,f,a,l),u=p=f=null),this.skipSeparationSpace(!0,-1),h=this.peek()),this.lineIndent>t&&0!==h)return this.throwError("Cannot read block: bad indentation of a mapping entry");if(this.lineIndent<t)break}return d&&this.storeMappingPair(i,s,u,p,null),g&&(this.tag=n,this.anchor=r,this.kind="mapping",this.result=i),g}readTagProperty(){let t,e,n,r=!1,i=!1,s="";if(n=this.peek(),33!==n)return!1;if(null!==this.tag)return this.throwError("Cannot read tag property: duplication of a tag property");if(n=this.next(),60===n?(r=!0,n=this.next()):33===n?(i=!0,s="!!",n=this.next()):s="!",t=this.position,r){do{n=this.next()}while(0!==n&&62!==n);if(!(this.position<this.length))return this.throwError("Cannot read tag property: unexpected end of stream");e=this.input.slice(t,this.position),n=this.next()}else{for(;0!==n&&!q(n);){if(33===n){if(i)return this.throwError("Cannot read tag property: tag suffix cannot contain an exclamation mark");if(s=this.input.slice(t-1,this.position+1),!vt.test(s))return this.throwError("Cannot read tag property: named tag handle contains invalid characters");i=!0,t=this.position+1}n=this.next()}if(e=this.input.slice(t,this.position),xt.test(e))return this.throwError("Cannot read tag property: tag suffix cannot contain flow indicator characters")}if(e&&!St.test(e))return this.throwError(`Cannot read tag property: invalid characters in tag name "${e}"`);if(r)this.tag=e;else if(this.tagMap.has(s))this.tag=this.tagMap.get(s)+e;else if("!"===s)this.tag=`!${e}`;else{if("!!"!==s)return this.throwError(`Cannot read tag property: undeclared tag handle "${s}"`);this.tag=`tag:yaml.org,2002:${e}`}return!0}readAnchorProperty(){let t=this.peek();if(38!==t)return!1;if(null!==this.anchor)return this.throwError("Cannot read anchor property: duplicate anchor property");t=this.next();const e=this.position;for(;0!==t&&!q(t)&&!U(t);)t=this.next();return this.position===e?this.throwError("Cannot read anchor property: name of an anchor node must contain at least one character"):(this.anchor=this.input.slice(e,this.position),!0)}readAlias(){if(42!==this.peek())return!1;let t=this.next();const e=this.position;for(;0!==t&&!q(t)&&!U(t);)t=this.next();if(this.position===e)return this.throwError("Cannot read alias: alias name must contain at least one character");const n=this.input.slice(e,this.position);return this.anchorMap.has(n)?(this.result=this.anchorMap.get(n),this.skipSeparationSpace(!0,-1),!0):this.throwError(`Cannot read alias: unidentified alias "${n}"`)}composeNode(t,e,n,r){let i,s,o,a,l,h=1,c=!1,u=!1;this.tag=null,this.anchor=null,this.kind=null,this.result=null;const p=i=s=4===e||3===e;if(n&&this.skipSeparationSpace(!0,-1)&&(c=!0,this.lineIndent>t?h=1:this.lineIndent===t?h=0:this.lineIndent<t&&(h=-1)),1===h)for(;this.readTagProperty()||this.readAnchorProperty();)this.skipSeparationSpace(!0,-1)?(c=!0,s=p,this.lineIndent>t?h=1:this.lineIndent===t?h=0:this.lineIndent<t&&(h=-1)):s=!1;if(s&&(s=c||r),1===h||4===e){if(a=1===e||2===e?t:t+1,l=this.position-this.lineStart,1===h)if(s&&(this.readBlockSequence(l)||this.readBlockMapping(l,a))||this.readFlowCollection(a))u=!0;else{if(i&&this.readBlockScalar(a)||this.readSingleQuotedScalar(a)||this.readDoubleQuotedScalar(a))u=!0;else if(this.readAlias()){if(u=!0,null!==this.tag||null!==this.anchor)return this.throwError("Cannot compose node: alias node should not have any properties")}else this.readPlainScalar(a,1===e)&&(u=!0,null===this.tag&&(this.tag="?"));null!==this.anchor&&this.anchorMap.set(this.anchor,this.result)}else 0===h&&(u=s&&this.readBlockSequence(l))}if(null!==this.tag&&"!"!==this.tag)if("?"===this.tag){for(let t=0;t<this.implicitTypes.length;t++)if(o=this.implicitTypes[t],o.resolve(this.result)){this.result=o.construct(this.result),this.tag=o.tag,null!==this.anchor&&this.anchorMap.set(this.anchor,this.result);break}}else{if(!this.typeMap[this.kind??"fallback"].has(this.tag))return this.throwError(`Cannot resolve unknown tag !<${this.tag}>`);if(o=this.typeMap[this.kind??"fallback"].get(this.tag),null!==this.result&&o.kind!==this.kind)return this.throwError(`Unacceptable node kind for !<${this.tag}> tag: it should be "${o.kind}", not "${this.kind}"`);if(!o.resolve(this.result))return this.throwError(`Cannot resolve a node with !<${this.tag}> explicit tag`);this.result=o.construct(this.result),null!==this.anchor&&this.anchorMap.set(this.anchor,this.result)}return null!==this.tag||null!==this.anchor||u}readDocument(){const t=this.position;let e,n,r,i,s=!1;for(this.version=null,this.checkLineBreaks=!1,this.tagMap=new Map,this.anchorMap=new Map;0!==(i=this.peek())&&(this.skipSeparationSpace(!0,-1),i=this.peek(),!(this.lineIndent>0||37!==i));){for(s=!0,i=this.next(),e=this.position;0!==i&&!q(i);)i=this.next();if(n=this.input.slice(e,this.position),r=[],n.length<1)return this.throwError("Cannot read document: directive name length must be greater than zero");for(;0!==i;){for(;B(i);)i=this.next();if(35===i){do{i=this.next()}while(0!==i&&!_(i));break}if(_(i))break;for(e=this.position;0!==i&&!q(i);)i=this.next();r.push(this.input.slice(e,this.position))}switch(0!==i&&this.readLineBreak(),n){case"YAML":this.yamlDirectiveHandler(...r);break;case"TAG":this.tagDirectiveHandler(...r);break;default:this.dispatchWarning(`unknown document directive "${n}"`)}}if(this.skipSeparationSpace(!0,-1),0===this.lineIndent&&this.peek()===P&&this.peek(1)===P&&this.peek(2)===P)this.position+=3,this.skipSeparationSpace(!0,-1);else if(s)return this.throwError("Cannot read document: directives end mark is expected");if(this.composeNode(this.lineIndent-1,4,!1,!0),this.skipSeparationSpace(!0,-1),this.checkLineBreaks&&bt.test(this.input.slice(t,this.position))&&this.dispatchWarning("non-ASCII line breaks are interpreted as content"),this.position===this.lineStart&&this.testDocumentSeparator())46===this.peek()&&(this.position+=3,this.skipSeparationSpace(!0,-1));else if(this.position<this.length-1)return this.throwError("Cannot read document: end of the stream or a document separator is expected");return this.result}*readDocuments(){for(;this.position<this.length-1;)yield this.readDocument()}};function Ot(t,e={}){var n;n=t,(n=String(n)).length>0&&(_(n.charCodeAt(n.length-1))||(n+="\n"),65279===n.charCodeAt(0)&&(n=n.slice(1)));const r=new Nt(t=n+"\0",{...e,schema:yt.get(e.schema)}).readDocuments(),i=r.next().value;if(!r.next().done)throw new SyntaxError("Found more than 1 document in the stream: expected a single document");return i??null}var Ft={remark:(t,e)=>t.use(N).use((function(){return function(t,n){!function(t,e,n,r){let i,s,o;"function"==typeof e&&"function"!=typeof n?(s=void 0,o=e,i=n):(s=e,o=n,i=r),L(t,s,(function(t,e){const n=e[e.length-1],r=n?n.children.indexOf(t):void 0;return o(t,r,n)}),i)}(t,(t=>{if("yaml"===t.type){const r=n.id;e.storage[r].frontmatter=Ot(t.value)}}))}}))};export{Ft as default};
|
package/plugins/frontmatter.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Imports
|
|
2
|
-
import type { Plugin } from "../renderer.ts"
|
|
3
|
-
import type { Arg } from "@libs/typing/types"
|
|
4
|
-
import type { Parser } from "unified"
|
|
5
|
-
import remarkFrontmatter from "remark-frontmatter"
|
|
6
|
-
import { visit } from "unist-util-visit"
|
|
7
|
-
import * as YAML from "@std/yaml/parse"
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Support for frontmatter.
|
|
11
|
-
*
|
|
12
|
-
* Passing `metadata: true` to the the markdown rendering method is required to retrieve the frontmatter.
|
|
13
|
-
* The frontmatter is automatically parsed as YAML.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```md
|
|
17
|
-
* ---
|
|
18
|
-
* title: foo
|
|
19
|
-
* ---
|
|
20
|
-
* ```
|
|
21
|
-
* ```ts
|
|
22
|
-
* import { Renderer } from "../renderer.ts"
|
|
23
|
-
* import frontmatter from "./frontmatter.ts"
|
|
24
|
-
*
|
|
25
|
-
* const markdown = new Renderer({ plugins: [frontmatter] })
|
|
26
|
-
* const { metadata } = await markdown.render("...", { metadata: true })
|
|
27
|
-
* console.log(metadata.frontmatter) // { title: "foo" }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export default {
|
|
31
|
-
remark(processor, renderer) {
|
|
32
|
-
return processor.use(remarkFrontmatter).use(function () {
|
|
33
|
-
return function (tree: Arg<typeof visit>, vfile: Arg<Parser, 1>) {
|
|
34
|
-
visit(tree, (node) => {
|
|
35
|
-
if (node.type === "yaml") {
|
|
36
|
-
const id = (vfile as unknown as { id: string }).id
|
|
37
|
-
renderer.storage[id].frontmatter = YAML.parse((node as unknown as { value: string }).value)
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
},
|
|
43
|
-
} as Plugin
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "@libs/testing"
|
|
2
|
-
import { Renderer } from "../renderer.ts"
|
|
3
|
-
import plugin from "./frontmatter.ts"
|
|
4
|
-
|
|
5
|
-
test("deno")("`Plugin.frontmatter` removes frontmatter", async () => {
|
|
6
|
-
const text = `
|
|
7
|
-
---
|
|
8
|
-
foo: bar
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
content
|
|
12
|
-
`.trim()
|
|
13
|
-
const markdown = new Renderer({ plugins: [plugin] })
|
|
14
|
-
const { value, metadata } = await markdown.render(text, { metadata: true })
|
|
15
|
-
expect(value).not.toContain("---\nfoo: bar\n---")
|
|
16
|
-
expect(value).toMatch(/content/)
|
|
17
|
-
expect(metadata).toEqual({ frontmatter: { foo: "bar" } })
|
|
18
|
-
})
|
package/plugins/gfm.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}var t=c(/[A-Za-z]/),n=c(/[\dA-Za-z]/);c(/[#-'*+\--9=?A-Z^-~]/);c(/\d/),c(/[\dA-Fa-f]/),c(/[!-/:-@[-`{-~]/);function r(e){return null!==e&&e<-2}function i(e){return null!==e&&(e<0||32===e)}function o(e){return-2===e||-1===e||32===e}var l=c(/\p{P}|\p{S}/u),a=c(/\s/);function c(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}var s=function(e){if(null==e)return f;if("function"==typeof e)return u(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=s(e[n]);return u(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return u(n);function n(n){const r=n;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}(e);if("string"==typeof e)return function(e){return u(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function u(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function f(){return!0}var h=[],p=!0,d=!1;function m(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;const o=s(i),l=r?-1:1;!function e(i,a,c){const s=i&&"object"==typeof i?i:{};if("string"==typeof s.type){const e="string"==typeof s.tagName?s.tagName:"string"==typeof s.name?s.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){let s,u,f,m=h;if((!t||o(i,a,c[c.length-1]||void 0))&&(m=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[p,e];return null==e?h:[e]}(n(i,c)),m[0]===d))return m;if("children"in i&&i.children){const t=i;if(t.children&&"skip"!==m[0])for(u=(r?t.children.length:-1)+l,f=c.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(s=e(n,u,f)(),s[0]===d)return s;u="number"==typeof s[1]?s[1]:u+l}}return m}}(e,void 0,[])()}function g(e,t,n){const r=s((n||{}).ignore||[]),i=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([k(e[0]),b(e[1])])}return t}(t);let o=-1;for(;++o<i.length;)m(e,"text",l);function l(e,t){let n,l=-1;for(;++l<t.length;){const e=t[l],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=i[o][0],l=i[o][1];let a=0;const c=n.children.indexOf(e);let s=!1,u=[];r.lastIndex=0;let f=r.exec(e.value);for(;f;){const n=f.index,i={index:f.index,input:f.input,stack:[...t,e]};let o=l(...f,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(a!==n&&u.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(o)?u.push(...o):o&&u.push(o),a=n+f[0].length,s=!0),!r.global)break;f=r.exec(e.value)}s?(a<e.value.length&&u.push({type:"text",value:e.value.slice(a)}),n.children.splice(c,1,...u)):u=[e];return c+u.length}(e,t)}}function k(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function b(e){return"function"==typeof e?e:function(){return e}}var v="phrasing",x=["autolink","link","image","label"];function y(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function w(e){this.config.enter.autolinkProtocol.call(this,e)}function C(e){this.config.exit.autolinkProtocol.call(this,e)}function F(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function A(e){this.config.exit.autolinkEmail.call(this,e)}function D(e){this.exit(e)}function L(e){g(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,S],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,O]],{ignore:["link","linkReference"]})}function S(t,n,r,i,o){let l="";if(!E(o))return!1;if(/^w/i.test(n)&&(r=n+r,n="",l="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}(r))return!1;const a=function(t){const n=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!n)return[t,void 0];t=t.slice(0,n.index);let r=n[0],i=r.indexOf(")");const o=e(t,"(");let l=e(t,")");for(;-1!==i&&o>l;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),l++;return[t,r]}(r+i);if(!a[0])return!1;const c={type:"link",title:null,url:l+n+a[0],children:[{type:"text",value:n+a[0]}]};return a[1]?[c,{type:"text",value:a[1]}]:c}function O(e,t,n,r){return!(!E(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function E(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||a(n)||l(n))&&(!t||47!==n)}function I(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function M(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function T(){this.buffer()}function z(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=I(this.sliceSerialize(e)).toLowerCase()}function R(e){this.exit(e)}function j(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function P(){this.buffer()}function _(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=I(this.sliceSerialize(e)).toLowerCase()}function $(e){this.exit(e)}function B(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const l=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{...i.current(),before:o,after:"]"})),a(),l(),o+=i.move("]"),o}function H(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const l=n.enter("footnoteDefinition"),a=n.enter("label");return o+=i.move(n.safe(n.associationId(e),{...i.current(),before:o,after:"]"})),a(),o+=i.move("]:"+(e.children&&e.children.length>0?" ":"")),i.shift(4),o+=i.move(n.indentLines(n.containerFlow(e,i.current()),q)),l(),o}function q(e,t,n){return 0===t?e:(n?"":" ")+e}B.peek=function(){return"["};var U=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function V(e){this.enter({type:"delete",children:[]},e)}function W(e){this.exit(e)}function N(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),o(),l}function Z(e){return e.length}function Q(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function G(e,t,n){return">"+(n?"":" ")+e}function J(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Y(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&(o=n.stack,l=n.unsafe[i],J(o,l.inConstruct,!0)&&!J(o,l.notInConstruct,!1)))return/[ \t]/.test(r.before)?"":" ";var o,l;return"\\\n"}function K(e,t,n){return(n?"":" ")+e}function X(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ee(e,t,n,r){const i=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),l=n.createTracker(r);let a=l.move(i);return a+=l.move(n.containerPhrasing(e,{before:a,after:i,...l.current()})),a+=l.move(i),o(),a}N.peek=function(){return"~"},ee.peek=function(e,t,n){return n.options.emphasis||"*"};var te={};function ne(e,t){const n=t||te;return re(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function re(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ie(e.children,t,n)}return Array.isArray(e)?ie(e,t,n):""}function ie(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=re(e[i],t,n);return r.join("")}function oe(e,t){let n=!1;return function(e,t,n,r){let i,o,l;"function"==typeof t&&"function"!=typeof n?(o=void 0,l=t,i=n):(o=t,l=n,i=r),m(e,o,(function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return l(e,r,n)}),i)}(e,(function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,d})),Boolean((!e.depth||e.depth<3)&&ne(e)&&(t.options.setext||n))}function le(e){return e.value||""}function ae(e,t,n,r){const i=X(n),o='"'===i?"Quote":"Apostrophe",l=n.enter("image");let a=n.enter("label");const c=n.createTracker(r);let s=c.move("![");return s+=c.move(n.safe(e.alt,{before:s,after:"]",...c.current()})),s+=c.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),s+=c.move("<"),s+=c.move(n.safe(e.url,{before:s,after:">",...c.current()})),s+=c.move(">")):(a=n.enter("destinationRaw"),s+=c.move(n.safe(e.url,{before:s,after:e.title?" ":")",...c.current()}))),a(),e.title&&(a=n.enter(`title${o}`),s+=c.move(" "+i),s+=c.move(n.safe(e.title,{before:s,after:i,...c.current()})),s+=c.move(i),a()),s+=c.move(")"),l(),s}function ce(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("![");const s=n.safe(e.alt,{before:c,after:"]",...a.current()});c+=a.move(s+"]["),l();const u=n.stack;n.stack=[],l=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return l(),n.stack=u,o(),"full"!==i&&s&&s===f?"shortcut"===i?c=c.slice(0,-1):c+=a.move("]"):c+=a.move(f+"]"),c}function se(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const e=n.unsafe[o],t=n.compilePattern(e);let i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(i.index+1)}}return i+r+i}function ue(e,t){const n=ne(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function fe(e,t,n,r){const i=X(n),o='"'===i?"Quote":"Apostrophe",l=n.createTracker(r);let a,c;if(ue(e,n)){const t=n.stack;n.stack=[],a=n.enter("autolink");let r=l.move("<");return r+=l.move(n.containerPhrasing(e,{before:r,after:">",...l.current()})),r+=l.move(">"),a(),n.stack=t,r}a=n.enter("link"),c=n.enter("label");let s=l.move("[");return s+=l.move(n.containerPhrasing(e,{before:s,after:"](",...l.current()})),s+=l.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),s+=l.move("<"),s+=l.move(n.safe(e.url,{before:s,after:">",...l.current()})),s+=l.move(">")):(c=n.enter("destinationRaw"),s+=l.move(n.safe(e.url,{before:s,after:e.title?" ":")",...l.current()}))),c(),e.title&&(c=n.enter(`title${o}`),s+=l.move(" "+i),s+=l.move(n.safe(e.title,{before:s,after:i,...l.current()})),s+=l.move(i),c()),s+=l.move(")"),a(),s}function he(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("[");const s=n.containerPhrasing(e,{before:c,after:"]",...a.current()});c+=a.move(s+"]["),l();const u=n.stack;n.stack=[],l=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return l(),n.stack=u,o(),"full"!==i&&s&&s===f?"shortcut"===i?c=c.slice(0,-1):c+=a.move("]"):c+=a.move(f+"]"),c}function pe(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function de(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}le.peek=function(){return"<"},ae.peek=function(){return"!"},ce.peek=function(){return"!"},se.peek=function(){return"`"},fe.peek=function(e,t,n){return ue(e,n)?"<":"["},he.peek=function(){return"["};var me=s(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ge(e,t,n,r){const i=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),l=n.createTracker(r);let a=l.move(i+i);return a+=l.move(n.containerPhrasing(e,{before:a,after:i,...l.current()})),a+=l.move(i+i),o(),a}ge.peek=function(e,t,n){return n.options.strong||"*"};var ke={blockquote:function(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),G);return i(),l},break:Y,code:function(e,t,n,r){const i=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",l="`"===i?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(o,K);return e(),t}const a=n.createTracker(r),c=i.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,l=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===i?++o>l&&(l=o):o=1,i=r+t.length,r=n.indexOf(t,i);return l}(o,i)+1,3)),s=n.enter("codeFenced");let u=a.move(c);if(e.lang){const t=n.enter(`codeFencedLang${l}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${l}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...a.current()})),t()}return u+=a.move("\n"),o&&(u+=a.move(o+"\n")),u+=a.move(c),s(),u},definition:function(e,t,n,r){const i=X(n),o='"'===i?"Quote":"Apostrophe",l=n.enter("definition");let a=n.enter("label");const c=n.createTracker(r);let s=c.move("[");return s+=c.move(n.safe(n.associationId(e),{before:s,after:"]",...c.current()})),s+=c.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),s+=c.move("<"),s+=c.move(n.safe(e.url,{before:s,after:">",...c.current()})),s+=c.move(">")):(a=n.enter("destinationRaw"),s+=c.move(n.safe(e.url,{before:s,after:e.title?" ":"\n",...c.current()}))),a(),e.title&&(a=n.enter(`title${o}`),s+=c.move(" "+i),s+=c.move(n.safe(e.title,{before:s,after:i,...c.current()})),s+=c.move(i),a()),l(),s},emphasis:ee,hardBreak:Y,heading:function(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(oe(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),l=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),l+"\n"+(1===i?"=":"-").repeat(l.length-(Math.max(l.lastIndexOf("\r"),l.lastIndexOf("\n"))+1))}const l="#".repeat(i),a=n.enter("headingAtx"),c=n.enter("phrasing");o.move(l+" ");let s=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(s)&&(s="&#x"+s.charCodeAt(0).toString(16).toUpperCase()+";"+s.slice(1)),s=s?l+" "+s:l,n.options.closeAtx&&(s+=" "+l),c(),a(),s},html:le,image:ae,imageReference:ce,inlineCode:se,link:fe,linkReference:he,list:function(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):pe(n);const a=e.ordered?"."===l?")":".":function(e){const t=pe(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let c=!(!t||!n.bulletLastUsed)&&l===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==l&&"-"!==l||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(c=!0),de(n)===l&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){c=!0;break}}}}c&&(l=a),n.bulletCurrent=l;const s=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,i(),s},listItem:function(e,t,n,r){const i=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let o=n.bulletCurrent||pe(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let l=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(l=4*Math.ceil(l/4));const a=n.createTracker(r);a.move(o+" ".repeat(l-o.length)),a.shift(l);const c=n.enter("listItem"),s=n.indentLines(n.containerFlow(e,a.current()),(function(e,t,n){if(t)return(n?"":" ".repeat(l))+e;return(n?o:o+" ".repeat(l-o.length))+e}));return c(),s},paragraph:function(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),i(),l},root:function(e,t,n,r){return(e.children.some((function(e){return me(e)}))?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:ge,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(de(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}};function be(e){const t=e._align;this.enter({type:"table",align:t.map((function(e){return"none"===e?null:e})),children:[]},e),this.data.inTable=!0}function ve(e){this.exit(e),this.data.inTable=void 0}function xe(e){this.enter({type:"tableRow",children:[]},e)}function ye(e){this.exit(e)}function we(e){this.enter({type:"tableCell",children:[]},e)}function Ce(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Fe));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Fe(e,t){return"|"===t?t:e}function Ae(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=ke.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return a(function(e,t,n){const r=e.children;let i=-1;const o=[],l=t.enter("table");for(;++i<r.length;)o[i]=c(r[i],t,n);return l(),o}(e,n,r),e.align)},tableCell:l,tableRow:function(e,t,n,r){const i=a([c(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function l(e,t,n,r){const i=n.enter("tableCell"),l=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:o,after:o});return l(),i(),a}function a(e,t){return function(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||Z,i=[],o=[],l=[],a=[];let c=0,s=-1;for(;++s<e.length;){const n=[],i=[];let f=-1;for(e[s].length>c&&(c=e[s].length);++f<e[s].length;){const o=null==(u=e[s][f])?"":String(u);if(!1!==t.alignDelimiters){const e=r(o);i[f]=e,(void 0===a[f]||e>a[f])&&(a[f]=e)}n.push(o)}o[s]=n,l[s]=i}var u;let f=-1;if("object"==typeof n&&"length"in n)for(;++f<c;)i[f]=Q(n[f]);else{const e=Q(n);for(;++f<c;)i[f]=e}f=-1;const h=[],p=[];for(;++f<c;){const e=i[f];let n="",r="";99===e?(n=":",r=":"):108===e?n=":":114===e&&(r=":");let o=!1===t.alignDelimiters?1:Math.max(1,a[f]-n.length-r.length);const l=n+"-".repeat(o)+r;!1!==t.alignDelimiters&&(o=n.length+o+r.length,o>a[f]&&(a[f]=o),p[f]=o),h[f]=l}o.splice(1,0,h),l.splice(1,0,p),s=-1;const d=[];for(;++s<o.length;){const e=o[s],n=l[s];f=-1;const r=[];for(;++f<c;){const o=e[f]||"";let l="",s="";if(!1!==t.alignDelimiters){const e=a[f]-(n[f]||0),t=i[f];114===t?l=" ".repeat(e):99===t?e%2?(l=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):(l=" ".repeat(e/2),s=l):s=" ".repeat(e)}!1===t.delimiterStart||f||r.push("|"),!1===t.padding||!1===t.alignDelimiters&&""===o||!1===t.delimiterStart&&!f||r.push(" "),!1!==t.alignDelimiters&&r.push(l),r.push(o),!1!==t.alignDelimiters&&r.push(s),!1!==t.padding&&r.push(" "),!1===t.delimiterEnd&&f===c-1||r.push("|")}d.push(!1===t.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return d.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function c(e,t,n){const r=e.children;let i=-1;const o=[],a=t.enter("tableRow");for(;++i<r.length;)o[i]=l(r[i],0,t,n);return a(),o}}function De(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function Le(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let i,o=-1;for(;++o<r.length;){const e=r[o];if("paragraph"===e.type){i=e;break}}i===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Se(e,t,n,r){const i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,l="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);o&&a.move(l);let c=ke.listItem(e,t,n,{...r,...a.current()});return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,(function(e){return e+l}))),c}function Oe(e,t,n,r){const i=e.length;let o,l=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);l<r.length;)o=r.slice(l,l+1e4),o.unshift(t,0),e.splice(...o),l+=1e4,t+=1e4}var Ee={}.hasOwnProperty;function Ie(e,t){let n;for(n in t){const r=(Ee.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Ee.call(r,o)||(r[o]=[]);const e=i[o];Me(r[o],Array.isArray(e)?e:e?[e]:[])}}}function Me(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);Oe(e,0,0,r)}var Te={tokenize:function(e,t,n){let r=0;return function t(o){if((87===o||119===o)&&r<3)return r++,e.consume(o),t;if(46===o&&3===r)return e.consume(o),i;return n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},ze={tokenize:function(e,t,n){let r,o,c;return s;function s(t){return 46===t||95===t?e.check(je,f,u)(t):null===t||i(t)||a(t)||45!==t&&l(t)?f(t):(c=!0,e.consume(t),s)}function u(t){return 95===t?r=!0:(o=r,r=void 0),e.consume(t),s}function f(e){return o||r||!c?n(e):t(e)}},partial:!0},Re={tokenize:function(e,t){let n=0,r=0;return o;function o(c){return 40===c?(n++,e.consume(c),o):41===c&&r<n?l(c):33===c||34===c||38===c||39===c||41===c||42===c||44===c||46===c||58===c||59===c||60===c||63===c||93===c||95===c||126===c?e.check(je,t,l)(c):null===c||i(c)||a(c)?t(c):(e.consume(c),o)}function l(t){return 41===t&&r++,e.consume(t),o}},partial:!0},je={tokenize:function(e,n,r){return o;function o(t){return 33===t||34===t||39===t||41===t||42===t||44===t||46===t||58===t||59===t||63===t||95===t||126===t?(e.consume(t),o):38===t?(e.consume(t),c):93===t?(e.consume(t),l):60===t||null===t||i(t)||a(t)?n(t):r(t)}function l(e){return null===e||40===e||91===e||i(e)||a(e)?n(e):o(e)}function c(e){return t(e)?s(e):r(e)}function s(n){return 59===n?(e.consume(n),o):t(n)?(e.consume(n),s):r(n)}},partial:!0},Pe={tokenize:function(e,t,r){return function(t){return e.consume(t),i};function i(e){return n(e)?r(e):t(e)}},partial:!0},_e={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!Ue.call(r,r.previous)||Ze(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Te,e.attempt(ze,e.attempt(Re,i),n),n)(t)};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:Ue},$e={name:"protocolAutolink",tokenize:function(e,n,r){const o=this;let c="",s=!1;return function(t){if((72===t||104===t)&&Ve.call(o,o.previous)&&!Ze(o.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(t),e.consume(t),u;return r(t)};function u(n){if(t(n)&&c.length<5)return c+=String.fromCodePoint(n),e.consume(n),u;if(58===n){const t=c.toLowerCase();if("http"===t||"https"===t)return e.consume(n),f}return r(n)}function f(t){return 47===t?(e.consume(t),s?h:(s=!0,f)):r(t)}function h(t){return null===t||function(e){return null!==e&&(e<32||127===e)}(t)||i(t)||a(t)||l(t)?r(t):e.attempt(ze,e.attempt(Re,p),r)(t)}function p(t){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(t)}},previous:Ve},Be={name:"emailAutolink",tokenize:function(e,r,i){const o=this;let l,a;return function(t){if(!Ne(t)||!We.call(o,o.previous)||Ze(o.events))return i(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(t)};function c(t){return Ne(t)?(e.consume(t),c):64===t?(e.consume(t),s):i(t)}function s(t){return 46===t?e.check(Pe,f,u)(t):45===t||95===t||n(t)?(a=!0,e.consume(t),s):f(t)}function u(t){return e.consume(t),l=!0,s}function f(n){return a&&l&&t(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(n)):i(n)}},previous:We},He={};for(var qe=48;qe<123;)He[qe]=Be,58===++qe?qe=65:91===qe&&(qe=97);function Ue(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||i(e)}function Ve(e){return!t(e)}function We(e){return!(47===e||Ne(e))}function Ne(e){return 43===e||45===e||46===e||95===e||n(e)}function Ze(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Qe(e){return null===e||i(e)||a(e)?1:l(e)?2:void 0}function Ge(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}function Je(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return function(r){if(o(r))return e.enter(n),a(r);return t(r)};function a(r){return o(r)&&l++<i?(e.consume(r),a):(e.exit(n),t(r))}}He[43]=Be,He[45]=Be,He[46]=Be,He[95]=Be,He[72]=[Be,$e],He[104]=[Be,$e],He[87]=[Be,_e],He[119]=[Be,_e];var Ye={tokenize:function(e,t,n){return function(t){return o(t)?Je(e,i,"linePrefix")(t):i(t)};function i(e){return null===e||r(e)?t(e):n(e)}},partial:!0};var Ke={tokenize:function(e,t,n){const r=this;return Je(e,(function(e){const i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)}),"gfmFootnoteDefinitionIndent",5)},partial:!0};function Xe(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const e=r.events[i][1];if("labelImage"===e.type){l=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!l||!l._balanced)return n(i);const a=I(r.sliceSerialize({start:l.end,end:r.now()}));if(94!==a.codePointAt(0)||!o.includes(a.slice(1)))return n(i);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)}}function et(e,t){let n,r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){n=e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},c=[e[r+1],e[r+2],["enter",i,t],e[r+3],e[r+4],["enter",o,t],["exit",o,t],["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(r,e.length-r+1,...c),e}function tt(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,a=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),c};function c(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",s)}function s(c){if(a>999||93===c&&!l||null===c||91===c||i(c))return n(c);if(93===c){e.exit("chunkString");const i=e.exit("gfmFootnoteCallString");return o.includes(I(r.sliceSerialize(i)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return i(c)||(l=!0),a++,e.consume(c),92===c?u:s}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,s):s(t)}}function nt(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,a,c=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),s};function s(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(t)}function u(t){if(c>999||93===t&&!a||null===t||91===t||i(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return l=I(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return i(t)||(a=!0),c++,e.consume(t),92===t?f:u}function f(t){return 91===t||92===t||93===t?(e.consume(t),c++,u):u(t)}function h(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(l)||o.push(l),Je(e,p,"gfmFootnoteDefinitionWhitespace")):n(t)}function p(e){return t(e)}}function rt(e,t,n){return e.check(Ye,t,e.attempt(Ke,t,n))}function it(e){e.exit("gfmFootnoteDefinition")}function ot(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const i=this.previous,o=this.events;let l=0;return function(t){if(126===i&&"characterEscape"!==o[o.length-1][1].type)return r(t);return e.enter("strikethroughSequenceTemporary"),a(t)};function a(o){const c=Qe(i);if(126===o)return l>1?r(o):(e.consume(o),l++,a);if(l<2&&!t)return r(o);const s=e.exit("strikethroughSequenceTemporary"),u=Qe(o);return s._open=!u||2===u&&Boolean(c),s._close=!c||2===c&&Boolean(u),n(o)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},l=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],a=t.parser.constructs.insideSpan.null;a&&Oe(l,l.length,0,Ge(a,e.slice(r+1,n),t)),Oe(l,l.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),Oe(e,r-1,n-r+3,l),n=r+l.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}var lt=class{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0===n&&0===r.length)return;for(;i<e.map.length;){if(e.map[i][0]===t)return e.map[i][1]+=n,void e.map[i][2].push(...r);i+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort((function(e,t){return e[0]-t[0]})),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}};function at(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}function ct(e,t,n){const l=this;let a,c=0,s=0;return function(e){let t=l.events.length-1;for(;t>-1;){const e=l.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const r=t>-1?l.events[t][1].type:null,i="tableHead"===r||"tableRow"===r?C:u;if(i===C&&l.parser.lazy[l.now().line])return n(e);return i(e)};function u(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return f(e);return a=!0,s+=1,f(e)}(t)}function f(t){return null===t?n(t):r(t)?s>1?(s=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):o(t)?Je(e,f,"whitespace")(t):(s+=1,a&&(a=!1,c+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),a=!0,f):(e.enter("data"),h(t)))}function h(t){return null===t||124===t||i(t)?(e.exit("data"),f(t)):(e.consume(t),92===t?p:h)}function p(t){return 92===t||124===t?(e.consume(t),h):h(t)}function d(t){return l.interrupt=!1,l.parser.lazy[l.now().line]?n(t):(e.enter("tableDelimiterRow"),a=!1,o(t)?Je(e,m,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):m(t))}function m(t){return 45===t||58===t?k(t):124===t?(a=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),g):w(t)}function g(t){return o(t)?Je(e,k,"whitespace")(t):k(t)}function k(t){return 58===t?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),b):45===t?(s+=1,b(t)):null===t||r(t)?y(t):w(t)}function b(t){return 45===t?(e.enter("tableDelimiterFiller"),v(t)):w(t)}function v(t){return 45===t?(e.consume(t),v):58===t?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(t))}function x(t){return o(t)?Je(e,y,"whitespace")(t):y(t)}function y(n){return 124===n?m(n):(null===n||r(n))&&a&&c===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):w(n)}function w(e){return n(e)}function C(t){return e.enter("tableRow"),F(t)}function F(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),F):null===n||r(n)?(e.exit("tableRow"),t(n)):o(n)?Je(e,F,"whitespace")(n):(e.enter("data"),A(n))}function A(t){return null===t||124===t||i(t)?(e.exit("data"),F(t)):(e.consume(t),92===t?D:A)}function D(t){return 92===t||124===t?(e.consume(t),A):A(t)}}function st(e,t){let n,r,i,o=-1,l=!0,a=0,c=[0,0,0,0],s=[0,0,0,0],u=!1,f=0;const h=new lt;for(;++o<e.length;){const p=e[o],d=p[1];"enter"===p[0]?"tableHead"===d.type?(u=!1,0!==f&&(ft(h,t,f,n,r),r=void 0,f=0),n={type:"table",start:Object.assign({},d.start),end:Object.assign({},d.end)},h.add(o,0,[["enter",n,t]])):"tableRow"===d.type||"tableDelimiterRow"===d.type?(l=!0,i=void 0,c=[0,0,0,0],s=[0,o+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},d.start),end:Object.assign({},d.end)},h.add(o,0,[["enter",r,t]])),a="tableDelimiterRow"===d.type?2:r?3:1):!a||"data"!==d.type&&"tableDelimiterMarker"!==d.type&&"tableDelimiterFiller"!==d.type?"tableCellDivider"===d.type&&(l?l=!1:(0!==c[1]&&(s[0]=s[1],i=ut(h,t,c,a,void 0,i)),c=s,s=[c[1],o,0,0])):(l=!1,0===s[2]&&(0!==c[1]&&(s[0]=s[1],i=ut(h,t,c,a,void 0,i),c=[0,0,0,0]),s[2]=o)):"tableHead"===d.type?(u=!0,f=o):"tableRow"===d.type||"tableDelimiterRow"===d.type?(f=o,0!==c[1]?(s[0]=s[1],i=ut(h,t,c,a,o,i)):0!==s[1]&&(i=ut(h,t,s,a,o,i)),a=0):!a||"data"!==d.type&&"tableDelimiterMarker"!==d.type&&"tableDelimiterFiller"!==d.type||(s[3]=o)}for(0!==f&&ft(h,t,f,n,r),h.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=at(t.events,o))}return e}function ut(e,t,n,r,i,o){const l=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(o.end=Object.assign({},ht(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const a=ht(t.events,n[1]);if(o={type:l,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){const i=ht(t.events,n[2]),o=ht(t.events,n[3]),l={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",l,t]]),2!==r){const r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",l,t]])}return void 0!==i&&(o.end=Object.assign({},ht(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function ft(e,t,n,r,i){const o=[],l=ht(t.events,n);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function ht(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}var pt={name:"tasklistCheck",tokenize:function(e,t,n){const l=this;return function(t){if(null!==l.previous||!l._gfmTasklistFirstContentOfListItem)return n(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a};function a(t){return i(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),c):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),c):n(t)}function c(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(i){return r(i)?t(i):o(i)?e.check({tokenize:dt},t,n)(i):n(i)}}};function dt(e,t,n){return Je(e,(function(e){return null===e?n(e):t(e)}),"whitespace")}function mt(e){return function(e){const t={};let n=-1;for(;++n<e.length;)Ie(t,e[n]);return t}([{text:He},{document:{91:{name:"gfmFootnoteDefinition",tokenize:nt,continuation:{tokenize:rt},exit:it}},text:{91:{name:"gfmFootnoteCall",tokenize:tt},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Xe,resolveTo:et}}},ot(e),{flow:{null:{name:"table",tokenize:ct,resolveAll:st}}},{text:{91:pt}}])}var gt={};function kt(e){const t=e||gt,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(mt(t)),i.push([{transforms:[L],enter:{literalAutolink:y,literalAutolinkEmail:w,literalAutolinkHttp:w,literalAutolinkWww:w},exit:{literalAutolink:D,literalAutolinkEmail:A,literalAutolinkHttp:C,literalAutolinkWww:F}},{enter:{gfmFootnoteDefinition:M,gfmFootnoteDefinitionLabelString:T,gfmFootnoteCall:j,gfmFootnoteCallString:P},exit:{gfmFootnoteDefinition:R,gfmFootnoteDefinitionLabelString:z,gfmFootnoteCall:$,gfmFootnoteCallString:_}},{canContainEols:["delete"],enter:{strikethrough:V},exit:{strikethrough:W}},{enter:{table:be,tableData:we,tableHeader:we,tableRow:xe},exit:{codeText:Ce,table:ve,tableData:ye,tableHeader:ye,tableRow:ye}},{exit:{taskListCheckValueChecked:De,taskListCheckValueUnchecked:De,paragraph:Le}}]),o.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:v,notInConstruct:x},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:v,notInConstruct:x},{character:":",before:"[ps]",after:"\\/",inConstruct:v,notInConstruct:x}]},{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:H,footnoteReference:B}},{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:U}],handlers:{delete:N}},Ae(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Se}}]}}(t))}var bt={remark:e=>e.use(kt)};export{bt as default};
|
package/plugins/gfm.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Imports
|
|
2
|
-
import type { Plugin } from "../renderer.ts"
|
|
3
|
-
import remarkGfm from "remark-gfm"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Enable GitHub Flavored Markdown (GFM).
|
|
7
|
-
*
|
|
8
|
-
* {@link https://github.github.com/gfm | See GitHub Flavored Markdown specification for more information}.
|
|
9
|
-
*/
|
|
10
|
-
export default {
|
|
11
|
-
remark(processor) {
|
|
12
|
-
return processor.use(remarkGfm)
|
|
13
|
-
},
|
|
14
|
-
} as Plugin
|
package/plugins/gfm_test.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "@libs/testing"
|
|
2
|
-
import { Renderer } from "../renderer.ts"
|
|
3
|
-
import plugin from "./gfm.ts"
|
|
4
|
-
|
|
5
|
-
test("deno")("`Plugin.gfm` renders strikethrough", async () => {
|
|
6
|
-
const markdown = new Renderer({ plugins: [plugin] })
|
|
7
|
-
await expect(markdown.render("~~foo~~")).resolves.toMatch(/<del>foo<\/del>/)
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
test("deno")("`Plugin.gfm` renders autolinks", async () => {
|
|
11
|
-
const markdown = new Renderer({ plugins: [plugin] })
|
|
12
|
-
await expect(markdown.render("https://example.test")).resolves.toMatch(/<a href="https:\/\/example.test">https:\/\/example.test<\/a>/)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
test("deno")("`Plugin.gfm` renders footnotes", async () => {
|
|
16
|
-
const markdown = new Renderer({ plugins: [plugin] })
|
|
17
|
-
await expect(markdown.render("[^foo]\n\n[^foo]:bar")).resolves.toContain("Footnotes")
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
test("deno")("`Plugin.gfm` renders tasklists", async () => {
|
|
21
|
-
const markdown = new Renderer({ plugins: [plugin] })
|
|
22
|
-
await expect(markdown.render("- [ ] foo")).resolves.toMatch(/<li class="task-list-item">.*<\/li>/)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
test("deno")("`Plugin.gfm` renders tasklists", async () => {
|
|
26
|
-
const markdown = new Renderer({ plugins: [plugin] })
|
|
27
|
-
await expect(markdown.render("| foo |\n|-|\n| bar |")).resolves.toMatch(/<table>.*<\/table>/)
|
|
28
|
-
})
|