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