Skip to content

Commit ccad5b8

Browse files
authored
Merge pull request #554 from processing/fix/escaping
Fix escaping in code blocks
2 parents b1f7199 + 6d81dc9 commit ccad5b8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/pages/_utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ export const escapeCodeTagsContent = (htmlString: string): string => {
233233
const $ = load(htmlString);
234234
// Loop through all <code> tags
235235
$("code").each(function () {
236+
// Don't escape code in multiline blocks, as these will already
237+
// be escaped
238+
if ($(this).parent().prop('tagName') === 'PRE') return;
239+
236240
// Get the current text and HTML inside the <code> tag
237241
const currentHtml = $(this).html() ?? "";
238242
// Use he to escape HTML entities

0 commit comments

Comments
 (0)