瀏覽代碼

highlight code blocks in excerpt too

Artur Paikin 5 年之前
父節點
當前提交
ed01291b26
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      website/scripts/highlight.js

+ 2 - 0
website/scripts/highlight.js

@@ -31,6 +31,8 @@ function highlight (lang, code) {
 function prismify (data) {
   data.content = data.content.replace(unhighlightedCodeRx,
     (_, lang, code) => highlight(lang, entities.decode(code)))
+  data.excerpt = data.excerpt.replace(unhighlightedCodeRx,
+    (_, lang, code) => highlight(lang, entities.decode(code)))
 
   return data
 }