@likec4/core 1.48.0 → 1.49.0
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/dist/THIRD-PARTY-LICENSES.md +1012 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -3284
- package/dist/_chunks/LikeC4Model.d.mts +21 -25
- package/dist/_chunks/RichText.mjs +1 -148
- package/dist/_chunks/_types.d.mts +1 -5
- package/dist/_chunks/_types2.d.mts +2 -4
- package/dist/_chunks/assignTagColors.mjs +1 -24
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +1 -379
- package/dist/_chunks/guards.d.mts +2026 -0
- package/dist/_chunks/guards.mjs +4 -0
- package/dist/_chunks/index.d.mts +255 -136
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
- package/dist/_chunks/libs/bail.mjs +1 -14
- package/dist/_chunks/libs/ccount.mjs +1 -25
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
- package/dist/_chunks/libs/character-entities.mjs +2 -2136
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/devlop.mjs +1 -5
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
- package/dist/_chunks/libs/extend.mjs +1 -77
- package/dist/_chunks/libs/graphology-dag.mjs +1 -703
- package/dist/_chunks/libs/graphology.mjs +1 -4565
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/longest-streak.mjs +1 -30
- package/dist/_chunks/libs/markdown-table.mjs +2 -290
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
- package/dist/_chunks/libs/mnemonist.d.mts +1 -91
- package/dist/_chunks/libs/mnemonist.mjs +1 -1978
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
- package/dist/_chunks/libs/remark-gfm.mjs +1 -36
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
- package/dist/_chunks/libs/remark-parse.mjs +1 -39
- package/dist/_chunks/libs/remark-rehype.mjs +1 -171
- package/dist/_chunks/libs/remeda.mjs +1 -702
- package/dist/_chunks/libs/trough.mjs +1 -158
- package/dist/_chunks/libs/unified.mjs +1 -2212
- package/dist/_chunks/rolldown-runtime.mjs +1 -42
- package/dist/_chunks/{index3.d.mts → theme.d.mts} +15 -13
- package/dist/_chunks/{index7.d.mts → to-text.d.mts} +165 -29
- package/dist/_chunks/to-text.mjs +1 -0
- package/dist/_chunks/vector.d.mts +198 -0
- package/dist/_chunks/vector.mjs +1 -0
- package/dist/builder/index.d.mts +2 -8
- package/dist/builder/index.mjs +1 -662
- package/dist/compute-view/index.d.mts +86 -15
- package/dist/compute-view/index.mjs +2 -262
- package/dist/geometry/index.d.mts +2 -2
- package/dist/geometry/index.mjs +1 -3
- package/dist/index.d.mts +9 -13
- package/dist/index.mjs +1 -27
- package/dist/model/index.d.mts +4 -14
- package/dist/model/index.mjs +1 -11
- package/dist/styles/index.d.mts +2 -8
- package/dist/styles/index.mjs +1 -30
- package/dist/types/index.d.mts +3 -9
- package/dist/types/index.mjs +1 -15
- package/dist/utils/graphology/index.d.mts +1 -1
- package/dist/utils/graphology/index.mjs +1 -3
- package/dist/utils/index.d.mts +4 -11
- package/dist/utils/index.mjs +1 -17
- package/package.json +13 -12
- package/dist/_chunks/LikeC4Styles.mjs +0 -691
- package/dist/_chunks/RichText.d.mts +0 -84
- package/dist/_chunks/_aux.d.mts +0 -289
- package/dist/_chunks/_aux.mjs +0 -18
- package/dist/_chunks/connection.mjs +0 -0
- package/dist/_chunks/const.d.mts +0 -43
- package/dist/_chunks/const.mjs +0 -33
- package/dist/_chunks/expression-model.d.mts +0 -192
- package/dist/_chunks/expression-model.mjs +0 -103
- package/dist/_chunks/expression.d.mts +0 -347
- package/dist/_chunks/expression.mjs +0 -107
- package/dist/_chunks/find.d.mts +0 -82
- package/dist/_chunks/find.mjs +0 -646
- package/dist/_chunks/find2.d.mts +0 -78
- package/dist/_chunks/find2.mjs +0 -287
- package/dist/_chunks/fqnRef.d.mts +0 -58
- package/dist/_chunks/fqnRef.mjs +0 -41
- package/dist/_chunks/geometry.mjs +0 -335
- package/dist/_chunks/index2.d.mts +0 -937
- package/dist/_chunks/index4.d.mts +0 -62
- package/dist/_chunks/index5.d.mts +0 -42
- package/dist/_chunks/index6.d.mts +0 -43
- package/dist/_chunks/index8.d.mts +0 -144
- package/dist/_chunks/invariant.mjs +0 -18
- package/dist/_chunks/iterable.mjs +0 -146
- package/dist/_chunks/libs/graphology-types.d.mts +0 -601
- package/dist/_chunks/libs/graphology.d.mts +0 -6
- package/dist/_chunks/mnemonist.d.mts +0 -1
- package/dist/_chunks/mnemonist.mjs +0 -0
- package/dist/_chunks/model.mjs +0 -1898
- package/dist/_chunks/model2.mjs +0 -0
- package/dist/_chunks/relationships-view.mjs +0 -132
- package/dist/_chunks/scalar.d.mts +0 -109
- package/dist/_chunks/scalar.mjs +0 -84
- package/dist/_chunks/utils.mjs +0 -483
- package/dist/compute-view/relationships-view/index.d.mts +0 -16
- package/dist/compute-view/relationships-view/index.mjs +0 -7
- package/dist/model/connection/deployment/index.d.mts +0 -12
- package/dist/model/connection/deployment/index.mjs +0 -9
- package/dist/model/connection/index.d.mts +0 -14
- package/dist/model/connection/index.mjs +0 -10
- package/dist/model/connection/model/index.d.mts +0 -12
- package/dist/model/connection/model/index.mjs +0 -8
- package/dist/types/RichText.d.mts +0 -3
- package/dist/types/RichText.mjs +0 -7
- package/dist/types/_aux.d.mts +0 -3
- package/dist/types/_aux.mjs +0 -3
- package/dist/types/expression-model.d.mts +0 -6
- package/dist/types/expression-model.mjs +0 -7
- package/dist/types/expression.d.mts +0 -5
- package/dist/types/expression.mjs +0 -7
- package/dist/types/fqnRef.d.mts +0 -4
- package/dist/types/fqnRef.mjs +0 -7
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -7
- package/dist/utils/iterable/index.d.mts +0 -9
- package/dist/utils/iterable/index.mjs +0 -3
- package/dist/utils/mnemonist.d.mts +0 -2
- package/dist/utils/mnemonist.mjs +0 -12
|
@@ -1,42 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @license MIT License
|
|
11
|
-
*/
|
|
12
|
-
var naturalCompare = function(a, b) {
|
|
13
|
-
var i, codeA, codeB = 1, posA = 0, posB = 0, alphabet = String.alphabet;
|
|
14
|
-
function getCode(str, pos, code) {
|
|
15
|
-
if (code) {
|
|
16
|
-
for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;
|
|
17
|
-
return +str.slice(pos - 1, i);
|
|
18
|
-
}
|
|
19
|
-
code = alphabet && alphabet.indexOf(str.charAt(pos));
|
|
20
|
-
return code > -1 ? code + 76 : (code = str.charCodeAt(pos) || 0, code < 45 || code > 127) ? code : code < 46 ? 65 : code < 48 ? code - 1 : code < 58 ? code + 18 : code < 65 ? code - 11 : code < 91 ? code + 11 : code < 97 ? code - 37 : code < 123 ? code + 5 : code - 63;
|
|
21
|
-
}
|
|
22
|
-
if ((a += "") != (b += "")) for (; codeB;) {
|
|
23
|
-
codeA = getCode(a, posA++);
|
|
24
|
-
codeB = getCode(b, posB++);
|
|
25
|
-
if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
|
|
26
|
-
codeA = getCode(a, posA, posA);
|
|
27
|
-
codeB = getCode(b, posB, posA = i);
|
|
28
|
-
posB = i;
|
|
29
|
-
}
|
|
30
|
-
if (codeA != codeB) return codeA < codeB ? -1 : 1;
|
|
31
|
-
}
|
|
32
|
-
return 0;
|
|
33
|
-
};
|
|
34
|
-
try {
|
|
35
|
-
module.exports = naturalCompare;
|
|
36
|
-
} catch (e) {
|
|
37
|
-
String.naturalCompare = naturalCompare;
|
|
38
|
-
}
|
|
39
|
-
}));
|
|
40
|
-
|
|
41
|
-
//#endregion
|
|
42
|
-
export { require_natural_compare_lite as t };
|
|
1
|
+
import{t as __commonJSMin}from"../rolldown-runtime.mjs";var require_natural_compare_lite=__commonJSMin(((e,t)=>{
|
|
2
|
+
/*
|
|
3
|
+
* @version 1.4.0
|
|
4
|
+
* @date 2015-10-26
|
|
5
|
+
* @stability 3 - Stable
|
|
6
|
+
* @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
|
|
7
|
+
* @license MIT License
|
|
8
|
+
*/
|
|
9
|
+
var n=function(e,t){var n,r,i=1,a=0,o=0,s=String.alphabet;function c(e,t,r){if(r){for(n=t;r=c(e,n),r<76&&r>65;)++n;return+e.slice(t-1,n)}return r=s&&s.indexOf(e.charAt(t)),r>-1?r+76:(r=e.charCodeAt(t)||0,r<45||r>127?r:r<46?65:r<48?r-1:r<58?r+18:r<65?r-11:r<91?r+11:r<97?r-37:r<123?r+5:r-63)}if((e+=``)!=(t+=``)){for(;i;)if(r=c(e,a++),i=c(t,o++),r<76&&i<76&&r>66&&i>66&&(r=c(e,a,a),i=c(t,o,a=n),o=n),r!=i)return r<i?-1:1}return 0};try{t.exports=n}catch{String.naturalCompare=n}}));export{require_natural_compare_lite as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function serialize(e){return typeof e==`string`?`'${e}'`:new c().serialize(e)}const c=function(){class e{#e=new Map;compare(e,t){let n=typeof e,i=typeof t;return n===`string`&&i===`string`?e.localeCompare(t):n===`number`&&i===`number`?e-t:String.prototype.localeCompare.call(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,i=n===Object||n===void 0?``:n.name;if(i!==``&&globalThis[i]===n)return this.serializeBuiltInType(i,e);if(typeof e.toJSON==`function`){let t=e.toJSON();return i+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}return this.serializeObjectEntries(i,Object.entries(e))}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t?.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),i=`${e}{`;for(let e=0;e<n.length;e++){let[t,a]=n[e];i+=`${this.serialize(t,!0)}:${this.serialize(a)}`,e<n.length-1&&(i+=`,`)}return i+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e}(),z=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],R=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],r=[];var k=class{_data=new l;_hash=new l([...z]);_nDataBytes=0;_minBufferSize=0;finalize(e){e&&this._append(e);let t=this._nDataBytes*8,n=this._data.sigBytes*8;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[(n+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(n+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let n=this._hash.words,o=n[0],s=n[1],u=n[2],d=n[3],f=n[4],p=n[5],m=n[6],h=n[7];for(let n=0;n<64;n++){if(n<16)r[n]=e[t+n]|0;else{let e=r[n-15],t=(e<<25|e>>>7)^(e<<14|e>>>18)^e>>>3,i=r[n-2],o=(i<<15|i>>>17)^(i<<13|i>>>19)^i>>>10;r[n]=t+r[n-7]+o+r[n-16]}let g=f&p^~f&m,_=o&s^o&u^s&u,v=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22),y=(f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25),b=h+y+g+R[n]+r[n],x=v+_;h=m,m=p,p=f,f=d+b|0,d=u,u=s,s=o,o=b+x|0}n[0]=n[0]+o|0,n[1]=n[1]+s|0,n[2]=n[2]+u|0,n[3]=n[3]+d|0,n[4]=n[4]+f|0,n[5]=n[5]+p|0,n[6]=n[6]+m|0,n[7]=n[7]+h|0}_append(e){typeof e==`string`&&(e=l.fromUtf8(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){let t,n=this._data.sigBytes/64;n=e?Math.ceil(n):Math.max((n|0)-this._minBufferSize,0);let i=n*16,a=Math.min(i*4,this._data.sigBytes);if(i){for(let e=0;e<i;e+=16)this._doProcessBlock(this._data.words,e);t=this._data.words.splice(0,i),this._data.sigBytes-=a}return new l(t,a)}},l=class e{words;sigBytes;constructor(e,t){e=this.words=e||[],this.sigBytes=t===void 0?e.length*4:t}static fromUtf8(t){let n=unescape(encodeURIComponent(t)),i=n.length,a=[];for(let e=0;e<i;e++)a[e>>>2]|=(n.charCodeAt(e)&255)<<24-e%4*8;return new e(a,i)}toBase64(){let e=[];for(let t=0;t<this.sigBytes;t+=3){let n=this.words[t>>>2]>>>24-t%4*8&255,i=this.words[t+1>>>2]>>>24-(t+1)%4*8&255,a=this.words[t+2>>>2]>>>24-(t+2)%4*8&255,o=n<<16|i<<8|a;for(let n=0;n<4&&t*8+n*6<this.sigBytes*8;n++)e.push(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`.charAt(o>>>6*(3-n)&63))}return e.join(``)}concat(e){if(this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let n=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=n<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];this.sigBytes+=e.sigBytes}};function digest(e){return new k().finalize(e).toBase64()}function hash(t){return digest(serialize(t))}export{hash as t};
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/rehype-sanitize@6.0.0/node_modules/rehype-sanitize/lib/index.js
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('hast').Root} Root
|
|
6
|
-
* @typedef {import('hast-util-sanitize').Schema} Schema
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Sanitize HTML.
|
|
10
|
-
*
|
|
11
|
-
* @param {Schema | null | undefined} [options]
|
|
12
|
-
* Configuration (optional).
|
|
13
|
-
* @returns
|
|
14
|
-
* Transform.
|
|
15
|
-
*/
|
|
16
|
-
function rehypeSanitize(options) {
|
|
17
|
-
/**
|
|
18
|
-
* @param {Root} tree
|
|
19
|
-
* Tree.
|
|
20
|
-
* @returns {Root}
|
|
21
|
-
* New tree.
|
|
22
|
-
*/
|
|
23
|
-
return function(tree) {
|
|
24
|
-
return sanitize(tree, options);
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { rehypeSanitize as t };
|
|
1
|
+
import{t as sanitize}from"./hast-util-sanitize.mjs";function rehypeSanitize(e){return function(t){return sanitize(t,e)}}export{rehypeSanitize as t};
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/rehype-stringify@10.0.1/node_modules/rehype-stringify/lib/index.js
|
|
4
|
-
/**
|
|
5
|
-
* @import {Root} from 'hast'
|
|
6
|
-
* @import {Options} from 'hast-util-to-html'
|
|
7
|
-
* @import {Compiler, Processor} from 'unified'
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Plugin to add support for serializing as HTML.
|
|
11
|
-
*
|
|
12
|
-
* @param {Options | null | undefined} [options]
|
|
13
|
-
* Configuration (optional).
|
|
14
|
-
* @returns {undefined}
|
|
15
|
-
* Nothing.
|
|
16
|
-
*/
|
|
17
|
-
function rehypeStringify(options) {
|
|
18
|
-
/** @type {Processor<undefined, undefined, undefined, Root, string>} */
|
|
19
|
-
const self = this;
|
|
20
|
-
const settings = {
|
|
21
|
-
...self.data("settings"),
|
|
22
|
-
...options
|
|
23
|
-
};
|
|
24
|
-
self.compiler = compiler;
|
|
25
|
-
/**
|
|
26
|
-
* @type {Compiler<Root, string>}
|
|
27
|
-
*/
|
|
28
|
-
function compiler(tree) {
|
|
29
|
-
return toHtml(tree, settings);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
export { rehypeStringify as t };
|
|
1
|
+
import{t as toHtml}from"./hast-util-to-html.mjs";function rehypeStringify(e){let t=this,n={...t.data(`settings`),...e};t.compiler=r;function r(e){return toHtml(e,n)}}export{rehypeStringify as t};
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as gfm } from "./micromark-extension-gfm.mjs";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js
|
|
5
|
-
/**
|
|
6
|
-
* @import {Root} from 'mdast'
|
|
7
|
-
* @import {Options} from 'remark-gfm'
|
|
8
|
-
* @import {} from 'remark-parse'
|
|
9
|
-
* @import {} from 'remark-stringify'
|
|
10
|
-
* @import {Processor} from 'unified'
|
|
11
|
-
*/
|
|
12
|
-
/** @type {Options} */
|
|
13
|
-
const emptyOptions = {};
|
|
14
|
-
/**
|
|
15
|
-
* Add support GFM (autolink literals, footnotes, strikethrough, tables,
|
|
16
|
-
* tasklists).
|
|
17
|
-
*
|
|
18
|
-
* @param {Options | null | undefined} [options]
|
|
19
|
-
* Configuration (optional).
|
|
20
|
-
* @returns {undefined}
|
|
21
|
-
* Nothing.
|
|
22
|
-
*/
|
|
23
|
-
function remarkGfm(options) {
|
|
24
|
-
const self = this;
|
|
25
|
-
const settings = options || emptyOptions;
|
|
26
|
-
const data = self.data();
|
|
27
|
-
const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
|
|
28
|
-
const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
|
|
29
|
-
const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
|
|
30
|
-
micromarkExtensions.push(gfm(settings));
|
|
31
|
-
fromMarkdownExtensions.push(gfmFromMarkdown());
|
|
32
|
-
toMarkdownExtensions.push(gfmToMarkdown(settings));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { remarkGfm as t };
|
|
1
|
+
import{n as gfmToMarkdown,t as gfmFromMarkdown}from"./mdast-util-gfm.mjs";import{t as gfm}from"./micromark-extension-gfm.mjs";const emptyOptions={};function remarkGfm(e){let t=this,n=e||emptyOptions,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(gfm(n)),a.push(gfmFromMarkdown()),o.push(gfmToMarkdown(n))}export{remarkGfm as t};
|
|
@@ -1,100 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const alertRegex = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i;
|
|
5
|
-
const alertLegacyRegex = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i;
|
|
6
|
-
/**
|
|
7
|
-
* Alerts are a Markdown extension based on the blockquote syntax that you can use to emphasize critical information.
|
|
8
|
-
* On GitHub, they are displayed with distinctive colors and icons to indicate the significance of the content.
|
|
9
|
-
* https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
|
|
10
|
-
*/
|
|
11
|
-
const remarkAlert = ({ legacyTitle = false, tagName = "div" } = {}) => {
|
|
12
|
-
return (tree) => {
|
|
13
|
-
visit(tree, "blockquote", (node, index, parent) => {
|
|
14
|
-
let alertType = "";
|
|
15
|
-
let title = "";
|
|
16
|
-
let isNext = true;
|
|
17
|
-
let child = node.children.map((item) => {
|
|
18
|
-
if (isNext && item.type === "paragraph") {
|
|
19
|
-
const firstNode = item.children[0];
|
|
20
|
-
const text = firstNode.type === "text" ? firstNode.value : "";
|
|
21
|
-
const reg = legacyTitle ? alertLegacyRegex : alertRegex;
|
|
22
|
-
const match = text.match(reg);
|
|
23
|
-
if (match) {
|
|
24
|
-
isNext = false;
|
|
25
|
-
alertType = match[1].toLocaleLowerCase();
|
|
26
|
-
title = legacyTitle ? match[2] || alertType.toLocaleUpperCase() : alertType.toLocaleUpperCase();
|
|
27
|
-
if (text.includes("\n")) item.children[0] = {
|
|
28
|
-
type: "text",
|
|
29
|
-
value: text.replace(reg, "").replace(/^\n+/, "")
|
|
30
|
-
};
|
|
31
|
-
if (!text.includes("\n")) {
|
|
32
|
-
const itemChild = [];
|
|
33
|
-
item.children.forEach((item, idx) => {
|
|
34
|
-
if (idx == 0) return;
|
|
35
|
-
if (idx == 1 && item.type === "break") return;
|
|
36
|
-
itemChild.push(item);
|
|
37
|
-
});
|
|
38
|
-
item.children = [...itemChild];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return item;
|
|
43
|
-
});
|
|
44
|
-
if (!!alertType) {
|
|
45
|
-
node.data = {
|
|
46
|
-
hName: tagName,
|
|
47
|
-
hProperties: {
|
|
48
|
-
className: ["markdown-alert", `markdown-alert-${alertType}`],
|
|
49
|
-
dir: "auto"
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
child.unshift({
|
|
53
|
-
type: "paragraph",
|
|
54
|
-
children: [getAlertIcon(alertType), {
|
|
55
|
-
type: "text",
|
|
56
|
-
value: title.replace(/^\//, "")
|
|
57
|
-
}],
|
|
58
|
-
data: { hProperties: {
|
|
59
|
-
className: "markdown-alert-title",
|
|
60
|
-
dir: "auto"
|
|
61
|
-
} }
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
node.children = [...child];
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
function getAlertIcon(type) {
|
|
69
|
-
return {
|
|
70
|
-
type: "emphasis",
|
|
71
|
-
data: {
|
|
72
|
-
hName: "svg",
|
|
73
|
-
hProperties: {
|
|
74
|
-
className: ["octicon"],
|
|
75
|
-
viewBox: "0 0 16 16",
|
|
76
|
-
width: "16",
|
|
77
|
-
height: "16",
|
|
78
|
-
ariaHidden: "true"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
children: [{
|
|
82
|
-
type: "emphasis",
|
|
83
|
-
data: {
|
|
84
|
-
hName: "path",
|
|
85
|
-
hProperties: { d: pathData[type] ?? "" }
|
|
86
|
-
},
|
|
87
|
-
children: []
|
|
88
|
-
}]
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
const pathData = {
|
|
92
|
-
note: "M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",
|
|
93
|
-
tip: "M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",
|
|
94
|
-
important: "M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",
|
|
95
|
-
warning: "M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",
|
|
96
|
-
caution: "M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
//#endregion
|
|
100
|
-
export { remarkAlert as t };
|
|
1
|
+
import{r as visit}from"./mdast-util-gfm.mjs";const alertRegex=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,alertLegacyRegex=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,remarkAlert=({legacyTitle:r=!1,tagName:a=`div`}={})=>o=>{visit(o,`blockquote`,(e,o,s)=>{let c=``,l=``,u=!0,d=e.children.map(e=>{if(u&&e.type===`paragraph`){let i=e.children[0],a=i.type===`text`?i.value:``,o=r?alertLegacyRegex:alertRegex,s=a.match(o);if(s&&(u=!1,c=s[1].toLocaleLowerCase(),l=r&&s[2]||c.toLocaleUpperCase(),a.includes(`
|
|
2
|
+
`)&&(e.children[0]={type:`text`,value:a.replace(o,``).replace(/^\n+/,``)}),!a.includes(`
|
|
3
|
+
`))){let t=[];e.children.forEach((e,n)=>{n!=0&&(n==1&&e.type===`break`||t.push(e))}),e.children=[...t]}}return e});c&&(e.data={hName:a,hProperties:{className:[`markdown-alert`,`markdown-alert-${c}`],dir:`auto`}},d.unshift({type:`paragraph`,children:[getAlertIcon(c),{type:`text`,value:l.replace(/^\//,``)}],data:{hProperties:{className:`markdown-alert-title`,dir:`auto`}}})),e.children=[...d]})};function getAlertIcon(e){return{type:`emphasis`,data:{hName:`svg`,hProperties:{className:[`octicon`],viewBox:`0 0 16 16`,width:`16`,height:`16`,ariaHidden:`true`}},children:[{type:`emphasis`,data:{hName:`path`,hProperties:{d:pathData[e]??``}},children:[]}]}}const pathData={note:`M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z`,tip:`M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z`,important:`M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,warning:`M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z`,caution:`M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z`};export{remarkAlert as t};
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.js
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('mdast').Root} Root
|
|
6
|
-
* @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions
|
|
7
|
-
* @typedef {import('unified').Parser<Root>} Parser
|
|
8
|
-
* @typedef {import('unified').Processor<Root>} Processor
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {Omit<FromMarkdownOptions, 'extensions' | 'mdastExtensions'>} Options
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Aadd support for parsing from markdown.
|
|
15
|
-
*
|
|
16
|
-
* @param {Readonly<Options> | null | undefined} [options]
|
|
17
|
-
* Configuration (optional).
|
|
18
|
-
* @returns {undefined}
|
|
19
|
-
* Nothing.
|
|
20
|
-
*/
|
|
21
|
-
function remarkParse(options) {
|
|
22
|
-
/** @type {Processor} */
|
|
23
|
-
const self = this;
|
|
24
|
-
self.parser = parser;
|
|
25
|
-
/**
|
|
26
|
-
* @type {Parser}
|
|
27
|
-
*/
|
|
28
|
-
function parser(doc) {
|
|
29
|
-
return fromMarkdown(doc, {
|
|
30
|
-
...self.data("settings"),
|
|
31
|
-
...options,
|
|
32
|
-
extensions: self.data("micromarkExtensions") || [],
|
|
33
|
-
mdastExtensions: self.data("fromMarkdownExtensions") || []
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { remarkParse as t };
|
|
1
|
+
import{t as fromMarkdown}from"./mdast-util-from-markdown.mjs";function remarkParse(e){let t=this;t.parser=n;function n(n){return fromMarkdown(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}export{remarkParse as t};
|
|
@@ -1,171 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/remark-rehype@11.1.2/node_modules/remark-rehype/lib/index.js
|
|
4
|
-
/**
|
|
5
|
-
* @import {Root as HastRoot} from 'hast'
|
|
6
|
-
* @import {Root as MdastRoot} from 'mdast'
|
|
7
|
-
* @import {Options as ToHastOptions} from 'mdast-util-to-hast'
|
|
8
|
-
* @import {Processor} from 'unified'
|
|
9
|
-
* @import {VFile} from 'vfile'
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {Omit<ToHastOptions, 'file'>} Options
|
|
13
|
-
*
|
|
14
|
-
* @callback TransformBridge
|
|
15
|
-
* Bridge-mode.
|
|
16
|
-
*
|
|
17
|
-
* Runs the destination with the new hast tree.
|
|
18
|
-
* Discards result.
|
|
19
|
-
* @param {MdastRoot} tree
|
|
20
|
-
* Tree.
|
|
21
|
-
* @param {VFile} file
|
|
22
|
-
* File.
|
|
23
|
-
* @returns {Promise<undefined>}
|
|
24
|
-
* Nothing.
|
|
25
|
-
*
|
|
26
|
-
* @callback TransformMutate
|
|
27
|
-
* Mutate-mode.
|
|
28
|
-
*
|
|
29
|
-
* Further transformers run on the hast tree.
|
|
30
|
-
* @param {MdastRoot} tree
|
|
31
|
-
* Tree.
|
|
32
|
-
* @param {VFile} file
|
|
33
|
-
* File.
|
|
34
|
-
* @returns {HastRoot}
|
|
35
|
-
* Tree (hast).
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* Turn markdown into HTML.
|
|
39
|
-
*
|
|
40
|
-
* ##### Notes
|
|
41
|
-
*
|
|
42
|
-
* ###### Signature
|
|
43
|
-
*
|
|
44
|
-
* * if a processor is given,
|
|
45
|
-
* runs the (rehype) plugins used on it with a hast tree,
|
|
46
|
-
* then discards the result (*bridge mode*)
|
|
47
|
-
* * otherwise,
|
|
48
|
-
* returns a hast tree,
|
|
49
|
-
* the plugins used after `remarkRehype` are rehype plugins (*mutate mode*)
|
|
50
|
-
*
|
|
51
|
-
* > 👉 **Note**:
|
|
52
|
-
* > It’s highly unlikely that you want to pass a `processor`.
|
|
53
|
-
*
|
|
54
|
-
* ###### HTML
|
|
55
|
-
*
|
|
56
|
-
* Raw HTML is available in mdast as `html` nodes and can be embedded in hast
|
|
57
|
-
* as semistandard `raw` nodes.
|
|
58
|
-
* Most plugins ignore `raw` nodes but two notable ones don’t:
|
|
59
|
-
*
|
|
60
|
-
* * `rehype-stringify` also has an option `allowDangerousHtml` which will
|
|
61
|
-
* output the raw HTML.
|
|
62
|
-
* This is typically discouraged as noted by the option name but is useful if
|
|
63
|
-
* you completely trust authors
|
|
64
|
-
* * `rehype-raw` can handle the raw embedded HTML strings by parsing them
|
|
65
|
-
* into standard hast nodes (`element`, `text`, etc);
|
|
66
|
-
* this is a heavy task as it needs a full HTML parser,
|
|
67
|
-
* but it is the only way to support untrusted content
|
|
68
|
-
*
|
|
69
|
-
* ###### Footnotes
|
|
70
|
-
*
|
|
71
|
-
* Many options supported here relate to footnotes.
|
|
72
|
-
* Footnotes are not specified by CommonMark,
|
|
73
|
-
* which we follow by default.
|
|
74
|
-
* They are supported by GitHub,
|
|
75
|
-
* so footnotes can be enabled in markdown with `remark-gfm`.
|
|
76
|
-
*
|
|
77
|
-
* The options `footnoteBackLabel` and `footnoteLabel` define natural language
|
|
78
|
-
* that explains footnotes,
|
|
79
|
-
* which is hidden for sighted users but shown to assistive technology.
|
|
80
|
-
* When your page is not in English,
|
|
81
|
-
* you must define translated values.
|
|
82
|
-
*
|
|
83
|
-
* Back references use ARIA attributes,
|
|
84
|
-
* but the section label itself uses a heading that is hidden with an
|
|
85
|
-
* `sr-only` class.
|
|
86
|
-
* To show it to sighted users,
|
|
87
|
-
* define different attributes in `footnoteLabelProperties`.
|
|
88
|
-
*
|
|
89
|
-
* ###### Clobbering
|
|
90
|
-
*
|
|
91
|
-
* Footnotes introduces a problem,
|
|
92
|
-
* as it links footnote calls to footnote definitions on the page through `id`
|
|
93
|
-
* attributes generated from user content,
|
|
94
|
-
* which results in DOM clobbering.
|
|
95
|
-
*
|
|
96
|
-
* DOM clobbering is this:
|
|
97
|
-
*
|
|
98
|
-
* ```html
|
|
99
|
-
* <p id=x></p>
|
|
100
|
-
* <script>alert(x) // `x` now refers to the DOM `p#x` element<\/script>
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
* Elements by their ID are made available by browsers on the `window` object,
|
|
104
|
-
* which is a security risk.
|
|
105
|
-
* Using a prefix solves this problem.
|
|
106
|
-
*
|
|
107
|
-
* More information on how to handle clobbering and the prefix is explained in
|
|
108
|
-
* *Example: headings (DOM clobbering)* in `rehype-sanitize`.
|
|
109
|
-
*
|
|
110
|
-
* ###### Unknown nodes
|
|
111
|
-
*
|
|
112
|
-
* Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.
|
|
113
|
-
* The default behavior for unknown nodes is:
|
|
114
|
-
*
|
|
115
|
-
* * when the node has a `value`
|
|
116
|
-
* (and doesn’t have `data.hName`, `data.hProperties`, or `data.hChildren`,
|
|
117
|
-
* see later),
|
|
118
|
-
* create a hast `text` node
|
|
119
|
-
* * otherwise,
|
|
120
|
-
* create a `<div>` element (which could be changed with `data.hName`),
|
|
121
|
-
* with its children mapped from mdast to hast as well
|
|
122
|
-
*
|
|
123
|
-
* This behavior can be changed by passing an `unknownHandler`.
|
|
124
|
-
*
|
|
125
|
-
* @overload
|
|
126
|
-
* @param {Processor} processor
|
|
127
|
-
* @param {Readonly<Options> | null | undefined} [options]
|
|
128
|
-
* @returns {TransformBridge}
|
|
129
|
-
*
|
|
130
|
-
* @overload
|
|
131
|
-
* @param {Readonly<Options> | null | undefined} [options]
|
|
132
|
-
* @returns {TransformMutate}
|
|
133
|
-
*
|
|
134
|
-
* @overload
|
|
135
|
-
* @param {Readonly<Options> | Processor | null | undefined} [destination]
|
|
136
|
-
* @param {Readonly<Options> | null | undefined} [options]
|
|
137
|
-
* @returns {TransformBridge | TransformMutate}
|
|
138
|
-
*
|
|
139
|
-
* @param {Readonly<Options> | Processor | null | undefined} [destination]
|
|
140
|
-
* Processor or configuration (optional).
|
|
141
|
-
* @param {Readonly<Options> | null | undefined} [options]
|
|
142
|
-
* When a processor was given,
|
|
143
|
-
* configuration (optional).
|
|
144
|
-
* @returns {TransformBridge | TransformMutate}
|
|
145
|
-
* Transform.
|
|
146
|
-
*/
|
|
147
|
-
function remarkRehype(destination, options) {
|
|
148
|
-
if (destination && "run" in destination)
|
|
149
|
-
/**
|
|
150
|
-
* @type {TransformBridge}
|
|
151
|
-
*/
|
|
152
|
-
return async function(tree, file) {
|
|
153
|
-
const hastTree = toHast(tree, {
|
|
154
|
-
file,
|
|
155
|
-
...options
|
|
156
|
-
});
|
|
157
|
-
await destination.run(hastTree, file);
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* @type {TransformMutate}
|
|
161
|
-
*/
|
|
162
|
-
return function(tree, file) {
|
|
163
|
-
return toHast(tree, {
|
|
164
|
-
file,
|
|
165
|
-
...destination || options
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
//#endregion
|
|
171
|
-
export { remarkRehype as t };
|
|
1
|
+
import{t as toHast}from"./mdast-util-to-hast.mjs";function remarkRehype(e,t){return e&&`run`in e?async function(n,r){let i=toHast(n,{file:r,...t});await e.run(i,r)}:function(n,r){return toHast(n,{file:r,...e||t})}}export{remarkRehype as t};
|