返回 oh-my-ppt
escape.ts
根目录 / src / main / presentation / html / escape.ts
1 /** Escapes text before embedding it in HTML or SVG attribute/value markup. */
2 export const escapeHtml = (value: string): string =>
3 value
4 .replace(/&/g, '&')
5 .replace(/</g, '&lt;')
6 .replace(/>/g, '&gt;')
7 .replace(/"/g, '&quot;')
8 .replace(/'/g, '&#39;')
9
9 lines TYPESCRIPT