@shell-shock/unified 0.1.2 → 0.1.4
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/html/index.cjs +1 -1
- package/dist/html/index.d.cts +8 -4
- package/dist/html/index.d.cts.map +1 -1
- package/dist/html/index.d.mts +7 -4
- package/dist/html/index.d.mts.map +1 -1
- package/dist/html/index.mjs +1 -2
- package/dist/html-BK9y-nf5.cjs +4 -0
- package/dist/html-DzncQodH.mjs +5 -0
- package/dist/html-DzncQodH.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -72
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -72
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/index.cjs +1 -1
- package/dist/markdown/index.d.cts +12 -2
- package/dist/markdown/index.d.cts.map +1 -1
- package/dist/markdown/index.d.mts +11 -2
- package/dist/markdown/index.d.mts.map +1 -1
- package/dist/markdown/index.mjs +1 -1
- package/dist/markdown-BiaU4FQg.mjs +3 -0
- package/dist/markdown-BiaU4FQg.mjs.map +1 -0
- package/dist/markdown-DX-arJZe.cjs +2 -0
- package/dist/types-C5cPWP5x.d.mts +94 -0
- package/dist/types-C5cPWP5x.d.mts.map +1 -0
- package/dist/types-C7nXIjAN.d.cts +94 -0
- package/dist/types-C7nXIjAN.d.cts.map +1 -0
- package/package.json +22 -4
- package/dist/html/index.mjs.map +0 -1
- package/dist/markdown-Bs-BRrSC.mjs +0 -3
- package/dist/markdown-Bs-BRrSC.mjs.map +0 -1
- package/dist/markdown-TYR6_cQU.cjs +0 -2
package/dist/html/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../html-BK9y-nf5.cjs`);exports.renderHtml=e.t;
|
package/dist/html/index.d.cts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { t as Options } from "../types-C7nXIjAN.cjs";
|
|
2
|
+
|
|
1
3
|
//#region src/html/index.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Renders HTML content as source code for displaying in the terminal.
|
|
4
6
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @
|
|
7
|
+
* @param html - HTML content
|
|
8
|
+
* @param options - Configuration options for rendering the HTML.
|
|
9
|
+
* @return A string of source code that can be executed to display the rendered HTML in the terminal.
|
|
7
10
|
*/
|
|
8
|
-
declare
|
|
9
|
-
|
|
11
|
+
declare function renderHtml(html: string, options: Options): string;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { renderHtml };
|
|
10
14
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/html/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/html/index.ts"],"mappings":";;;;;AA8BA;;;;;iBAAgB,UAAA,CAAW,IAAA,UAAc,OAAA,EAAS,OAAA"}
|
package/dist/html/index.d.mts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { t as Options } from "../types-C5cPWP5x.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/html/index.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Renders HTML content as source code for displaying in the terminal.
|
|
4
6
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @
|
|
7
|
+
* @param html - HTML content
|
|
8
|
+
* @param options - Configuration options for rendering the HTML.
|
|
9
|
+
* @return A string of source code that can be executed to display the rendered HTML in the terminal.
|
|
7
10
|
*/
|
|
8
|
-
declare
|
|
11
|
+
declare function renderHtml(html: string, options: Options): string;
|
|
9
12
|
//#endregion
|
|
10
|
-
export {
|
|
13
|
+
export { renderHtml };
|
|
11
14
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/html/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/html/index.ts"],"mappings":";;;;;AA8BA;;;;;iBAAgB,UAAA,CAAW,IAAA,UAAc,OAAA,EAAS,OAAA"}
|
package/dist/html/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import{t as e}from"../html-DzncQodH.mjs";export{e as renderHtml};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`parse5`),l=require(`he`);l=s(l);let u=require(`normalize-html-whitespace`);u=s(u),require(`wrap-ansi`);const d=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),f=(e,t)=>e==null&&t==null?null:e==null?t:t==null?e:t.value==null?{pre:e.pre,value:e.value,post:e.post==null?t.pre==null?t.post==null?``:t.post:t.pre:e.post}:e.value==null?{pre:e.pre==null?e.post==null?t.pre==null?``:t.pre:e.post:e.pre,value:t.value,post:t.post}:e.post==null?t.pre==null?{pre:e.pre,value:`${e.value}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${t.pre}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${e.post}${t.value}`,post:t.post},p=new WeakMap,m=(e,t,n=null)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=p.get(e);if(r){let e=r.get(t);if(e!==void 0)return e??n}if(!e.attrs||!Array.isArray(e.attrs)||e.attrs.length===0)return r||(r=new Map,p.set(e,r)),r.set(t,null),n;let i=e.attrs.find(e=>e&&typeof e==`object`&&e.name===t);if(r||(r=new Map,p.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let a=i.value;return r.set(t,a),a},h=l.default.decode,g=u.default,_=(e,t)=>{let n=String(e.value??``);if(t.pre)return{pre:null,value:h(n),post:null,type:`inline`,nodeName:`#text`};let r=[...(g(n)||``).replaceAll(`
|
|
2
|
+
`,` `)],i=[` `,`
|
|
3
|
+
`].includes(r[0]??``)?r.shift()??null:null,a=[` `,`
|
|
4
|
+
`].includes(r.at(-1)??``)?r.pop()??null:null;return{pre:i,value:r.length>0?`${h(r.join(``))}`:null,post:a,type:`inline`,nodeName:`#text`}},v=e=>(t,n)=>{let r=e??(e=>e??null),i=x.span;if(!t||!t.childNodes)return null;let a=t.childNodes.reduce((e,r)=>{let a=E(r,n,i);return a?{...f(e,a),type:`inline`,nodeName:t.nodeName}:e},null);return{pre:a?.pre?r(a.pre,t,n):null,value:r(a?.value,t,n),post:a?.post?r(a.post,t,n):null,type:`inline`,nodeName:t.nodeName}},y=v((e,t,n)=>{let r=m(t,`href`,null),i=m(t,`title`,null),a=!r||[`file://`,`http://`,`https://`,`mailto:`,`ftp://`,`ftps://`,`sftp://`,`ssh://`,`dav://`,`tel:`,`git://`].some(e=>r.startsWith(e))?r:null;return a?`link("${a}", ${i?`"${i}", `:``}${a&&(a.startsWith(`http://`)||a.startsWith(`https://`))?`true`:`false`})`:i?`"${i}"`:``}),b=v((e,t)=>{let n=m(t,`title`,null);return e?n?`${e} (${n})`:e:``});var x={"#text":_,a:y,abbr:b};const S=process.env.CACHE_RENDER!==`false`,C=new WeakMap,w=(e,t)=>{if(!S||!e||typeof e!=`object`)return;let n=C.get(e);if(n)return n.get(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}))},T=(e,t,n)=>{if(!S||!e||typeof e!=`object`)return;let r=C.get(e);if(r||(r=new Map,C.set(e,r)),r.set(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}),n),r.size>10){let e=r.keys().next().value;r.delete(e)}},E=(e,t,n=x.div)=>{if(!e)return null;let r=t.depth===void 0?0:t.depth;if(r>=100)return null;let i={...t,depth:r+1},a=w(e,i);if(a!==void 0)return a;let o=null;try{o=(x[e.nodeName||`#text`]||n)(e,i),T(e,i,o)}catch{o=null}return o};function D(e,t){return`${(E((0,c.parse)(e,{sourceCodeLocationInfo:!0}),d(t))||{value:``}).value}\n`}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return D}});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{parse as e}from"parse5";import t from"he";import n from"normalize-html-whitespace";import"wrap-ansi";const r=e=>({pre:!1,lineWidth:120,fontAttrs:!0,depth:0,asciiMode:!1,...e}),i=(e,t)=>e==null&&t==null?null:e==null?t:t==null?e:t.value==null?{pre:e.pre,value:e.value,post:e.post==null?t.pre==null?t.post==null?``:t.post:t.pre:e.post}:e.value==null?{pre:e.pre==null?e.post==null?t.pre==null?``:t.pre:e.post:e.pre,value:t.value,post:t.post}:e.post==null?t.pre==null?{pre:e.pre,value:`${e.value}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${t.pre}${t.value}`,post:t.post}:{pre:e.pre,value:`${e.value}${e.post}${t.value}`,post:t.post},a=new WeakMap,o=(e,t,n=null)=>{if(!e||typeof e!=`object`||!t||typeof t!=`string`)return n;let r=a.get(e);if(r){let e=r.get(t);if(e!==void 0)return e??n}if(!e.attrs||!Array.isArray(e.attrs)||e.attrs.length===0)return r||(r=new Map,a.set(e,r)),r.set(t,null),n;let i=e.attrs.find(e=>e&&typeof e==`object`&&e.name===t);if(r||(r=new Map,a.set(e,r)),!i||i.value===void 0)return r.set(t,null),n;let o=i.value;return r.set(t,o),o},s=t.decode,c=n,l=(e,t)=>{let n=String(e.value??``);if(t.pre)return{pre:null,value:s(n),post:null,type:`inline`,nodeName:`#text`};let r=[...(c(n)||``).replaceAll(`
|
|
2
|
+
`,` `)],i=[` `,`
|
|
3
|
+
`].includes(r[0]??``)?r.shift()??null:null,a=[` `,`
|
|
4
|
+
`].includes(r.at(-1)??``)?r.pop()??null:null;return{pre:i,value:r.length>0?`${s(r.join(``))}`:null,post:a,type:`inline`,nodeName:`#text`}},u=e=>(t,n)=>{let r=e??(e=>e??null),a=p.span;if(!t||!t.childNodes)return null;let o=t.childNodes.reduce((e,r)=>{let o=v(r,n,a);return o?{...i(e,o),type:`inline`,nodeName:t.nodeName}:e},null);return{pre:o?.pre?r(o.pre,t,n):null,value:r(o?.value,t,n),post:o?.post?r(o.post,t,n):null,type:`inline`,nodeName:t.nodeName}},d=u((e,t,n)=>{let r=o(t,`href`,null),i=o(t,`title`,null),a=!r||[`file://`,`http://`,`https://`,`mailto:`,`ftp://`,`ftps://`,`sftp://`,`ssh://`,`dav://`,`tel:`,`git://`].some(e=>r.startsWith(e))?r:null;return a?`link("${a}", ${i?`"${i}", `:``}${a&&(a.startsWith(`http://`)||a.startsWith(`https://`))?`true`:`false`})`:i?`"${i}"`:``}),f=u((e,t)=>{let n=o(t,`title`,null);return e?n?`${e} (${n})`:e:``});var p={"#text":l,a:d,abbr:f};const m=process.env.CACHE_RENDER!==`false`,h=new WeakMap,g=(e,t)=>{if(!m||!e||typeof e!=`object`)return;let n=h.get(e);if(n)return n.get(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}))},_=(e,t,n)=>{if(!m||!e||typeof e!=`object`)return;let r=h.get(e);if(r||(r=new Map,h.set(e,r)),r.set(JSON.stringify({lineWidth:t.lineWidth,pre:t.pre,listDepth:t.listDepth,listType:t.listType,depth:t.depth}),n),r.size>10){let e=r.keys().next().value;r.delete(e)}},v=(e,t,n=p.div)=>{if(!e)return null;let r=t.depth===void 0?0:t.depth;if(r>=100)return null;let i={...t,depth:r+1},a=g(e,i);if(a!==void 0)return a;let o=null;try{o=(p[e.nodeName||`#text`]||n)(e,i),_(e,i,o)}catch{o=null}return o};function y(t,n){return`${(v(e(t,{sourceCodeLocationInfo:!0}),r(n))||{value:``}).value}\n`}export{y as t};
|
|
5
|
+
//# sourceMappingURL=html-DzncQodH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-DzncQodH.mjs","names":["tags","tags"],"sources":["../src/html/helpers/options.ts","../src/html/helpers/concat.ts","../src/html/helpers/get-attribute.ts","../src/html/helpers/tag-utilities.ts","../src/html/tags/a.ts","../src/html/tags/abbr.ts","../src/html/tags/index.ts","../src/html/helpers/render.ts","../src/html/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Options, ResolvedOptions } from \"../../types\";\n\nexport const getOptions = (input: Options): ResolvedOptions => {\n return {\n pre: false,\n lineWidth: 120,\n fontAttrs: true,\n depth: 0,\n asciiMode: false,\n ...input\n };\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst toMarginNumber = value => {\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : 0;\n};\n\nexport const concatTwoBlockTags = (first, second) => {\n if (first == null && second == null) {\n return null;\n }\n\n if (first == null) {\n return second;\n }\n\n if (second == null) {\n return first;\n }\n\n const firstMarginTop = toMarginNumber(first.marginTop);\n const firstMarginBottom = toMarginNumber(first.marginBottom);\n const secondMarginTop = toMarginNumber(second.marginTop);\n const secondMarginBottom = toMarginNumber(second.marginBottom);\n\n if (second.value == null) {\n return {\n marginTop: firstMarginTop,\n value: first.value,\n marginBottom: Math.max(\n firstMarginBottom,\n secondMarginTop,\n secondMarginBottom\n )\n };\n }\n\n if (first.value == null) {\n return {\n marginTop: Math.max(firstMarginTop, firstMarginBottom, secondMarginTop),\n value: second.value,\n marginBottom: secondMarginBottom\n };\n }\n\n const separatorLines = Math.max(firstMarginBottom, secondMarginTop);\n\n return {\n marginTop: firstMarginTop,\n value: `${first.value}${\"\\n\".repeat(separatorLines)}${second.value}`,\n marginBottom: secondMarginBottom\n };\n};\n\nexport const concatTwoInlineTags = (first, second) => {\n if (first == null && second == null) {\n return null;\n }\n\n if (first == null) {\n return second;\n }\n\n if (second == null) {\n return first;\n }\n\n if (second.value == null) {\n return {\n pre: first.pre,\n value: first.value,\n post:\n first.post == null\n ? second.pre == null\n ? second.post == null\n ? \"\"\n : second.post\n : second.pre\n : first.post\n };\n }\n\n if (first.value == null) {\n return {\n pre:\n first.pre == null\n ? first.post == null\n ? second.pre == null\n ? \"\"\n : second.pre\n : first.post\n : first.pre,\n value: second.value,\n post: second.post\n };\n }\n\n if (first.post != null) {\n return {\n pre: first.pre,\n value: `${first.value}${first.post}${second.value}`,\n post: second.post\n };\n }\n\n if (second.pre != null) {\n return {\n pre: first.pre,\n value: `${first.value}${second.pre}${second.value}`,\n post: second.post\n };\n }\n\n return {\n pre: first.pre,\n value: `${first.value}${second.value}`,\n post: second.post\n };\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\ninterface TagAttribute {\n name: string;\n value?: string;\n}\n\ninterface Tag {\n attrs?: TagAttribute[];\n [key: string]: unknown;\n}\n\nconst attributeCache = new WeakMap<Tag, Map<string, string | null>>();\n\n/**\n * Get attribute value from tag with validation and caching\n * @param tag - HTML tag object\n * @param attributeName - Name of attribute to get\n * @param defaultValue - Default value if attribute not found\n * @returns Attribute value or default\n */\nexport const getAttribute = (\n tag: Tag,\n attributeName: string | unknown,\n defaultValue: string | null = null\n): string | null => {\n // Validate inputs\n if (!tag || typeof tag !== \"object\") {\n return defaultValue;\n }\n\n if (!attributeName || typeof attributeName !== \"string\") {\n return defaultValue;\n }\n\n // Check cache first\n let tagCache = attributeCache.get(tag);\n if (tagCache) {\n const cachedValue = tagCache.get(attributeName);\n if (cachedValue !== undefined) {\n return cachedValue ?? defaultValue;\n }\n }\n\n // Not in cache, compute value\n if (!tag.attrs || !Array.isArray(tag.attrs) || tag.attrs.length === 0) {\n // Cache the miss\n if (!tagCache) {\n tagCache = new Map();\n attributeCache.set(tag, tagCache);\n }\n tagCache.set(attributeName, null);\n return defaultValue;\n }\n\n const attribute = tag.attrs.find(\n attr => attr && typeof attr === \"object\" && attr.name === attributeName\n );\n\n // Cache the result\n if (!tagCache) {\n tagCache = new Map();\n attributeCache.set(tag, tagCache);\n }\n\n if (!attribute || attribute.value === undefined) {\n tagCache.set(attributeName, null);\n return defaultValue;\n }\n\n const value = attribute.value;\n tagCache.set(attributeName, value);\n return value;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport he from \"he\";\nimport normalizeWhitespace from \"normalize-html-whitespace\";\nimport tags from \"../tags\";\nimport { concatTwoBlockTags, concatTwoInlineTags } from \"./concat\";\nimport { getAttribute } from \"./get-attribute\";\nimport { renderTag } from \"./render\";\nimport { wrapLineWidth } from \"./wrap-line-width\";\n\nconst decodeHtml = he.decode as (value: string) => string;\nconst normalizeHtmlWhitespace = normalizeWhitespace as (\n value: string\n) => string;\n\nexport type WrapValue = string | null | undefined;\n\nexport interface HtmlAttribute {\n name: string;\n value?: string;\n}\n\nexport interface HtmlNode {\n nodeName?: string;\n value?: string;\n childNodes?: HtmlNode[];\n attrs?: HtmlAttribute[];\n [key: string]: unknown;\n}\n\nexport interface RenderContext {\n pre?: boolean | null;\n liItemNumber?: number;\n lineWidth?: number;\n listDepth?: number;\n listType?: string;\n depth?: number;\n [key: string]: unknown;\n}\n\nexport interface InlineTagValue {\n pre: string | null;\n value: string | null;\n post: string | null;\n type: \"inline\";\n nodeName: string | undefined;\n}\n\nexport interface BlockTagValue {\n marginTop: number;\n value: string | null;\n marginBottom: number;\n type: \"block\";\n nodeName: string | undefined;\n}\n\nexport type RenderedTag = InlineTagValue | BlockTagValue;\n\nexport interface BlockTagAccumulator {\n block: BlockTagValue | null;\n inline: InlineTagValue | null;\n}\n\nexport type BlockTagWrapper = (\n value: string,\n tag: HtmlNode,\n context: RenderContext\n) => string | null;\n\nexport type InlineTagWrapper = (\n value: WrapValue,\n tag: HtmlNode,\n context: RenderContext\n) => string | null;\n\nexport interface BlockTagMargins {\n marginTop?: number;\n marginBottom?: number;\n}\n\nexport const inlineToBlockTag = (\n value: InlineTagValue | null | undefined\n): BlockTagValue | null => {\n if (!value) {\n return null;\n }\n\n return {\n ...value,\n marginTop: 0,\n marginBottom: 0,\n type: \"block\",\n nodeName: \"#blockTag\"\n };\n};\n\nexport const textNode = (\n tag: HtmlNode,\n context: RenderContext\n): InlineTagValue => {\n const textValue = String(tag.value ?? \"\");\n\n if (context.pre) {\n return {\n pre: null,\n value: decodeHtml(textValue),\n post: null,\n type: \"inline\",\n nodeName: \"#text\"\n };\n }\n\n const normalized = [\n ...(normalizeHtmlWhitespace(textValue) || \"\").replaceAll(\"\\n\", \" \")\n ];\n\n const pre = [\" \", \"\\n\"].includes(normalized[0] ?? \"\")\n ? (normalized.shift() ?? null)\n : null;\n const post = [\" \", \"\\n\"].includes(normalized.at(-1) ?? \"\")\n ? (normalized.pop() ?? null)\n : null;\n\n return {\n pre,\n value: normalized.length > 0 ? `${decodeHtml(normalized.join(\"\"))}` : null,\n post,\n type: \"inline\",\n nodeName: \"#text\"\n };\n};\n\n/**\n * A helper function to render block-level HTML tags, processing their child nodes and applying appropriate margins and formatting based on the provided context and wrapper function. The function handles both block and inline child nodes, concatenating their rendered output while managing whitespace and line breaks to ensure proper display in terminal environments.\n *\n * @param wrapper - A function that takes the rendered content of the block tag and returns a potentially modified version of it. This allows for custom processing or styling to be applied to the content of the block tag.\n * @param localContext - An optional context object that can be used to provide additional information or configuration for rendering the block tag. This context can include properties such as margin settings, theme information, or any other relevant data that may influence how the block tag is rendered.\n * @returns A function that renders a block-level HTML tag, processing its child nodes and applying appropriate margins and formatting based on the provided context and wrapper function. The function handles both block and inline child nodes, concatenating their rendered output while managing whitespace and line breaks to ensure proper display in terminal environments.\n */\nexport function blockTag(\n wrapper?: BlockTagWrapper,\n localContext?: BlockTagMargins\n): (tag: HtmlNode, context: RenderContext) => BlockTagValue | null {\n return (tag: HtmlNode, context: RenderContext): BlockTagValue | null => {\n const wrapFunction: BlockTagWrapper =\n wrapper ?? ((argument: string) => argument);\n\n if (!tag || !tag.childNodes) {\n return null;\n }\n\n let liItemNumber = Number.parseInt(\n getAttribute(tag, \"start\", \"1\") ?? \"1\",\n 10\n );\n const value = tag.childNodes.reduce(\n (accumulator: BlockTagAccumulator, node: HtmlNode) => {\n const nodeTag = renderTag(node, {\n ...context,\n liItemNumber\n }) as RenderedTag | null;\n\n if (!nodeTag) {\n return accumulator;\n }\n\n if (nodeTag.nodeName === \"li\") {\n liItemNumber += 1;\n }\n\n if (nodeTag.type === \"inline\") {\n return {\n block: accumulator.block,\n inline: concatTwoInlineTags(accumulator.inline, nodeTag)\n };\n }\n\n if (accumulator.inline && accumulator.inline.value != null) {\n accumulator.inline.value = wrapLineWidth(\n accumulator.inline.value,\n context\n );\n }\n\n accumulator.block = concatTwoBlockTags(\n accumulator.block,\n inlineToBlockTag(accumulator.inline)\n );\n\n accumulator.block = concatTwoBlockTags(accumulator.block, nodeTag);\n\n return {\n block: accumulator.block,\n inline: null\n };\n },\n {\n block: null,\n inline: null\n } as BlockTagAccumulator\n );\n\n if (value.inline != null && value.inline.value != null) {\n value.inline.value = wrapLineWidth(value.inline.value, context);\n }\n\n value.block = concatTwoBlockTags(\n value.block,\n inlineToBlockTag(value.inline)\n );\n\n let topBlock = localContext?.marginTop ?? 0;\n\n topBlock = !context || !context.pre ? topBlock + 1 : topBlock;\n\n let bottomBlock = localContext?.marginBottom ?? 0;\n\n bottomBlock = !context || !context.pre ? bottomBlock + 1 : bottomBlock;\n\n // Handle empty content - return empty string with margins instead of null\n if (!value.block || !value.block.value) {\n return {\n marginTop: topBlock,\n value: \"\",\n marginBottom: bottomBlock,\n type: \"block\",\n nodeName: tag.nodeName\n };\n }\n\n return {\n marginTop:\n value.block.marginTop && value.block.marginTop > topBlock\n ? value.block.marginTop\n : topBlock,\n value: wrapFunction(value.block.value, tag, context),\n marginBottom:\n value.block.marginBottom && value.block.marginBottom > bottomBlock\n ? value.block.marginBottom\n : bottomBlock,\n type: \"block\",\n nodeName: tag.nodeName\n };\n };\n}\n\nexport const inlineTag =\n (wrapper?: InlineTagWrapper) =>\n (tag: HtmlNode, context: RenderContext): InlineTagValue | null => {\n const wrapFunction: InlineTagWrapper =\n wrapper ?? ((argument: WrapValue) => argument ?? null);\n\n const spanTag = (tags as Record<string, unknown>).span;\n\n if (!tag || !tag.childNodes) {\n return null;\n }\n\n const value = tag.childNodes.reduce(\n (accumulator, node) => {\n const nodeTag = renderTag(\n node,\n context,\n spanTag as Parameters<typeof renderTag>[2]\n ) as RenderedTag | null;\n\n if (!nodeTag) {\n return accumulator;\n }\n\n return {\n ...concatTwoInlineTags(accumulator, nodeTag),\n type: \"inline\",\n nodeName: tag.nodeName\n };\n },\n null as InlineTagValue | null\n );\n\n return {\n pre: value?.pre ? wrapFunction(value.pre, tag, context) : null,\n value: wrapFunction(value?.value, tag, context),\n post: value?.post ? wrapFunction(value.post, tag, context) : null,\n type: \"inline\",\n nodeName: tag.nodeName\n };\n };\n\nexport const voidTag = (): null => null;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\n\nexport const a = inlineTag((_, tag, __) => {\n const rawHref = getAttribute(tag, \"href\", null);\n const rawTitle = getAttribute(tag, \"title\", null);\n\n const href =\n !rawHref ||\n [\n \"file://\",\n \"http://\",\n \"https://\",\n \"mailto:\",\n \"ftp://\",\n \"ftps://\",\n \"sftp://\",\n \"ssh://\",\n \"dav://\",\n \"tel:\",\n \"git://\"\n ].some(url => rawHref.startsWith(url))\n ? rawHref\n : null;\n\n return href\n ? `link(\"${href}\", ${rawTitle ? `\"${rawTitle}\", ` : \"\"}${\n href && (href.startsWith(\"http://\") || href.startsWith(\"https://\"))\n ? \"true\"\n : \"false\"\n })`\n : rawTitle\n ? `\"${rawTitle}\"`\n : \"\";\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getAttribute } from \"../helpers/get-attribute\";\nimport { inlineTag } from \"../helpers/tag-utilities\";\n\nexport const abbr = inlineTag((value, tag) => {\n const title = getAttribute(tag, \"title\", null);\n\n return value ? (title ? `${value} (${title})` : value) : \"\";\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { textNode } from \"../helpers/tag-utilities\";\nimport { a } from \"./a\";\nimport { abbr } from \"./abbr\";\n\nexport default {\n \"#text\": textNode,\n a,\n abbr\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport tags from \"../tags\";\n\nconst MAX_DEPTH = 100;\nconst CACHE_ENABLED = process.env.CACHE_RENDER !== \"false\";\n\n/**\n * Cache for rendered subtrees (WeakMap for automatic garbage collection)\n * Key: node object, Value: Map of context hash -\\> rendered result\n */\nconst renderCache = new WeakMap();\n\n/**\n * Get cached render result\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @returns - Cached result or undefined\n */\nconst getCachedRender = (node, context) => {\n if (!CACHE_ENABLED || !node || typeof node !== \"object\") {\n return;\n }\n\n const nodeCache = renderCache.get(node);\n if (!nodeCache) {\n return;\n }\n\n return nodeCache.get(\n JSON.stringify({\n lineWidth: context.lineWidth,\n pre: context.pre,\n listDepth: context.listDepth,\n listType: context.listType,\n depth: context.depth\n })\n );\n};\n\n/**\n * Cache render result\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @param result - Render result\n */\nconst setCachedRender = (node, context, result) => {\n if (!CACHE_ENABLED || !node || typeof node !== \"object\") {\n return;\n }\n\n let nodeCache = renderCache.get(node);\n if (!nodeCache) {\n nodeCache = new Map();\n renderCache.set(node, nodeCache);\n }\n\n nodeCache.set(\n JSON.stringify({\n lineWidth: context.lineWidth,\n pre: context.pre,\n listDepth: context.listDepth,\n listType: context.listType,\n depth: context.depth\n }),\n result\n );\n\n // Limit cache size per node to prevent memory bloat\n if (nodeCache.size > 10) {\n const firstKey = nodeCache.keys().next().value;\n nodeCache.delete(firstKey);\n }\n};\n\n/**\n * Render HTML tag with optimizations for deep nesting\n *\n * @param node - HTML node\n * @param context - Rendering context\n * @param defaultTag - Default tag function\n * @returns - Render result\n */\nexport const renderTag = (node, context, defaultTag = tags.div) => {\n // Validate inputs\n if (!node) {\n return null;\n }\n\n // Initialize depth on first call\n const currentDepth = context.depth === undefined ? 0 : context.depth;\n\n // Check if we've exceeded maximum nesting depth\n if (currentDepth >= MAX_DEPTH) {\n return null;\n }\n\n // Create new context with incremented depth\n const newContext = { ...context, depth: currentDepth + 1 };\n\n // Check cache with new context (includes updated depth)\n const cached = getCachedRender(node, newContext);\n if (cached !== undefined) {\n return cached;\n }\n\n let result = null;\n\n try {\n const tagFunction = tags[node.nodeName || \"#text\"] || defaultTag;\n\n // Render tag\n result = tagFunction(node, newContext);\n\n // Cache result with new context (includes updated depth)\n setCachedRender(node, newContext, result);\n } catch {\n // Return null on error to skip this tag\n result = null;\n }\n\n return result;\n};\n\n/**\n * Batch render multiple nodes\n * Optimized for rendering lists and repeated structures\n * @param nodes - Array of HTML nodes\n * @param context - Rendering context\n * @param defaultTag - Default tag function\n * @returns - Array of render results\n */\nexport const renderNodes = (nodes, context, defaultTag = tags.div) => {\n if (!nodes || !Array.isArray(nodes) || nodes.length === 0) {\n return [];\n }\n\n const results = [];\n\n for (const node of nodes) {\n const result = renderTag(node, context, defaultTag);\n\n if (result !== null && result !== undefined) {\n results.push(result);\n }\n }\n\n return results;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parse } from \"parse5\";\nimport type { Options } from \"../types\";\nimport { getOptions } from \"./helpers/options\";\nimport { renderTag } from \"./helpers/render\";\n\n/**\n * Renders HTML content as source code for displaying in the terminal.\n *\n * @param html - HTML content\n * @param options - Configuration options for rendering the HTML.\n * @return A string of source code that can be executed to display the rendered HTML in the terminal.\n */\nexport function renderHtml(html: string, options: Options): string {\n const document = parse(html, { sourceCodeLocationInfo: true });\n\n return `${(renderTag(document, getOptions(options)) || { value: \"\" }).value}\\n`;\n}\n"],"mappings":"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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./html
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./html-BK9y-nf5.cjs`),t=require(`./markdown-DX-arJZe.cjs`),n={heading:(e,t=1)=>`bold(textColors.heading.${t===1?`primary`:t===2?`secondary`:`tertiary`}("${e}"))`,body:e=>`textColors.body.primary("${e}")`,bold:e=>`bold("${e}")`,italic:e=>`italic("${e}")`,strikethrough:e=>`strikethrough("${e}")`,underline:e=>`underline("${e}")`,blockquote:e=>`blockquote("${e}")`,link:(e,t)=>`link("${e}"${t?`, "${t}"`:``})`,table:e=>`table(${JSON.stringify(e)})`,code:(e,t)=>`code(${JSON.stringify(e)}${t?`, "${t}"`:``})`,inlineCode:e=>`inlineCode("${e}")`,break:()=>`writeLine("")`,divider:()=>`divider({ border: "primary" })`};exports.defaultRenderAdapter=n,exports.renderHtml=e.t,exports.renderMarkdown=t.t;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,80 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { n as RenderAdapter, r as ResolvedOptions, t as Options } from "./types-C7nXIjAN.cjs";
|
|
2
|
+
import { renderHtml } from "./html/index.cjs";
|
|
3
|
+
import { renderMarkdown } from "./markdown/index.cjs";
|
|
3
4
|
|
|
4
|
-
//#region src/types.d.ts
|
|
5
|
-
interface RenderAdapter {
|
|
6
|
-
/**
|
|
7
|
-
* Heading text.
|
|
8
|
-
*/
|
|
9
|
-
heading: (text: string, level: number) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Body text.
|
|
12
|
-
*/
|
|
13
|
-
body: (text: string) => string;
|
|
14
|
-
/**
|
|
15
|
-
* Bold text.
|
|
16
|
-
*/
|
|
17
|
-
bold: (text: string) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Italic text.
|
|
20
|
-
*/
|
|
21
|
-
italic: (text: string) => string;
|
|
22
|
-
/**
|
|
23
|
-
* Strikethrough text.
|
|
24
|
-
*/
|
|
25
|
-
strikethrough: (text: string) => string;
|
|
26
|
-
/**
|
|
27
|
-
* Underlined text.
|
|
28
|
-
*/
|
|
29
|
-
underline: (text: string) => string;
|
|
30
|
-
/**
|
|
31
|
-
* Blockquote text.
|
|
32
|
-
*/
|
|
33
|
-
blockquote: (text: string) => string;
|
|
34
|
-
/**
|
|
35
|
-
* Link text.
|
|
36
|
-
*/
|
|
37
|
-
link: (url: string, text?: string) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Table.
|
|
40
|
-
*/
|
|
41
|
-
table: (cells: string[][]) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Code block.
|
|
44
|
-
*/
|
|
45
|
-
code: (text: string, language?: string) => string;
|
|
46
|
-
/**
|
|
47
|
-
* Inline code.
|
|
48
|
-
*/
|
|
49
|
-
inlineCode: (text: string) => string;
|
|
50
|
-
/**
|
|
51
|
-
* Line break.
|
|
52
|
-
*/
|
|
53
|
-
break: () => string;
|
|
54
|
-
/**
|
|
55
|
-
* Horizontal divider.
|
|
56
|
-
*/
|
|
57
|
-
divider: () => string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Options for {@link toConsole}.
|
|
61
|
-
*/
|
|
62
|
-
interface Options {
|
|
63
|
-
/**
|
|
64
|
-
* The rendering components to use for console output.
|
|
65
|
-
*/
|
|
66
|
-
adapter: RenderAdapter;
|
|
67
|
-
/**
|
|
68
|
-
* Post-process the generated output.
|
|
69
|
-
*/
|
|
70
|
-
postProcess?: (output: string) => string;
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
5
|
//#region src/adapter.d.ts
|
|
74
6
|
/**
|
|
75
7
|
* Default render adapter that converts markdown nodes into Shell Shock source code strings. This adapter can be customized by providing a different implementation of the `RenderAdapter` interface in the options when using the `outputPlugin`. Each method in the adapter corresponds to a specific markdown construct and defines how it should be rendered in the output string.
|
|
76
8
|
*/
|
|
77
9
|
declare const defaultRenderAdapter: RenderAdapter;
|
|
78
10
|
//#endregion
|
|
79
|
-
export { Options, RenderAdapter, defaultRenderAdapter,
|
|
11
|
+
export { Options, RenderAdapter, ResolvedOptions, defaultRenderAdapter, renderHtml, renderMarkdown };
|
|
80
12
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/adapter.ts"],"mappings":";;;;;;;;cAuBa,oBAAA,EAAsB,aAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,80 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { n as RenderAdapter, r as ResolvedOptions, t as Options } from "./types-C5cPWP5x.mjs";
|
|
2
|
+
import { renderHtml } from "./html/index.mjs";
|
|
3
|
+
import { renderMarkdown } from "./markdown/index.mjs";
|
|
3
4
|
|
|
4
|
-
//#region src/types.d.ts
|
|
5
|
-
interface RenderAdapter {
|
|
6
|
-
/**
|
|
7
|
-
* Heading text.
|
|
8
|
-
*/
|
|
9
|
-
heading: (text: string, level: number) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Body text.
|
|
12
|
-
*/
|
|
13
|
-
body: (text: string) => string;
|
|
14
|
-
/**
|
|
15
|
-
* Bold text.
|
|
16
|
-
*/
|
|
17
|
-
bold: (text: string) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Italic text.
|
|
20
|
-
*/
|
|
21
|
-
italic: (text: string) => string;
|
|
22
|
-
/**
|
|
23
|
-
* Strikethrough text.
|
|
24
|
-
*/
|
|
25
|
-
strikethrough: (text: string) => string;
|
|
26
|
-
/**
|
|
27
|
-
* Underlined text.
|
|
28
|
-
*/
|
|
29
|
-
underline: (text: string) => string;
|
|
30
|
-
/**
|
|
31
|
-
* Blockquote text.
|
|
32
|
-
*/
|
|
33
|
-
blockquote: (text: string) => string;
|
|
34
|
-
/**
|
|
35
|
-
* Link text.
|
|
36
|
-
*/
|
|
37
|
-
link: (url: string, text?: string) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Table.
|
|
40
|
-
*/
|
|
41
|
-
table: (cells: string[][]) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Code block.
|
|
44
|
-
*/
|
|
45
|
-
code: (text: string, language?: string) => string;
|
|
46
|
-
/**
|
|
47
|
-
* Inline code.
|
|
48
|
-
*/
|
|
49
|
-
inlineCode: (text: string) => string;
|
|
50
|
-
/**
|
|
51
|
-
* Line break.
|
|
52
|
-
*/
|
|
53
|
-
break: () => string;
|
|
54
|
-
/**
|
|
55
|
-
* Horizontal divider.
|
|
56
|
-
*/
|
|
57
|
-
divider: () => string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Options for {@link toConsole}.
|
|
61
|
-
*/
|
|
62
|
-
interface Options {
|
|
63
|
-
/**
|
|
64
|
-
* The rendering components to use for console output.
|
|
65
|
-
*/
|
|
66
|
-
adapter: RenderAdapter;
|
|
67
|
-
/**
|
|
68
|
-
* Post-process the generated output.
|
|
69
|
-
*/
|
|
70
|
-
postProcess?: (output: string) => string;
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
5
|
//#region src/adapter.d.ts
|
|
74
6
|
/**
|
|
75
7
|
* Default render adapter that converts markdown nodes into Shell Shock source code strings. This adapter can be customized by providing a different implementation of the `RenderAdapter` interface in the options when using the `outputPlugin`. Each method in the adapter corresponds to a specific markdown construct and defines how it should be rendered in the output string.
|
|
76
8
|
*/
|
|
77
9
|
declare const defaultRenderAdapter: RenderAdapter;
|
|
78
10
|
//#endregion
|
|
79
|
-
export { Options, RenderAdapter, defaultRenderAdapter,
|
|
11
|
+
export { Options, RenderAdapter, ResolvedOptions, defaultRenderAdapter, renderHtml, renderMarkdown };
|
|
80
12
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/adapter.ts"],"mappings":";;;;;;;;cAuBa,oBAAA,EAAsB,aAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e
|
|
1
|
+
import{t as e}from"./html-DzncQodH.mjs";import{t}from"./markdown-BiaU4FQg.mjs";const n={heading:(e,t=1)=>`bold(textColors.heading.${t===1?`primary`:t===2?`secondary`:`tertiary`}("${e}"))`,body:e=>`textColors.body.primary("${e}")`,bold:e=>`bold("${e}")`,italic:e=>`italic("${e}")`,strikethrough:e=>`strikethrough("${e}")`,underline:e=>`underline("${e}")`,blockquote:e=>`blockquote("${e}")`,link:(e,t)=>`link("${e}"${t?`, "${t}"`:``})`,table:e=>`table(${JSON.stringify(e)})`,code:(e,t)=>`code(${JSON.stringify(e)}${t?`, "${t}"`:``})`,inlineCode:e=>`inlineCode("${e}")`,break:()=>`writeLine("")`,divider:()=>`divider({ border: "primary" })`};export{n as defaultRenderAdapter,e as renderHtml,t as renderMarkdown};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/adapter.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { RenderAdapter } from \"./types\";\n\n/**\n * Default render adapter that converts markdown nodes into Shell Shock source code strings. This adapter can be customized by providing a different implementation of the `RenderAdapter` interface in the options when using the `outputPlugin`. Each method in the adapter corresponds to a specific markdown construct and defines how it should be rendered in the output string.\n */\nexport const defaultRenderAdapter: RenderAdapter = {\n /**\n * Heading text.\n */\n heading: (text: string, level = 1) =>\n `bold(textColors.heading.${\n level === 1 ? \"primary\" : level === 2 ? \"secondary\" : \"tertiary\"\n }(\"${text}\"))`,\n\n /**\n * Body text.\n */\n body: (text: string) => `textColors.body.primary(\"${text}\")`,\n\n /**\n * Bold text.\n */\n bold: (text: string) => `bold(\"${text}\")`,\n\n /**\n * Italic text.\n */\n italic: (text: string) => `italic(\"${text}\")`,\n\n /**\n * Strikethrough text.\n */\n strikethrough: (text: string) => `strikethrough(\"${text}\")`,\n\n /**\n * Underlined text.\n */\n underline: (text: string) => `underline(\"${text}\")`,\n\n /**\n * Blockquote text.\n */\n blockquote: (text: string) => `blockquote(\"${text}\")`,\n\n /**\n * Link text.\n */\n link: (url: string, text?: string) =>\n `link(\"${url}\"${text ? `, \"${text}\"` : \"\"})`,\n\n /**\n * Table.\n */\n table: (cells: string[][]) => `table(${JSON.stringify(cells)})`,\n\n /**\n * Code block.\n */\n code: (text: string, language?: string) =>\n `code(${JSON.stringify(text)}${language ? `, \"${language}\"` : \"\"})`,\n\n /**\n * Inline code.\n */\n inlineCode: (text: string) => `inlineCode(\"${text}\")`,\n\n /**\n * Line break.\n */\n break: () => 'writeLine(\"\")',\n\n /**\n * Horizontal divider.\n */\n divider: () => 'divider({ border: \"primary\" })'\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/adapter.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { RenderAdapter } from \"./types\";\n\n/**\n * Default render adapter that converts markdown nodes into Shell Shock source code strings. This adapter can be customized by providing a different implementation of the `RenderAdapter` interface in the options when using the `outputPlugin`. Each method in the adapter corresponds to a specific markdown construct and defines how it should be rendered in the output string.\n */\nexport const defaultRenderAdapter: RenderAdapter = {\n /**\n * Heading text.\n */\n heading: (text: string, level = 1) =>\n `bold(textColors.heading.${\n level === 1 ? \"primary\" : level === 2 ? \"secondary\" : \"tertiary\"\n }(\"${text}\"))`,\n\n /**\n * Body text.\n */\n body: (text: string) => `textColors.body.primary(\"${text}\")`,\n\n /**\n * Bold text.\n */\n bold: (text: string) => `bold(\"${text}\")`,\n\n /**\n * Italic text.\n */\n italic: (text: string) => `italic(\"${text}\")`,\n\n /**\n * Strikethrough text.\n */\n strikethrough: (text: string) => `strikethrough(\"${text}\")`,\n\n /**\n * Underlined text.\n */\n underline: (text: string) => `underline(\"${text}\")`,\n\n /**\n * Blockquote text.\n */\n blockquote: (text: string) => `blockquote(\"${text}\")`,\n\n /**\n * Link text.\n */\n link: (url: string, text?: string) =>\n `link(\"${url}\"${text ? `, \"${text}\"` : \"\"})`,\n\n /**\n * Table.\n */\n table: (cells: string[][]) => `table(${JSON.stringify(cells)})`,\n\n /**\n * Code block.\n */\n code: (text: string, language?: string) =>\n `code(${JSON.stringify(text)}${language ? `, \"${language}\"` : \"\"})`,\n\n /**\n * Inline code.\n */\n inlineCode: (text: string) => `inlineCode(\"${text}\")`,\n\n /**\n * Line break.\n */\n break: () => 'writeLine(\"\")',\n\n /**\n * Horizontal divider.\n */\n divider: () => 'divider({ border: \"primary\" })'\n};\n"],"mappings":"+EAuBA,MAAa,EAAsC,CAIjD,SAAU,EAAc,EAAQ,IAC9B,2BACE,IAAU,EAAI,UAAY,IAAU,EAAI,YAAc,WACvD,IAAI,EAAK,KAKZ,KAAO,GAAiB,4BAA4B,EAAK,IAKzD,KAAO,GAAiB,SAAS,EAAK,IAKtC,OAAS,GAAiB,WAAW,EAAK,IAK1C,cAAgB,GAAiB,kBAAkB,EAAK,IAKxD,UAAY,GAAiB,cAAc,EAAK,IAKhD,WAAa,GAAiB,eAAe,EAAK,IAKlD,MAAO,EAAa,IAClB,SAAS,EAAI,GAAG,EAAO,MAAM,EAAK,GAAK,GAAG,GAK5C,MAAQ,GAAsB,SAAS,KAAK,UAAU,EAAM,CAAC,GAK7D,MAAO,EAAc,IACnB,QAAQ,KAAK,UAAU,EAAK,GAAG,EAAW,MAAM,EAAS,GAAK,GAAG,GAKnE,WAAa,GAAiB,eAAe,EAAK,IAKlD,UAAa,gBAKb,YAAe,iCAChB"}
|
package/dist/markdown/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../markdown-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../markdown-DX-arJZe.cjs`);exports.renderMarkdown=e.t;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { t as Options } from "../types-C7nXIjAN.cjs";
|
|
2
|
+
|
|
1
3
|
//#region src/markdown/index.d.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Renders Markdown content as source code for displaying in the terminal.
|
|
6
|
+
*
|
|
7
|
+
* @param markdown - Markdown content
|
|
8
|
+
* @param options - Configuration options for rendering the markdown.
|
|
9
|
+
* @return A string of source code that can be executed to display the rendered markdown in the terminal.
|
|
10
|
+
*/
|
|
11
|
+
declare function renderMarkdown(markdown: string, options: Options): string;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { renderMarkdown };
|
|
4
14
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":";;;;;AA6BA;;;;;iBAAgB,cAAA,CAAe,QAAA,UAAkB,OAAA,EAAS,OAAA"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import { t as Options } from "../types-C5cPWP5x.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/markdown/index.d.ts
|
|
2
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Renders Markdown content as source code for displaying in the terminal.
|
|
6
|
+
*
|
|
7
|
+
* @param markdown - Markdown content
|
|
8
|
+
* @param options - Configuration options for rendering the markdown.
|
|
9
|
+
* @return A string of source code that can be executed to display the rendered markdown in the terminal.
|
|
10
|
+
*/
|
|
11
|
+
declare function renderMarkdown(markdown: string, options: Options): string;
|
|
3
12
|
//#endregion
|
|
4
|
-
export {
|
|
13
|
+
export { renderMarkdown };
|
|
5
14
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/markdown/index.ts"],"mappings":";;;;;AA6BA;;;;;iBAAgB,cAAA,CAAe,QAAA,UAAkB,OAAA,EAAS,OAAA"}
|
package/dist/markdown/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../markdown-
|
|
1
|
+
import{t as e}from"../markdown-BiaU4FQg.mjs";export{e as renderMarkdown};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{t as e}from"./html-DzncQodH.mjs";import{alert as t}from"@mdit/plugin-alert";import{upperCaseFirst as n}from"@stryke/string-format";import r from"markdown-it";import i from"markdown-it-abbr";import a from"markdown-it-container";import o from"markdown-it-deflist";import s from"markdown-it-footnote";import c from"markdown-it-ins";import l from"markdown-it-mark";import u from"markdown-it-sub";import d from"markdown-it-sup";import f from"markdown-it-task-lists";const p=()=>{let e=r({html:!0,langPrefix:`language-`,linkify:!0}).use(s).use(c).use(l).use(o).use(i).use(a).use(d).use(u).use(f).use(t,{deep:!1,openRender(e,t){let n=e[t],r=null;switch(n?.markup){case`important`:r=`red`;break;case`note`:r=`blue`;break;case`tip`:r=`green`;break;case`warning`:r=`yellow`;break;case`caution`:r=`magenta`;break;default:r=`blue`}return`<blockquote data-cli-color="${r}">`},closeRender(){return`</blockquote>`},titleRender(e,t){let r=e[t],i=null;switch(r?.markup){case`important`:i=`red`;break;case`note`:i=`blue`;break;case`tip`:i=`green`;break;case`warning`:i=`yellow`;break;case`caution`:i=`magenta`;break;default:i=`blue`}return`<p><span data-cli-color="${i}"><b>${n(r?.content||``)}
|
|
2
|
+
}</b></span></p>`}});return e.renderer.rules.footnote_anchor=()=>``,e},m=e=>p().render(e);function h(t,n){return e(m(t),n)}export{h as t};
|
|
3
|
+
//# sourceMappingURL=markdown-BiaU4FQg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-BiaU4FQg.mjs","names":[],"sources":["../src/markdown/markdown-to-html.ts","../src/markdown/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { alert } from \"@mdit/plugin-alert\";\nimport { upperCaseFirst } from \"@stryke/string-format\";\nimport markdownit from \"markdown-it\";\nimport markdownItAbbr from \"markdown-it-abbr\";\nimport markdownItContainer from \"markdown-it-container\";\nimport markdownItDeflist from \"markdown-it-deflist\";\nimport markdownItFootnote from \"markdown-it-footnote\";\nimport markdownItIns from \"markdown-it-ins\";\nimport markdownItMark from \"markdown-it-mark\";\nimport markdownItSub from \"markdown-it-sub\";\nimport markdownItSup from \"markdown-it-sup\";\nimport markdownItTaskList from \"markdown-it-task-lists\";\n\n/**\n * Create a configured markdown-it instance with GFM support\n */\nexport const createMarkdownRenderer = () => {\n const md = markdownit({\n html: true,\n langPrefix: \"language-\",\n linkify: true\n })\n .use(markdownItFootnote)\n .use(markdownItIns)\n .use(markdownItMark)\n .use(markdownItDeflist)\n .use(markdownItAbbr)\n .use(markdownItContainer)\n .use(markdownItSup)\n .use(markdownItSub)\n .use(markdownItTaskList)\n .use(alert, {\n deep: false,\n\n openRender(tokens, index) {\n const token = tokens[index];\n\n let color = null;\n\n // Map alert types to colors\n switch (token?.markup) {\n case \"important\": {\n color = \"red\";\n break;\n }\n case \"note\": {\n color = \"blue\";\n break;\n }\n case \"tip\": {\n color = \"green\";\n break;\n }\n case \"warning\": {\n color = \"yellow\";\n break;\n }\n case \"caution\": {\n color = \"magenta\";\n break;\n }\n default: {\n color = \"blue\";\n }\n }\n\n return `<blockquote data-cli-color=\"${color}\">`;\n },\n\n closeRender() {\n return \"</blockquote>\";\n },\n\n titleRender(tokens, index) {\n const token = tokens[index];\n\n let color = null;\n\n switch (token?.markup) {\n case \"important\": {\n color = \"red\";\n break;\n }\n case \"note\": {\n color = \"blue\";\n break;\n }\n case \"tip\": {\n color = \"green\";\n break;\n }\n case \"warning\": {\n color = \"yellow\";\n break;\n }\n case \"caution\": {\n color = \"magenta\";\n break;\n }\n default: {\n color = \"blue\";\n }\n }\n\n return `<p><span data-cli-color=\"${color}\"><b>${upperCaseFirst(token?.content || \"\")}\n }</b></span></p>`;\n }\n });\n\n // Remove footnote anchors\n md.renderer.rules.footnote_anchor = () => \"\";\n\n return md;\n};\n\n/**\n * Render markdown to HTML\n *\n * @param markdown - Markdown content\n * @returns HTML string\n */\nexport const markdownToHtml = (markdown: string): string => {\n const md = createMarkdownRenderer();\n\n return md.render(markdown);\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { renderHtml } from \"../html\";\nimport type { Options } from \"../types\";\nimport { markdownToHtml } from \"./markdown-to-html\";\n\n/**\n * Renders Markdown content as source code for displaying in the terminal.\n *\n * @param markdown - Markdown content\n * @param options - Configuration options for rendering the markdown.\n * @return A string of source code that can be executed to display the rendered markdown in the terminal.\n */\nexport function renderMarkdown(markdown: string, options: Options): string {\n return renderHtml(markdownToHtml(markdown), options);\n}\n"],"mappings":"odAkCA,MAAa,MAA+B,CAC1C,IAAM,EAAK,EAAW,CACpB,KAAM,GACN,WAAY,YACZ,QAAS,GACV,CAAC,CACC,IAAI,EAAmB,CACvB,IAAI,EAAc,CAClB,IAAI,EAAe,CACnB,IAAI,EAAkB,CACtB,IAAI,EAAe,CACnB,IAAI,EAAoB,CACxB,IAAI,EAAc,CAClB,IAAI,EAAc,CAClB,IAAI,EAAmB,CACvB,IAAI,EAAO,CACV,KAAM,GAEN,WAAW,EAAQ,EAAO,CACxB,IAAM,EAAQ,EAAO,GAEjB,EAAQ,KAGZ,OAAQ,GAAO,OAAf,CACE,IAAK,YACH,EAAQ,MACR,MAEF,IAAK,OACH,EAAQ,OACR,MAEF,IAAK,MACH,EAAQ,QACR,MAEF,IAAK,UACH,EAAQ,SACR,MAEF,IAAK,UACH,EAAQ,UACR,MAEF,QACE,EAAQ,OAIZ,MAAO,+BAA+B,EAAM,KAG9C,aAAc,CACZ,MAAO,iBAGT,YAAY,EAAQ,EAAO,CACzB,IAAM,EAAQ,EAAO,GAEjB,EAAQ,KAEZ,OAAQ,GAAO,OAAf,CACE,IAAK,YACH,EAAQ,MACR,MAEF,IAAK,OACH,EAAQ,OACR,MAEF,IAAK,MACH,EAAQ,QACR,MAEF,IAAK,UACH,EAAQ,SACR,MAEF,IAAK,UACH,EAAQ,UACR,MAEF,QACE,EAAQ,OAIZ,MAAO,4BAA4B,EAAM,OAAO,EAAe,GAAO,SAAW,GAAG,CAAC;2BAGxF,CAAC,CAKJ,MAFA,GAAG,SAAS,MAAM,oBAAwB,GAEnC,GASI,EAAkB,GAClB,GAAwB,CAEzB,OAAO,EAAS,CCjH5B,SAAgB,EAAe,EAAkB,EAA0B,CACzE,OAAO,EAAW,EAAe,EAAS,CAAE,EAAQ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require(`./html-BK9y-nf5.cjs`);let t=require(`@mdit/plugin-alert`),n=require(`@stryke/string-format`),r=require(`markdown-it`);r=e.n(r);let i=require(`markdown-it-abbr`);i=e.n(i);let a=require(`markdown-it-container`);a=e.n(a);let o=require(`markdown-it-deflist`);o=e.n(o);let s=require(`markdown-it-footnote`);s=e.n(s);let c=require(`markdown-it-ins`);c=e.n(c);let l=require(`markdown-it-mark`);l=e.n(l);let u=require(`markdown-it-sub`);u=e.n(u);let d=require(`markdown-it-sup`);d=e.n(d);let f=require(`markdown-it-task-lists`);f=e.n(f);const p=()=>{let e=(0,r.default)({html:!0,langPrefix:`language-`,linkify:!0}).use(s.default).use(c.default).use(l.default).use(o.default).use(i.default).use(a.default).use(d.default).use(u.default).use(f.default).use(t.alert,{deep:!1,openRender(e,t){let n=e[t],r=null;switch(n?.markup){case`important`:r=`red`;break;case`note`:r=`blue`;break;case`tip`:r=`green`;break;case`warning`:r=`yellow`;break;case`caution`:r=`magenta`;break;default:r=`blue`}return`<blockquote data-cli-color="${r}">`},closeRender(){return`</blockquote>`},titleRender(e,t){let r=e[t],i=null;switch(r?.markup){case`important`:i=`red`;break;case`note`:i=`blue`;break;case`tip`:i=`green`;break;case`warning`:i=`yellow`;break;case`caution`:i=`magenta`;break;default:i=`blue`}return`<p><span data-cli-color="${i}"><b>${(0,n.upperCaseFirst)(r?.content||``)}
|
|
2
|
+
}</b></span></p>`}});return e.renderer.rules.footnote_anchor=()=>``,e},m=e=>p().render(e);function h(t,n){return e.t(m(t),n)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PartialKeys } from "@stryke/types/base";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
interface RenderAdapter {
|
|
5
|
+
/**
|
|
6
|
+
* Heading text.
|
|
7
|
+
*/
|
|
8
|
+
heading: (text: string, level: number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Body text.
|
|
11
|
+
*/
|
|
12
|
+
body: (text: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Bold text.
|
|
15
|
+
*/
|
|
16
|
+
bold: (text: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Italic text.
|
|
19
|
+
*/
|
|
20
|
+
italic: (text: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Strikethrough text.
|
|
23
|
+
*/
|
|
24
|
+
strikethrough: (text: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Underlined text.
|
|
27
|
+
*/
|
|
28
|
+
underline: (text: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Blockquote text.
|
|
31
|
+
*/
|
|
32
|
+
blockquote: (text: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Link text.
|
|
35
|
+
*/
|
|
36
|
+
link: (url: string, text?: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Table.
|
|
39
|
+
*/
|
|
40
|
+
table: (cells: string[][]) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Code block.
|
|
43
|
+
*/
|
|
44
|
+
code: (text: string, language?: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Inline code.
|
|
47
|
+
*/
|
|
48
|
+
inlineCode: (text: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Line break.
|
|
51
|
+
*/
|
|
52
|
+
break: () => string;
|
|
53
|
+
/**
|
|
54
|
+
* Horizontal divider.
|
|
55
|
+
*/
|
|
56
|
+
divider: () => string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for {@link toConsole}.
|
|
60
|
+
*/
|
|
61
|
+
interface Options {
|
|
62
|
+
/**
|
|
63
|
+
* The rendering components to use for console output.
|
|
64
|
+
*/
|
|
65
|
+
adapter: RenderAdapter;
|
|
66
|
+
/**
|
|
67
|
+
* Whether to wrap lines at a certain width.
|
|
68
|
+
*/
|
|
69
|
+
pre?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The maximum line width for wrapping text. Defaults to the terminal width minus 2, with a maximum of 120 characters.
|
|
72
|
+
*/
|
|
73
|
+
lineWidth?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to include font attributes (e.g., bold, italic) in the output. If false, all text will be rendered without font attributes. Defaults to true.
|
|
76
|
+
*/
|
|
77
|
+
fontAttrs?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The depth of the current rendering context, used for managing nested elements and indentation levels. Defaults to 0.
|
|
80
|
+
*/
|
|
81
|
+
depth?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to use ASCII characters for rendering elements such as borders and dividers, instead of Unicode characters. Defaults to false.
|
|
84
|
+
*/
|
|
85
|
+
asciiMode?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Post-process the generated output.
|
|
88
|
+
*/
|
|
89
|
+
postProcess?: (output: string) => string;
|
|
90
|
+
}
|
|
91
|
+
type ResolvedOptions = PartialKeys<Required<Options>, "postProcess">;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { RenderAdapter as n, ResolvedOptions as r, Options as t };
|
|
94
|
+
//# sourceMappingURL=types-C5cPWP5x.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-C5cPWP5x.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;UAoBiB,aAAA;;AAAjB;;EAIE,OAAA,GAAU,IAAA,UAAc,KAAA;EAJI;;;EAS5B,IAAA,GAAO,IAAA;EAAP;;;EAKA,IAAA,GAAO,IAAA;EAKP;;;EAAA,MAAA,GAAS,IAAA;EAUT;;;EALA,aAAA,GAAgB,IAAA;EAehB;;;EAVA,SAAA,GAAY,IAAA;EAeJ;;;EAVR,UAAA,GAAa,IAAA;EAoBb;;;EAfA,IAAA,GAAO,GAAA,UAAa,IAAA;EAyBb;;AAMT;EA1BE,KAAA,GAAQ,KAAA;;;;EAKR,IAAA,GAAO,IAAA,UAAc,QAAA;EA8BrB;;;EAzBA,UAAA,GAAa,IAAA;EA6Cb;;;EAxCA,KAAA;EA6C6B;AAG/B;;EA3CE,OAAA;AAAA;;;;UAMe,OAAA;EAqCa;;;EAjC5B,OAAA,EAAS,aAAA;EAiC+C;;;EA5BxD,GAAA;;;;EAKA,SAAA;;;;EAKA,SAAA;;;;EAKA,KAAA;;;;EAKA,SAAA;;;;EAKA,WAAA,IAAe,MAAA;AAAA;AAAA,KAGL,eAAA,GAAkB,WAAA,CAAY,QAAA,CAAS,OAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PartialKeys } from "@stryke/types/base";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
interface RenderAdapter {
|
|
5
|
+
/**
|
|
6
|
+
* Heading text.
|
|
7
|
+
*/
|
|
8
|
+
heading: (text: string, level: number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Body text.
|
|
11
|
+
*/
|
|
12
|
+
body: (text: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Bold text.
|
|
15
|
+
*/
|
|
16
|
+
bold: (text: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Italic text.
|
|
19
|
+
*/
|
|
20
|
+
italic: (text: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Strikethrough text.
|
|
23
|
+
*/
|
|
24
|
+
strikethrough: (text: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Underlined text.
|
|
27
|
+
*/
|
|
28
|
+
underline: (text: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Blockquote text.
|
|
31
|
+
*/
|
|
32
|
+
blockquote: (text: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Link text.
|
|
35
|
+
*/
|
|
36
|
+
link: (url: string, text?: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Table.
|
|
39
|
+
*/
|
|
40
|
+
table: (cells: string[][]) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Code block.
|
|
43
|
+
*/
|
|
44
|
+
code: (text: string, language?: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Inline code.
|
|
47
|
+
*/
|
|
48
|
+
inlineCode: (text: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Line break.
|
|
51
|
+
*/
|
|
52
|
+
break: () => string;
|
|
53
|
+
/**
|
|
54
|
+
* Horizontal divider.
|
|
55
|
+
*/
|
|
56
|
+
divider: () => string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for {@link toConsole}.
|
|
60
|
+
*/
|
|
61
|
+
interface Options {
|
|
62
|
+
/**
|
|
63
|
+
* The rendering components to use for console output.
|
|
64
|
+
*/
|
|
65
|
+
adapter: RenderAdapter;
|
|
66
|
+
/**
|
|
67
|
+
* Whether to wrap lines at a certain width.
|
|
68
|
+
*/
|
|
69
|
+
pre?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The maximum line width for wrapping text. Defaults to the terminal width minus 2, with a maximum of 120 characters.
|
|
72
|
+
*/
|
|
73
|
+
lineWidth?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to include font attributes (e.g., bold, italic) in the output. If false, all text will be rendered without font attributes. Defaults to true.
|
|
76
|
+
*/
|
|
77
|
+
fontAttrs?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The depth of the current rendering context, used for managing nested elements and indentation levels. Defaults to 0.
|
|
80
|
+
*/
|
|
81
|
+
depth?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to use ASCII characters for rendering elements such as borders and dividers, instead of Unicode characters. Defaults to false.
|
|
84
|
+
*/
|
|
85
|
+
asciiMode?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Post-process the generated output.
|
|
88
|
+
*/
|
|
89
|
+
postProcess?: (output: string) => string;
|
|
90
|
+
}
|
|
91
|
+
type ResolvedOptions = PartialKeys<Required<Options>, "postProcess">;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { RenderAdapter as n, ResolvedOptions as r, Options as t };
|
|
94
|
+
//# sourceMappingURL=types-C7nXIjAN.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-C7nXIjAN.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;UAoBiB,aAAA;;AAAjB;;EAIE,OAAA,GAAU,IAAA,UAAc,KAAA;EAJI;;;EAS5B,IAAA,GAAO,IAAA;EAAP;;;EAKA,IAAA,GAAO,IAAA;EAKP;;;EAAA,MAAA,GAAS,IAAA;EAUT;;;EALA,aAAA,GAAgB,IAAA;EAehB;;;EAVA,SAAA,GAAY,IAAA;EAeJ;;;EAVR,UAAA,GAAa,IAAA;EAoBb;;;EAfA,IAAA,GAAO,GAAA,UAAa,IAAA;EAyBb;;AAMT;EA1BE,KAAA,GAAQ,KAAA;;;;EAKR,IAAA,GAAO,IAAA,UAAc,QAAA;EA8BrB;;;EAzBA,UAAA,GAAa,IAAA;EA6Cb;;;EAxCA,KAAA;EA6C6B;AAG/B;;EA3CE,OAAA;AAAA;;;;UAMe,OAAA;EAqCa;;;EAjC5B,OAAA,EAAS,aAAA;EAiC+C;;;EA5BxD,GAAA;;;;EAKA,SAAA;;;;EAKA,SAAA;;;;EAKA,KAAA;;;;EAKA,SAAA;;;;EAKA,WAAA,IAAe,MAAA;AAAA;AAAA,KAGL,eAAA,GAAkB,WAAA,CAAY,QAAA,CAAS,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/unified",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to generate unified built-in modules that display information about the application.",
|
|
6
6
|
"keywords": ["unified", "shell-shock", "powerlines", "storm-software"],
|
|
@@ -90,17 +90,35 @@
|
|
|
90
90
|
"typings": "dist/index.d.mts",
|
|
91
91
|
"files": ["dist/**/*"],
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@
|
|
93
|
+
"@mdit/plugin-alert": "^0.23.2",
|
|
94
|
+
"@shell-shock/core": "^0.17.1",
|
|
94
95
|
"@stryke/path": "^0.27.4",
|
|
96
|
+
"@stryke/string-format": "^0.17.9",
|
|
95
97
|
"@stryke/type-checks": "^0.6.1",
|
|
98
|
+
"@stryke/types": "^0.11.3",
|
|
99
|
+
"chalk-string": "^4.0.0",
|
|
96
100
|
"defu": "^6.1.7",
|
|
101
|
+
"he": "^1.2.0",
|
|
102
|
+
"markdown-it": "^14.1.1",
|
|
103
|
+
"markdown-it-abbr": "^2.0.0",
|
|
104
|
+
"markdown-it-container": "^4.0.0",
|
|
105
|
+
"markdown-it-deflist": "^3.0.0",
|
|
106
|
+
"markdown-it-footnote": "^4.0.0",
|
|
107
|
+
"markdown-it-ins": "^4.0.0",
|
|
108
|
+
"markdown-it-mark": "^4.0.0",
|
|
109
|
+
"markdown-it-sub": "^2.0.0",
|
|
110
|
+
"markdown-it-sup": "^2.0.0",
|
|
111
|
+
"markdown-it-task-lists": "^2.1.1",
|
|
112
|
+
"normalize-html-whitespace": "^1.0.0",
|
|
97
113
|
"parse5": "^8.0.0",
|
|
98
|
-
"powerlines": "^0.42.33"
|
|
114
|
+
"powerlines": "^0.42.33",
|
|
115
|
+
"terminal-size": "^4.0.1",
|
|
116
|
+
"wrap-ansi": "^10.0.0"
|
|
99
117
|
},
|
|
100
118
|
"devDependencies": {
|
|
101
119
|
"@powerlines/plugin-tsdown": "^0.1.334",
|
|
102
120
|
"@types/node": "^25.5.2"
|
|
103
121
|
},
|
|
104
122
|
"publishConfig": { "access": "public" },
|
|
105
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "0a96451134431381e1d79f85dceaaafd5cf94cfe"
|
|
106
124
|
}
|
package/dist/html/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/html/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parse } from \"parse5\";\n\n/**\n * Renders HTML content as source code for displaying in the terminal.\n *\n * @param input - The HTML string to render.\n * @returns A string of source code that can be executed to display the rendered HTML in the terminal.\n */\nconst html = (input: string) => {\n const document = parse(input);\n\n return `${document.nodeName}\\n`;\n};\n\nexport default html;\n"],"mappings":"+BA0BA,MAAM,EAAQ,GAGL,GAFU,EAAM,EAAM,CAEV,SAAS"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-Bs-BRrSC.mjs","names":[],"sources":["../src/helpers.ts","../src/markdown/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport function escapeText(text: string) {\n return text\n .replaceAll(\"`\", \"\\\\`\")\n .replaceAll(\"${\", \"\\\\${\")\n .replaceAll(\"\\\\\", \"\\\\\\\\\")\n .replaceAll(\"\\n\", \"\\\\n\")\n .replaceAll(\"\\r\", \"\\\\r\")\n .replaceAll(\"\\t\", \"\\\\t\");\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { escapeText } from \"../helpers\";\n\nconst markdown = (text: string) => {\n return `textColors.heading.primary(\\`${escapeText(text)}\\`)`;\n};\n\nexport default markdown;\n"],"mappings":"AAkBA,SAAgB,EAAW,EAAc,CACvC,OAAO,EACJ,WAAW,IAAK,MAAM,CACtB,WAAW,KAAM,OAAO,CACxB,WAAW,KAAM,OAAO,CACxB,WAAW;EAAM,MAAM,CACvB,WAAW,KAAM,MAAM,CACvB,WAAW,IAAM,MAAM,CCL5B,MAAM,EAAY,GACT,gCAAgC,EAAW,EAAK,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e){return e.replaceAll("`","\\`").replaceAll("${","\\${").replaceAll(`\\`,`\\\\`).replaceAll(`
|
|
2
|
-
`,`\\n`).replaceAll(`\r`,`\\r`).replaceAll(` `,`\\t`)}const t=t=>`textColors.heading.primary(\`${e(t)}\`)`;Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|