Skip to content

Commit

Permalink
Merge pull request #554 from processing/fix/escaping
Browse files Browse the repository at this point in the history
Fix escaping in code blocks
  • Loading branch information
Qianqianye authored Sep 18, 2024
2 parents b1f7199 + 6d81dc9 commit ccad5b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pages/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ export const escapeCodeTagsContent = (htmlString: string): string => {
const $ = load(htmlString);
// Loop through all <code> 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 <code> tag
const currentHtml = $(this).html() ?? "";
// Use he to escape HTML entities
Expand Down

0 comments on commit ccad5b8

Please sign in to comment.