2022-05-26 15:18:53 +08:00
|
|
|
export const escapeHtml = (html: string) => {
|
|
|
|
|
return html.replace(/&/g, "&").replace(/</g, "<");
|
|
|
|
|
};
|
2023-02-24 10:11:45 +08:00
|
|
|
|
2023-03-08 22:34:46 +08:00
|
|
|
export const escapeGreat = (html: string) => {
|
|
|
|
|
return html.replace(/</g, "<");
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-24 10:11:45 +08:00
|
|
|
export const escapeAttr = (html: string) => {
|
|
|
|
|
return html.replace(/"/g, """).replace(/'/g, "'");
|
|
|
|
|
};
|
2023-09-03 11:22:54 +08:00
|
|
|
|
|
|
|
|
export const escapeAriaLabel = (html: string) => {
|
|
|
|
|
return html.replace(/"/g, """).replace(/'/g, "'")
|
2023-09-09 14:54:05 +08:00
|
|
|
.replace(/</g, "&lt;").replace(/</g, "&lt;");
|
2023-09-03 11:22:54 +08:00
|
|
|
};
|