dalfuss.net/quartz/util/escape.ts
2024-11-16 23:07:50 +01:00

8 lines
216 B
TypeScript

export const escapeHTML = (unsafe: string) => {
return unsafe
.replaceAll("&", "&")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#039;")
}