diff --git a/src/pages/_utils.ts b/src/pages/_utils.ts index b5660cbd5b..2ae7261c70 100644 --- a/src/pages/_utils.ts +++ b/src/pages/_utils.ts @@ -233,6 +233,10 @@ export const escapeCodeTagsContent = (htmlString: string): string => { const $ = load(htmlString); // Loop through all tags $("code").each(function () { + // Don't escape code in multiline blocks, as these will already + // be escaped + if ($(this).parent().prop('tagName') === 'PRE') return; + // Get the current text and HTML inside the tag const currentHtml = $(this).html() ?? ""; // Use he to escape HTML entities