diff --git a/assets/css/_core/_base.scss b/assets/css/_core/_base.scss index dc96f78e..57e9ac76 100644 --- a/assets/css/_core/_base.scss +++ b/assets/css/_core/_base.scss @@ -63,6 +63,24 @@ img,video { height: auto; } +%code { + padding: 0.2em 0.4em; + margin: 0; + font-size: $code-font-size; + font-family: $code-font-family; + color: $code-color; + background-color: rgba(175, 184, 193, 0.2); + text-decoration: inherit; + @include border-radius($global-border-radius); + @include overflow-wrap(break-word); + @include line-break(auto); + + [data-theme='dark'] & { + color: $code-color-dark; + background-color: rgba(99, 110, 123, 0.4); + } +} + @include link(true, true); @import '../_partials/scrollbar'; diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index 74bd252c..dac0cf9e 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -166,11 +166,6 @@ font-weight: bolder; } - code { - padding: 0 .2em; - font-size: inherit; - } - &:hover, &:target { > .heading-mark { diff --git a/assets/css/_partials/_single/_code.scss b/assets/css/_partials/_single/_code.scss index 3f296bae..baa560c3 100644 --- a/assets/css/_partials/_single/_code.scss +++ b/assets/css/_partials/_single/_code.scss @@ -1,20 +1,6 @@ // inline code code { - padding: 0.2em 0.4em; - margin: 0; - font-size: $code-font-size; - font-family: $code-font-family; - color: $code-color; - background-color: rgba(175, 184, 193, 0.2); - text-decoration: inherit; - @include border-radius($global-border-radius); - @include overflow-wrap(break-word); - @include line-break(auto); - - [data-theme='dark'] & { - color: $code-color-dark; - background-color: rgba(99, 110, 123, 0.4); - } + @extend %code; } // indented code @@ -23,7 +9,7 @@ pre:not(.mermaid[data-processed='true']) { line-height: 1.45em; padding: 0.5rem; overflow: auto; - font-size: $code-font-size; + font-size: $code-block-font-size; font-family: $code-font-family; @include border-radius($global-border-radius); @include tab-size(4); @@ -54,7 +40,7 @@ pre:not(.mermaid[data-processed='true']) { .highlight, .gist { - font-size: $code-font-size; + font-size: $code-block-font-size; font-family: $code-font-family; .table-wrapper { diff --git a/assets/css/_partials/_single/_toc.scss b/assets/css/_partials/_single/_toc.scss index bca5bd41..944a54d0 100644 --- a/assets/css/_partials/_single/_toc.scss +++ b/assets/css/_partials/_single/_toc.scss @@ -8,6 +8,10 @@ .toc-content { font-size: $toc-content-font-size; + code { + @extend %code; + } + ul { text-indent: -0.8em; padding-left: 0.8em; diff --git a/assets/css/_variables.scss b/assets/css/_variables.scss index 079c20c9..ee35340b 100644 --- a/assets/css/_variables.scss +++ b/assets/css/_variables.scss @@ -164,7 +164,8 @@ $code-info-color: #9c9c9c !default; $code-info-color-dark: #b1b0b0 !default; // Font size of the code -$code-font-size: 0.875rem !default; +$code-font-size: 0.875em !default; +$code-block-font-size: 0.875rem !default; // Font family of the code $code-font-family: Source Code Pro, Menlo, Consolas, Monaco, monospace, $global-font-family !default;