0%

Hexo-Next-更改字体、代码可复制

Next版本为7.8.0,找到 /themes/next/_config.yml 文件,搜索 font 关键词,这里注意一定要将 font 里面的 enable 设置为true, 因为默认为false,然后设置 family 为自己想要的,如果family在其他平台找的,就需要修改host。(只是修改了family, 没修改enable就会不生效,所以一定一定要记得)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
font:
enable: true

# Uri of fonts host, e.g. https://fonts.googleapis.com (Default).
host:

# Font options:
# `external: true` will load this font family from `host` above.
# `family: Times New Roman`. Without any quotes.
# `size: x.x`. Use `em` as unit. Default: 1 (16px)

# Global font settings used for all elements inside <body>.
global:
external: true
family: Noto Serif SC
size:

# Font settings for site title (.site-title).
title:
external: true
family: Noto Serif SC
size:

# Font settings for headlines (<h1> to <h6>).
headings:
external: true
family: Noto Serif SC
size:

# Font settings for posts (.post-body).
posts:
external: true
family: Noto Serif SC

# Font settings for <code> and code blocks.
codes:
external: true
family: Source Code Pro


代码可复制,还是上面同一个文件,找到以下代码段,将copy_button的enable设置为true,启用就可以啦。show_result设置true后,复制完会显示一个勾。style对应的copy_button不同的样式,看个人喜好来~

1
2
3
4
5
6
7
8
9
10
11
12
codeblock:
# Code Highlight theme
# Available values: normal | night | night eighties | night blue | night bright | solarized | solarized dark | galactic
# See: https://github.com/chriskempson/tomorrow-theme
highlight_theme: night eighties
# Add copy button on codeblock
copy_button:
enable: true
# Show text copy result.
show_result: true
# Available values: default | flat | mac
style: mac
-------------本文结束感谢您的阅读-------------