We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3a38d05 + 67a305a commit a872651Copy full SHA for a872651
src/pages/_utils.ts
@@ -239,6 +239,18 @@ export const escapeCodeTagsContent = (htmlString: string): string => {
239
240
// Get the current text and HTML inside the <code> tag
241
const currentHtml = $(this).html() ?? "";
242
+
243
+ // Check if the content is already escaped by looking for common HTML entities
244
+ if (
245
+ currentHtml.includes("<") ||
246
+ currentHtml.includes(">") ||
247
+ currentHtml.includes("&") ||
248
+ currentHtml.includes(""") ||
249
+ currentHtml.includes("'")
250
+ ) {
251
+ return; // Already escaped, skip this <code> tag
252
+ }
253
254
// Use he to escape HTML entities
255
const escapedHtml = he.escape(currentHtml);
256
// Update the <code> tag content with the escaped HTML
0 commit comments