ghost添加代码高亮highlight.js

下载highlight代码,拷贝到当前使用主题的assets目录

mv highlight ~/blog/content/themes/casper-zh/assets/hl
vim ~/blog/content/themes/casper-zh/default.hbs

修改模板,css添加到<head>标签内,js添加到</body>前面。

<link rel="stylesheet" type="text/css" href="{{asset "hl/styles/github-gist.css"}}" />
<script type="text/javascript" src="{{asset "hl/highlight.pack.js"}}"></script>
<script>hljs.initHighlightingOnLoad();</script>

重启ghost

sudo service supervisord restart