diff --git a/src/components/EditorMarkdownIt.vue b/src/components/EditorMarkdownIt.vue index a2f8522fc..1c9927915 100644 --- a/src/components/EditorMarkdownIt.vue +++ b/src/components/EditorMarkdownIt.vue @@ -148,10 +148,17 @@ export default { } }, + escapeHTML(string) { + return string.replace(/[^\u0030-\u0039\u0041-\u005A\u0061-\u007A]/g, function(char) { + return `&#${char.charCodeAt()}` + }) + }, + setInlineCodeRule() { + const editorInstance = this this.md.renderer.rules.code_inline = function(tokens, idx, options, env, self) { const token = tokens[idx] - return '' + token.content + '' + return '' + editorInstance.escapeHTML(token.content) + '' } }, },