diff --git a/_config.yml b/_config.yml index b2ec401..901449d 100755 --- a/_config.yml +++ b/_config.yml @@ -139,7 +139,7 @@ comments: js: https://unpkg.com/@waline/client@v2/dist/waline.js css: https://unpkg.com/@waline/client@v2/dist/waline.css # Waline server address url, you should set this to your own link - serverURL: + serverURL: # If false, comment count will only be displayed in post page, not in home page commentCount: true @@ -302,7 +302,7 @@ plugins: enable: false css: https://unpkg.com/heti/umd/heti.min.css js: https://unpkg.com/heti/umd/heti-addon.min.js - + # MathJax # 需在Markdown文件开头加入mathjax: true # 推荐使用Pandoc: npm uninstall hexo-renderer-marked --save & npm install hexo-renderer-pandoc --save @@ -321,6 +321,7 @@ style: background: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.2/avatar/round/rainbow64@3x.webp codeblock: scrollbar: 4px + highlightjs_theme: https://fastly.jsdelivr.net/gh/highlightjs/cdn-release@11.5.0/build/styles/atom-one-dark.min.css default: avatar: https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 6c894be..9b02e82 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -82,6 +82,11 @@ function og_args() { <%- favicon_tag(config.favicon) %> <% } %> + <% if (config.highlight && config.highlight.enable == true && config.highlight.hljs == true) { %> + <%- css(theme.style.codeblock.highlightjs_theme) %> + <% } %> + + <% if (config.inject && config.inject.head){ %> <% (config.inject.head||[]).forEach(function(item){ %> <%- item %> diff --git a/source/css/_common/highlight.styl b/source/css/_common/highlight.styl index 96c1b11..dbbe6d6 100644 --- a/source/css/_common/highlight.styl +++ b/source/css/_common/highlight.styl @@ -78,6 +78,17 @@ article.md .highlight table:not([class]) border-collapse: collapse + +article.md pre + >.caption + color: var(--text-p3) + >.hljs + padding: 1rem + border-radius: $border-block + border: 1px solid var(--block-border) + line-height: 1.5 + box-sizing: border-box + article.md .highlight .code vertical-align: top