import { createMarkdownProcessor } from '@astrojs/markdown-remark' import { shared } from './shared.js' import { HTMLString } from './html-string.js' export async function markdown( /** @type {string} */ content, /** @type {MarkdownRenderingOptions} */ options = null ) { const processor = await createMarkdownProcessor({ ...shared.markdownConfig, ...Object(options), }); const result = await processor.render(content); return new HTMLString(result.code); } markdown.inline = async function inlinemarkdown( /** @type {string} */ content, /** @type {MarkdownRenderingOptions} */ options = null ) { const processor = await createMarkdownProcessor({ ...shared.markdownConfig, ...Object(options), }); const result = await processor.render(content); return new HTMLString( result.code.indexOf("

") === 0 && result.code.indexOf("

") === result.code.length - 4 ? result.code.slice(3, -4) : result.code, ); }; /** @typedef {import('./markdown').MarkdownRenderingOptions} MarkdownRenderingOptions */