diff options
| author | Reorx <novoreorx@gmail.com> | 2022-04-15 00:55:41 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-04-15 00:55:41 +0800 |
| commit | 33c1ba12e22ec939cd4c85186c243b6617a28527 (patch) | |
| tree | e08a98331141711727c94ca47653853ecde34872 /assets/css/common | |
| parent | 60380fe684fb6db6c75ce9f4863f1047e6566649 (diff) | |
use hugo's builtin Chroma for code highlight
Diffstat (limited to 'assets/css/common')
| -rw-r--r-- | assets/css/common/highlight.scss | 10 | ||||
| -rw-r--r-- | assets/css/common/post-single.css | 18 |
2 files changed, 21 insertions, 7 deletions
diff --git a/assets/css/common/highlight.scss b/assets/css/common/highlight.scss new file mode 100644 index 0000000..810cc26 --- /dev/null +++ b/assets/css/common/highlight.scss @@ -0,0 +1,10 @@ +@import '../lib/chroma-light'; + +// for github theme, add a background color +.chroma { + background-color: #f6f8fa; +} + +.dark { + @import '../lib/chroma-dark'; +} diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index 61e3581..d187987 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -193,7 +193,6 @@ h6:hover .anchor { .post-content .highlight:not(table) { margin: 10px auto; - background: var(--hljs-bg) !important; border-radius: var(--radius); } @@ -230,22 +229,27 @@ h6:hover .anchor { display: none; } +/* code block */ +.post-content .chroma { + border-radius: var(--radius); +} +/* TODO refactor this shit */ .post-content code { + /* inline code */ + background-color: var(--code-bg); + margin: auto 4px; padding: 4px 6px; font-size: 0.78em; line-height: 1.5; - background: var(--code-bg); border-radius: 2px; } - .post-content pre code { + /* reset inline code */ + background-color: unset; display: block; margin: auto 0; padding: 10px; - color: rgb(213, 213, 214); - background: var(--hljs-bg) !important; - border-radius: var(--radius); overflow-x: auto; word-break: break-all; } @@ -416,7 +420,7 @@ h6:hover .anchor { .post-content :not(table) ::-webkit-scrollbar-thumb { - border: 2px solid var(--hljs-bg); + border: 2px solid var(--code-bg); background: rgb(113, 113, 117); } |
