refactor: modernise old code, fix svelte warnings and redo title bar badge

This commit is contained in:
Jones Jankovic committed 2026-11-02 17:29:12 +10:30
1 parent 941597f197
commit e2b1b6b81f
68 files changed
+785 -2152

No files matched your search

-12
View File
@@ -1,17 +1,5 @@
import DOMPurify from "dompurify";
/**
* Converts an HTML string into a DOM element, with sanitization and optional styling.
*
* This function first sanitizes the input HTML string using DOMPurify to prevent XSS attacks.
* The sanitization process allows only safe URI schemes in links and media.
* Then, it parses the sanitized string into an HTML document and returns its body.
* Optionally, it can apply predefined CSS styles to the body element.
*
* @param {string} str The HTML string to convert.
* @param {boolean} [styles=false] Whether to apply predefined styles to the document body.
* @returns {HTMLElement} The body element of the parsed and sanitized HTML document.
*/
export default function stringToHTML(str: string, styles = false) {
const parser = new DOMParser();