1 parent 39aa274 commit de6b679Copy full SHA for de6b679
1 file changed
src/helper/enumerate-entries.ts
@@ -42,7 +42,7 @@ export function enumerateContents(
42
}
43
44
export function textNodeToHTML(node: TextNode, renderOption: RenderOption): string {
45
- let text = node.text;
+ let text = escapeHtml(node.text);
46
if (node.classname || node.id) {
47
text = (renderOption[MarkType.CLASSNAME_OR_ID] as RenderMark)(text, node.classname, node.id);
48
@@ -158,3 +158,10 @@ function nodeToHTML(
158
159
160
161
+
162
+function escapeHtml(text: string): string {
163
+ return text
164
+ .replace(/&/g, '&')
165
+ .replace(/</g, '<')
166
+ .replace(/>/g, '>')
167
+}
0 commit comments