소스 검색

fix: markdown preview fails to load lang files for code blocks (#1162)

NGPixel 5 년 전
부모
커밋
f154f9cae5
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      client/components/editor/editor-markdown.vue

+ 11 - 0
client/components/editor/editor-markdown.vue

@@ -223,6 +223,17 @@ import Prism from 'prismjs'
 // Platform detection
 const CtrlKey = /Mac/.test(navigator.platform) ? 'Cmd' : 'Ctrl'
 
+// Prism Config
+Prism.plugins.autoloader.languages_path = '/js/prism/'
+Prism.plugins.NormalizeWhitespace.setDefaults({
+  'remove-trailing': true,
+  'remove-indent': true,
+  'left-trim': true,
+  'right-trim': true,
+  'remove-initial-line-feed': true,
+  'tabs-to-spaces': 2
+})
+
 // Markdown Instance
 const md = new MarkdownIt({
   html: true,