From 7c74cd8fa998dc12acd7238f30516682ba1521ca Mon Sep 17 00:00:00 2001 From: Nitwel Date: Wed, 7 Oct 2020 12:48:09 +0200 Subject: [PATCH] fix code highlighting --- app/src/modules/docs/routes/markdown.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/modules/docs/routes/markdown.vue b/app/src/modules/docs/routes/markdown.vue index b22b375fca..cf66feb0a8 100644 --- a/app/src/modules/docs/routes/markdown.vue +++ b/app/src/modules/docs/routes/markdown.vue @@ -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 = /

:::(.*?) (.*?)\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(