mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
feat: removing pre and code
This commit is contained in:
@@ -39,6 +39,12 @@ export function sanitizeHtml(html: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove code and pre tags but keep their text content
|
||||
for (const el of tempDiv.querySelectorAll("code, pre")) {
|
||||
const textNode = document.createTextNode(el.textContent || "");
|
||||
el.replaceWith(textNode);
|
||||
}
|
||||
|
||||
for (const el of tempDiv.querySelectorAll("*")) {
|
||||
for (const attr of Array.from(el.attributes)) {
|
||||
const name = attr.name.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user