site/quartz/util/escape.ts
2024-04-05 02:03:11 +02:00

9 lines
216 B
TypeScript

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