Fix markdown code block styling (#198351)

Fixes #198183

Remove extra background and also removes the extra divs inside of the code blocks as these were causing issues with styling (extra padding)
This commit is contained in:
Matt Bierner
2023-11-15 12:03:04 -08:00
committed by GitHub
parent 65b8f67d91
commit 8943ea4790
2 changed files with 4 additions and 3 deletions

View File

@@ -398,15 +398,14 @@ async function getMarkdownOptions(md: () => MarkdownIt): Promise<MarkdownIt.Opti
lang = normalizeHighlightLang(lang);
if (lang && hljs.getLanguage(lang)) {
try {
const highlighted = hljs.highlight(str, {
return hljs.highlight(str, {
language: lang,
ignoreIllegals: true,
}).value;
return `<div>${highlighted}</div>`;
}
catch (error) { }
}
return `<code><div>${md().utils.escapeHtml(str)}</div></code>`;
return md().utils.escapeHtml(str);
}
};
}