fix code highlighting

This commit is contained in:
Nitwel
2020-10-07 12:48:09 +02:00
parent 0e03847778
commit 7c74cd8fa9

View File

@@ -8,6 +8,7 @@
import { defineComponent, ref, computed, watch, PropType, onMounted, onUpdated } from '@vue/composition-api';
import marked from 'marked';
import highlight from 'highlight.js';
import 'highlight.js/styles/github.css'
export default defineComponent({
setup(props, { slots }) {
@@ -28,7 +29,9 @@ export default defineComponent({
const hintRegex = /<p>:::(.*?) (.*?)\r?\n((\s|.)*?):::<\/p>/gm;
htmlString = marked(htmlString, {
highlight: (code) => highlight.highlightAuto(code).value,
highlight: (code, lang) => {
return highlight.highlightAuto(code, [lang]).value
},
});
htmlString = htmlString.replaceAll(