// Stands in for codemirror-json-schema's utils/markdown, which brings
// markdown-it and shiki (about 400 KB) to format schema descriptions. Ours
// only use `code` spans: escape the text and keep those. esbuild.mjs swaps
// this file in.
const escape = (s: string) => s.replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c]!);
export function renderMarkdown(markdown: string, inline = true): string {
const html = escape(String(markdown)).replace(/`([^`]+)`/g, '$1');
return inline ? html : `
${html.replace(/\n{2,}/g, '
')}
`; }