import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{D as n,E as r,O as i,T as a,k as o}from"./vendor-other-BnH5nyVX.js";function createMarkdownRenderer(e){let t=e?e.replace(/\/+$/,``):``,n=new a;return n.image=({href:e,title:n,text:r})=>{let i=e;t&&!/^(?:\/|https?:\/\/)/.test(e)&&(i=`${t}/${e}`);let a=n?` title="${n}"`:``;return`<img src="${i}" alt="${r}"${a} />`},n.link=({href:e,title:t,tokens:r,text:i})=>{let a=r?n.parser.parseInline(r):i;return`<a href="${e}" ${t?` title="${t}"`:``} target="_blank" rel="noopener noreferrer">${a}</a>`},n}function renderMarkdownToHtml(e,t){if(!e)return``;let r=n.parse(e,{renderer:createMarkdownRenderer(t),gfm:!0});return t&&(r=r.replace(l,`$1${t}$2$3`)),o.sanitize(r,{ADD_TAGS:s,ADD_ATTR:[...c,`target`,`rel`]})}var s,c,l,u=t((()=>{i(),r(),s=[`video`,`source`],c=[`controls`,`autoplay`,`loop`,`muted`,`preload`,`poster`],l=/(<(?:img|source|video)[^>]*\ssrc=['"])(?!(?:\/|https?:\/\/))([^'"\s>]+)(['"])/gi}));export{renderMarkdownToHtml as n,u as t};
//# sourceMappingURL=markdownRendererUtil-DUxQXDfQ.js.map