Cut down highlight.js size

This commit is contained in:
venashial
2022-06-24 22:26:49 -07:00
parent 81c039d645
commit 1b17049e94
7 changed files with 49 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
import { marked } from 'marked'
import hljs from 'highlight.js'
import insane from 'insane'
import { highlight } from './highlight'
const renderer = new marked.Renderer()
@@ -27,10 +27,7 @@ renderer.link = (href, title, text) => {
marked.setOptions({
renderer,
highlight: function (code, lang) {
const language = hljs.getLanguage(lang) ? lang : 'plaintext'
return hljs.highlight(code, { language }).value
},
highlight,
langPrefix: 'hljs language-',
headerPrefix: '',
gfm: true,