site/quartz/util/escape.ts

9 lines
216 B
TypeScript
Raw Normal View History

2024-04-05 00:03:11 +00:00
export const escapeHTML = (unsafe: string) => {
return unsafe
.replaceAll("&", "&")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#039;")
}