loghub-me-markdown-renderer 0.1.1 → 0.1.2

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/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var w=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var a in t)l(e,a,{get:t[a],enumerable:!0})},f=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of L(t))!T.call(e,s)&&s!==a&&l(e,s,{get:()=>t[s],enumerable:!(i=x(t,s))||i.enumerable});return e};var n=(e,t,a)=>(a=e!=null?w(O(e)):{},f(t||!e||!e.__esModule?l(a,"default",{value:e,enumerable:!0}):a,e)),S=e=>f(l({},"__esModule",{value:!0}),e);var M={};I(M,{MarkdownRenderer:()=>h});module.exports=S(M);var c=n(require("highlight.js")),k=n(require("markdown-it")),b=n(require("markdown-it-anchor"));function m(e){let t=e.attrGet("href");if(t){let a=`/safe-link?url=${t}`;e.attrSet("href",a),e.attrSet("target","_blank")}}var u=n(require("sanitize-html")),v=["a","aside","blockquote","br","circle","code","details","div","em","embed-katex","eq","eqn","h1","h2","h3","h4","h5","h6","hr","iframe","img","input","li","ol","p","pre","s","section","span","strong","summary","sup","table","tbody","td","text","th","thead","tr","ul"],z={a:["aria-hidden","class","href","id","rel","style","target","title"],aside:["class"],blockquote:["class","data-line"],br:["style"],circle:["cx","cy","fill","r"],code:["class","data-line"],details:[],div:["class"],em:[],"embed-katex":["display-mode"],eq:["class"],eqn:[],h1:["id","class","data-line"],h2:["id","class","data-line"],h3:["id","class","data-line"],h4:["id","class","data-line"],h5:["class","data-line"],h6:["class","data-line"],hr:["class","data-line"],iframe:["allow","allowfullscreen","allowtransparency","data-content","frameborder","id","loading","sandbox","scrolling","src","style","width"],img:["alt","class","height","loading","src","title","width"],input:["checked","class","type"],li:["class","id","data-line"],ol:["class","start","data-line"],p:["class","data-line"],pre:["class"],s:[],section:["class","data-line"],span:["class","title"],strong:[],summary:[],sup:["class"],table:["class","data-line"],tbody:["class","data-line"],td:["style"],text:["dominant-baseline","fill","font-size","font-weight","text-anchor","x","y"],th:["style"],thead:["class","data-line"],tr:["class","data-line"],ul:["class","data-line"]},g=e=>(0,u.default)(e,{allowedTags:v,allowedAttributes:z,disallowedTagsMode:"discard",selfClosing:["img","br","hr","area","base","basefont","input","link","meta"]});var y=e=>encodeURIComponent(e.toLowerCase().replace(/%20/g,"-").replace(/[^가-힣ㄱ-ㅎㅏ-ㅣa-z0-9-_]/g,"-").replace(/--+/g,"-").replace(/^-|-$/g,""));var r=class r{constructor(t={}){if(this.options={...r.DEFAULT_OPTIONS,...t},this.client=new k.default(this.options),this.options.useMarkdownItAnchor&&this.client.use(b.default,{slugify:y}),this.options.useSafeLinkify){let a=this.client.renderer.rules.link_open??((i,s,o,p,d)=>d.renderToken(i,s,o));this.client.renderer.rules.link_open=(i,s,o,p,d)=>(m(i[s]),a(i,s,o,p,d))}}render(t){let a=this.client.render(t);return this.options.useSanitize?g(a):a}};r.DEFAULT_OPTIONS={html:!1,xhtmlOut:!1,langPrefix:"language-",linkify:!0,typographer:!1,highlight:(t,a)=>{if(a&&c.default.getLanguage(a))try{return c.default.highlight(t,{language:a}).value}catch{}return""},useMarkdownItAnchor:!0,useSafeLinkify:!0,useSanitize:!0};var h=r;0&&(module.exports={MarkdownRenderer});
1
+ "use strict";var w=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var a in t)l(e,a,{get:t[a],enumerable:!0})},u=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of L(t))!T.call(e,i)&&i!==a&&l(e,i,{get:()=>t[i],enumerable:!(s=x(t,i))||s.enumerable});return e};var r=(e,t,a)=>(a=e!=null?w(O(e)):{},u(t||!e||!e.__esModule?l(a,"default",{value:e,enumerable:!0}):a,e)),I=e=>u(l({},"__esModule",{value:!0}),e);var A={};v(A,{MarkdownRenderer:()=>h});module.exports=I(A);var n=r(require("highlight.js")),k=r(require("markdown-it")),b=r(require("markdown-it-anchor"));function f(e){let t=e.attrGet("href");if(t){let a=`/safe-link?url=${t}`;e.attrSet("href",a),e.attrSet("target","_blank")}}var g=r(require("sanitize-html")),S=["a","aside","blockquote","br","circle","code","details","div","em","embed-katex","eq","eqn","h1","h2","h3","h4","h5","h6","hr","iframe","img","input","li","ol","p","pre","s","section","span","strong","summary","sup","table","tbody","td","text","th","thead","tr","ul"],z={a:["aria-hidden","class","href","id","rel","style","target","title"],aside:["class"],blockquote:["class","data-line"],br:["style"],circle:["cx","cy","fill","r"],code:["class","data-line"],details:[],div:["class"],em:[],"embed-katex":["display-mode"],eq:["class"],eqn:[],h1:["id","class","data-line"],h2:["id","class","data-line"],h3:["id","class","data-line"],h4:["id","class","data-line"],h5:["class","data-line"],h6:["class","data-line"],hr:["class","data-line"],iframe:["allow","allowfullscreen","allowtransparency","data-content","frameborder","id","loading","sandbox","scrolling","src","style","width"],img:["alt","class","height","loading","src","title","width"],input:["checked","class","type"],li:["class","id","data-line"],ol:["class","start","data-line"],p:["class","data-line"],pre:["class"],s:[],section:["class","data-line"],span:["class","title"],strong:[],summary:[],sup:["class"],table:["class","data-line"],tbody:["class","data-line"],td:["style"],text:["dominant-baseline","fill","font-size","font-weight","text-anchor","x","y"],th:["style"],thead:["class","data-line"],tr:["class","data-line"],ul:["class","data-line"]},m=e=>(0,g.default)(e,{allowedTags:S,allowedAttributes:z,disallowedTagsMode:"discard",selfClosing:["img","br","hr","area","base","basefont","input","link","meta"]});var y=e=>encodeURIComponent(e.toLowerCase().replace(/%20/g,"-").replace(/[^가-힣ㄱ-ㅎㅏ-ㅣa-z0-9-_]/g,"-").replace(/--+/g,"-").replace(/^-|-$/g,""));var o=class o{constructor(t={}){if(this.options={...o.DEFAULT_OPTIONS,...t},this.client=new k.default(this.options),this.options.useMarkdownItAnchor&&this.client.use(b.default,{slugify:y}),this.options.useSafeLinkify){let a=this.client.renderer.rules.link_open??((s,i,d,p,c)=>c.renderToken(s,i,d));this.client.renderer.rules.link_open=(s,i,d,p,c)=>(f(s[i]),a(s,i,d,p,c))}}render(t){let a=this.client.render(t);return this.options.useSanitize?m(a):a}};o.DEFAULT_OPTIONS={html:!1,xhtmlOut:!1,langPrefix:"language-",linkify:!0,typographer:!1,highlight:(t,a)=>{try{return a&&n.default.getLanguage(a)?n.default.highlight(t,{language:a}).value:n.default.highlightAuto(t).value}catch{return""}},useMarkdownItAnchor:!0,useSafeLinkify:!0,useSanitize:!0};var h=o;0&&(module.exports={MarkdownRenderer});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import p from"highlight.js";import y from"markdown-it";import k from"markdown-it-anchor";function d(a){let t=a.attrGet("href");if(t){let e=`/safe-link?url=${t}`;a.attrSet("href",e),a.attrSet("target","_blank")}}import m from"sanitize-html";var u=["a","aside","blockquote","br","circle","code","details","div","em","embed-katex","eq","eqn","h1","h2","h3","h4","h5","h6","hr","iframe","img","input","li","ol","p","pre","s","section","span","strong","summary","sup","table","tbody","td","text","th","thead","tr","ul"],g={a:["aria-hidden","class","href","id","rel","style","target","title"],aside:["class"],blockquote:["class","data-line"],br:["style"],circle:["cx","cy","fill","r"],code:["class","data-line"],details:[],div:["class"],em:[],"embed-katex":["display-mode"],eq:["class"],eqn:[],h1:["id","class","data-line"],h2:["id","class","data-line"],h3:["id","class","data-line"],h4:["id","class","data-line"],h5:["class","data-line"],h6:["class","data-line"],hr:["class","data-line"],iframe:["allow","allowfullscreen","allowtransparency","data-content","frameborder","id","loading","sandbox","scrolling","src","style","width"],img:["alt","class","height","loading","src","title","width"],input:["checked","class","type"],li:["class","id","data-line"],ol:["class","start","data-line"],p:["class","data-line"],pre:["class"],s:[],section:["class","data-line"],span:["class","title"],strong:[],summary:[],sup:["class"],table:["class","data-line"],tbody:["class","data-line"],td:["style"],text:["dominant-baseline","fill","font-size","font-weight","text-anchor","x","y"],th:["style"],thead:["class","data-line"],tr:["class","data-line"],ul:["class","data-line"]},c=a=>m(a,{allowedTags:u,allowedAttributes:g,disallowedTagsMode:"discard",selfClosing:["img","br","hr","area","base","basefont","input","link","meta"]});var h=a=>encodeURIComponent(a.toLowerCase().replace(/%20/g,"-").replace(/[^가-힣ㄱ-ㅎㅏ-ㅣa-z0-9-_]/g,"-").replace(/--+/g,"-").replace(/^-|-$/g,""));var l=class l{constructor(t={}){if(this.options={...l.DEFAULT_OPTIONS,...t},this.client=new y(this.options),this.options.useMarkdownItAnchor&&this.client.use(k,{slugify:h}),this.options.useSafeLinkify){let e=this.client.renderer.rules.link_open??((s,i,n,o,r)=>r.renderToken(s,i,n));this.client.renderer.rules.link_open=(s,i,n,o,r)=>(d(s[i]),e(s,i,n,o,r))}}render(t){let e=this.client.render(t);return this.options.useSanitize?c(e):e}};l.DEFAULT_OPTIONS={html:!1,xhtmlOut:!1,langPrefix:"language-",linkify:!0,typographer:!1,highlight:(t,e)=>{if(e&&p.getLanguage(e))try{return p.highlight(t,{language:e}).value}catch{}return""},useMarkdownItAnchor:!0,useSafeLinkify:!0,useSanitize:!0};var f=l;export{f as MarkdownRenderer};
1
+ import o from"highlight.js";import y from"markdown-it";import k from"markdown-it-anchor";function c(a){let t=a.attrGet("href");if(t){let e=`/safe-link?url=${t}`;a.attrSet("href",e),a.attrSet("target","_blank")}}import f from"sanitize-html";var g=["a","aside","blockquote","br","circle","code","details","div","em","embed-katex","eq","eqn","h1","h2","h3","h4","h5","h6","hr","iframe","img","input","li","ol","p","pre","s","section","span","strong","summary","sup","table","tbody","td","text","th","thead","tr","ul"],m={a:["aria-hidden","class","href","id","rel","style","target","title"],aside:["class"],blockquote:["class","data-line"],br:["style"],circle:["cx","cy","fill","r"],code:["class","data-line"],details:[],div:["class"],em:[],"embed-katex":["display-mode"],eq:["class"],eqn:[],h1:["id","class","data-line"],h2:["id","class","data-line"],h3:["id","class","data-line"],h4:["id","class","data-line"],h5:["class","data-line"],h6:["class","data-line"],hr:["class","data-line"],iframe:["allow","allowfullscreen","allowtransparency","data-content","frameborder","id","loading","sandbox","scrolling","src","style","width"],img:["alt","class","height","loading","src","title","width"],input:["checked","class","type"],li:["class","id","data-line"],ol:["class","start","data-line"],p:["class","data-line"],pre:["class"],s:[],section:["class","data-line"],span:["class","title"],strong:[],summary:[],sup:["class"],table:["class","data-line"],tbody:["class","data-line"],td:["style"],text:["dominant-baseline","fill","font-size","font-weight","text-anchor","x","y"],th:["style"],thead:["class","data-line"],tr:["class","data-line"],ul:["class","data-line"]},h=a=>f(a,{allowedTags:g,allowedAttributes:m,disallowedTagsMode:"discard",selfClosing:["img","br","hr","area","base","basefont","input","link","meta"]});var p=a=>encodeURIComponent(a.toLowerCase().replace(/%20/g,"-").replace(/[^가-힣ㄱ-ㅎㅏ-ㅣa-z0-9-_]/g,"-").replace(/--+/g,"-").replace(/^-|-$/g,""));var l=class l{constructor(t={}){if(this.options={...l.DEFAULT_OPTIONS,...t},this.client=new y(this.options),this.options.useMarkdownItAnchor&&this.client.use(k,{slugify:p}),this.options.useSafeLinkify){let e=this.client.renderer.rules.link_open??((i,s,r,d,n)=>n.renderToken(i,s,r));this.client.renderer.rules.link_open=(i,s,r,d,n)=>(c(i[s]),e(i,s,r,d,n))}}render(t){let e=this.client.render(t);return this.options.useSanitize?h(e):e}};l.DEFAULT_OPTIONS={html:!1,xhtmlOut:!1,langPrefix:"language-",linkify:!0,typographer:!1,highlight:(t,e)=>{try{return e&&o.getLanguage(e)?o.highlight(t,{language:e}).value:o.highlightAuto(t).value}catch{return""}},useMarkdownItAnchor:!0,useSafeLinkify:!0,useSanitize:!0};var u=l;export{u as MarkdownRenderer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loghub-me-markdown-renderer",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A markdown renderer for LogHub",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -26,7 +26,7 @@
26
26
  "@types/node": "^24.3.1",
27
27
  "@types/sanitize-html": "^2.16.0",
28
28
  "prettier": "^3.6.2",
29
- "tsup": "^8.5.0",
29
+ "tsup": "^8.5.1",
30
30
  "tsx": "^4.20.5",
31
31
  "typescript": "^5.8.3"
32
32
  },