mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-11 11:18:50 +01:00
19 lines
544 B
TypeScript
19 lines
544 B
TypeScript
export const escapeHtml = (html: string) => {
|
|
if (!html) {
|
|
return html;
|
|
}
|
|
return html.replace(/&/g, "&").replace(/</g, "<");
|
|
};
|
|
|
|
export const escapeGreat = (html: string) => {
|
|
return html.replace(/</g, "<");
|
|
};
|
|
|
|
export const escapeAttr = (html: string) => {
|
|
return html.replace(/"/g, """).replace(/'/g, "'");
|
|
};
|
|
|
|
export const escapeAriaLabel = (html: string) => {
|
|
return html.replace(/"/g, """).replace(/'/g, "'")
|
|
.replace(/</g, "&lt;").replace(/</g, "&lt;");
|
|
};
|