import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{n as t,r as n,t as r}from"./vendor-markdown-Cola12Wc.js";var i=[`video`,`source`],a=[`controls`,`autoplay`,`loop`,`muted`,`preload`,`poster`],o=/(<(?:img|source|video)[^>]*\ssrc=['"])(?!(?:\/|https?:\/\/))([^'"\s>]+)(['"])/gi;function createMarkdownRenderer(e){let t=e?e.replace(/\/+$/,``):``,n=new r;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,r){if(!e)return``;let s=t.parse(e,{renderer:createMarkdownRenderer(r),gfm:!0});return r&&(s=s.replace(o,`$1${r}$2$3`)),n.sanitize(s,{ADD_TAGS:i,ADD_ATTR:[...a,`target`,`rel`]})}export{renderMarkdownToHtml as t};
//# sourceMappingURL=markdownRendererUtil-Bm7Umh6C.js.map