diff --git a/src/app/components/editor/output.ts b/src/app/components/editor/output.ts
index fa15bb5..1fb2d59 100644
--- a/src/app/components/editor/output.ts
+++ b/src/app/components/editor/output.ts
@@ -51,21 +51,25 @@ const elementToCustomHtml = (node: CustomElement, children: string): string => {
return `
`;
case BlockType.Mention:
- return `${node.name}`;
+ return `${sanitizeText(
+ node.name
+ )}`;
case BlockType.Emoticon:
return node.key.startsWith('mxc://')
- ? ``
- : node.key;
+ ? ``
+ : sanitizeText(node.key);
case BlockType.Link:
- return `${node.children}`;
+ return `${node.children}`;
case BlockType.Command:
- return `/${node.command}`;
+ return `/${sanitizeText(node.command)}`;
default:
return children;
}
};
-const HTML_TAG_REG = /<([a-z]+)(?![^>]*\/>)[^<]*<\/\1>/;
+const HTML_TAG_REG = /<([\w-]+)(?:[^/>]*)(?:(?:\/>)|(?:>.*?<\/\1>))/;
const ignoreHTMLParseInlineMD = (text: string): string => {
if (text === '') return text;
const match = text.match(HTML_TAG_REG);