$1");
// 5.5) Links
html = html.replace(/\[([^\]]+?)\]\(([^)]+?)\)/g, '$1 $2');
// 6) Restore code blocks with title bar (language)
html = html.replace(/@@CODEBLOCK(\d+)@@/g, (_, idx) => {
const { lang, code } = codeblocks[+idx];
const title = (lang && lang.trim()) ? lang.trim() : 'code';
const escapedCode = code.replace(//g, ">");
const head = `${escapedCode}`;
return ``;
});
// 7) Convert line-breaks to