File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ import fs from "fs"
22import path from "path"
33import dotenv from "dotenv"
44import { DateTime } from "luxon"
5- import hljs from "highlight.js"
5+ import highlight from "highlight.js"
6+ import highlightDiff from "highlightjs-code-diff"
67import markdownIt from "markdown-it"
78import anchor from "markdown-it-anchor"
89import bracketedSpans from "markdown-it-bracketed-spans"
@@ -16,14 +17,17 @@ dotenv.config()
1617
1718export default function ( eleventyConfig ) {
1819 const isDevelopment = process . env . NODE_ENV === "development"
20+ const hljs = highlightDiff ( highlight )
1921 const markdownItConfig = markdownIt ( {
2022 html : true ,
2123 linkify : true ,
2224 typographer : true ,
2325 highlight : function ( str , lang ) {
24- if ( lang && hljs . getLanguage ( lang ) ) {
26+ const processLang = lang . replace ( "diff:" , "" )
27+ if ( lang && hljs . getLanguage ( processLang ) ) {
2528 try {
26- return hljs . highlight ( str , { language : lang } ) . value
29+ const returnValue = hljs . highlight ( str , { language : lang } ) . value
30+ return returnValue
2731 } catch ( __ ) { }
2832 }
2933 return ""
You can’t perform that action at this time.
0 commit comments