async function parseMarkdown(md) { const { default: marked } = await import('https://cdn.skypack.dev/marked@14.1.2'); marked.use({ breaks: true, gfm: true, async tokenize(src) { const tokens = marked.lexer(src); for (const token of tokens) { if (token.type === 'list') { token.ordered = token.ordered || false; token.loose = !!token.items.find(item => item.text.includes('\n')); } } return tokens; }, renderer: { heading(text, level) { return `${text}`; }, strong(text) { return `${text}`; }, em(text) { return `${text}`; }, codespan(text) { return `${text}`; }, link(href, title, text) { return `${text}`; }, code(code, infostring) { const lang = (infostring || '').match(/^([a-z0-9]+)/i); return `
${code}
`; }, list(body, ordered) { const type = ordered ? 'ol' : 'ul'; return `<${type}>${body}`; }, blockquote(quote) { return `
${quote}
`; } } }); return marked.parse(md); } export default parseMarkdown;