diff --git a/src/tools/icon-utils.ts b/src/tools/icon-utils.ts index d45cbfe..ad8622d 100644 --- a/src/tools/icon-utils.ts +++ b/src/tools/icon-utils.ts @@ -7,6 +7,7 @@ import { isFileExcalidraw, warnDebug, } from './utils' +import { escapeHTML } from './text-processing' export interface IconPacks { prefixToIconPack: { [prefix: string]: string } @@ -133,7 +134,7 @@ export async function loadIconSVG( if (!prefix) { // No prefix, assume it's an emoji or text - return `${name}` + return `${escapeHTML(name)}` } const iconPackName = prefixToIconPack[prefix] diff --git a/src/tools/text-processing.ts b/src/tools/text-processing.ts index a151f73..351817e 100644 --- a/src/tools/text-processing.ts +++ b/src/tools/text-processing.ts @@ -78,15 +78,6 @@ export class TextProcessor { } } - escapeHTML(html: string): string { - return html - .replaceAll('&', '&') - .replaceAll('<', '<') - .replaceAll('>', '>') - .replaceAll('"', '"') - .replaceAll("'", ''') - } - /** * Converts a list of strings to a list of words, using the \b word boundary. * Used to find excerpts in a note body, or select which words to highlight. @@ -200,7 +191,7 @@ export class TextProcessor { } } -function escapeHTML(html: string): string { +export function escapeHTML(html: string): string { return html .replaceAll('&', '&') .replaceAll('<', '<')