mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-24 17:11:43 +00:00
fixed a bug where highlight.js would escape the text a second time
This commit is contained in:
parent
84665816a3
commit
c6b275aa96
2 changed files with 3 additions and 2 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
"socket.io-client": "^2.2.0",
|
"socket.io-client": "^2.2.0",
|
||||||
"twemoji": "^11.3.0",
|
"twemoji": "^11.3.0",
|
||||||
"uws": "^10.148.1",
|
"uws": "^10.148.1",
|
||||||
|
"validator": "^11.1.0",
|
||||||
"vue": "^2.5.17",
|
"vue": "^2.5.17",
|
||||||
"vue-headful": "^2.0.1",
|
"vue-headful": "^2.0.1",
|
||||||
"vue-mq": "^1.0.1",
|
"vue-mq": "^1.0.1",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import twemoji from 'twemoji'
|
||||||
import emojiParser from '@/utils/emojiParser';
|
import emojiParser from '@/utils/emojiParser';
|
||||||
import config from "@/config.js";
|
import config from "@/config.js";
|
||||||
import hljs from 'highlight.js'
|
import hljs from 'highlight.js'
|
||||||
|
import { escape as escapeHTML, unescape as unescapeHTML } from 'validator'
|
||||||
|
|
||||||
const futoji = new Formatter();
|
const futoji = new Formatter();
|
||||||
const emojiFormatter = new Formatter();
|
const emojiFormatter = new Formatter();
|
||||||
|
|
@ -84,7 +84,7 @@ futoji.addTransformer({
|
||||||
name: 'code-block',
|
name: 'code-block',
|
||||||
symbol: '```',
|
symbol: '```',
|
||||||
recursive: false,
|
recursive: false,
|
||||||
transformer: (text) => `<div class="codeblock"><code>${hljs.highlightAuto(formatCode(text).code).value}</code></div>`
|
transformer: text => `<div class="codeblock"><code>${hljs.highlightAuto(formatCode(unescapeHTML(text)).code).value}</code></div>`
|
||||||
})
|
})
|
||||||
|
|
||||||
futoji.addTransformer({
|
futoji.addTransformer({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue