Skip to content

Commit 4d3c8ee

Browse files
author
Alex LEE
authored
Update codeblock style and add border-radius settings (theme-next#194)
* Update codeblock style and add border-radius settings * Add border radius as variable * Replace `$gainsboro` by `$code-background`.
1 parent 05d60c5 commit 4d3c8ee

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

_config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ symbols_count_time:
265265
awl: 5
266266
wpm: 200
267267

268+
# Manual define the border radius in codeblock
269+
# Leave it empty for the default 1
270+
codeblock:
271+
border_radius:
272+
268273
# Wechat Subscriber
269274
#wechat_subscriber:
270275
#enabled: true

source/css/_common/components/highlight/highlight.styl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ code {
2222
color: $code-foreground;
2323
background: $code-background;
2424
border-radius: $code-border-radius;
25-
font-size $code-font-size;
25+
font-size: $code-font-size;
2626
}
2727

2828
pre {
2929
@extend $code-block;
3030
padding: 10px;
31-
3231
code {
3332
padding: 0;
3433
color: $highlight-foreground;
@@ -39,7 +38,9 @@ pre {
3938

4039
.highlight {
4140
@extend $code-block;
42-
border-radius: 1px
41+
// Read values from NexT config and set they as local variables to use as string variables (in any CSS section).
42+
hexo-config('codeblock.border_radius') is a 'unit' ? (cbradius = unit(hexo-config('codeblock.border_radius'), px)) : (cbradius = 1px)
43+
border-radius: cbradius;
4344

4445
pre {
4546
border: none;
@@ -64,6 +65,10 @@ pre {
6465
color: $highlight-foreground;
6566
line-height: 1em;
6667
margin-bottom: 1em;
68+
margin: 0em;
69+
padding: 0.5em;
70+
background: $code-background;
71+
border-bottom: 1px solid #e9e9e9;
6772

6873
a {
6974
float: right;

0 commit comments

Comments
 (0)