Skip to content

Commit

Permalink
Update codeblock style and add border-radius settings (theme-next#194)
Browse files Browse the repository at this point in the history
* Update codeblock style and add border-radius settings

* Add border radius as variable

* Replace `$gainsboro` by `$code-background`.
  • Loading branch information
Alex LEE authored Mar 21, 2018
1 parent 05d60c5 commit 4d3c8ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ symbols_count_time:
awl: 5
wpm: 200

# Manual define the border radius in codeblock
# Leave it empty for the default 1
codeblock:
border_radius:

# Wechat Subscriber
#wechat_subscriber:
#enabled: true
Expand Down
11 changes: 8 additions & 3 deletions source/css/_common/components/highlight/highlight.styl
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ code {
color: $code-foreground;
background: $code-background;
border-radius: $code-border-radius;
font-size $code-font-size;
font-size: $code-font-size;
}

pre {
@extend $code-block;
padding: 10px;

code {
padding: 0;
color: $highlight-foreground;
Expand All @@ -39,7 +38,9 @@ pre {

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

pre {
border: none;
Expand All @@ -64,6 +65,10 @@ pre {
color: $highlight-foreground;
line-height: 1em;
margin-bottom: 1em;
margin: 0em;
padding: 0.5em;
background: $code-background;
border-bottom: 1px solid #e9e9e9;

a {
float: right;
Expand Down

0 comments on commit 4d3c8ee

Please sign in to comment.