Escape HTML output
typescriptMinimal context-aware escaping before reflecting user input into HTML.
export function escapeHtml(input: string): string {
return input
.replaceAll("&", "&")
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll('"', """)
.replaceAll("'", "'");
}
// Prefer framework-safe templating + CSP in production.