diff --git a/package.json b/package.json index c3e1c91..42dbc00 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "socket.io-client": "^2.2.0", "twemoji": "^11.3.0", "uws": "^10.148.1", + "validator": "^11.1.0", "vue": "^2.5.17", "vue-headful": "^2.0.1", "vue-mq": "^1.0.1", diff --git a/src/utils/messageFormatter.js b/src/utils/messageFormatter.js index 81ac86f..f0c7376 100644 --- a/src/utils/messageFormatter.js +++ b/src/utils/messageFormatter.js @@ -3,7 +3,7 @@ import twemoji from 'twemoji' import emojiParser from '@/utils/emojiParser'; import config from "@/config.js"; import hljs from 'highlight.js' - +import { escape as escapeHTML, unescape as unescapeHTML } from 'validator' const futoji = new Formatter(); const emojiFormatter = new Formatter(); @@ -84,7 +84,7 @@ futoji.addTransformer({ name: 'code-block', symbol: '```', recursive: false, - transformer: (text) => `
${hljs.highlightAuto(formatCode(text).code).value}${hljs.highlightAuto(formatCode(unescapeHTML(text)).code).value}