krata/assets/css/_addon/syntax.scss

133 lines
2.6 KiB
SCSS
Raw Normal View History

2019-11-15 17:01:33 +01:00
/*
2019-09-30 14:38:41 +02:00
* The syntax highlight.
2020-01-02 14:17:49 +01:00
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
2019-09-30 14:38:41 +02:00
* © 2018-2019 Cotes Chung
* MIT Licensed
*/
@import "_colors/light-syntax";
@import "_colors/dark-syntax";
2020-01-03 13:18:19 +01:00
2019-09-30 14:38:41 +02:00
html:not([mode]), html[mode=light] {
@include light-syntax;
}
html[mode=dark] {
@include dark-syntax;
}
@media (prefers-color-scheme: dark) {
html:not([mode]), html[mode=dark] {
@include dark-syntax;
}
html[mode=light] {
@include light-syntax;
}
}
2019-09-30 14:38:41 +02:00
/*-- Codes Snippet --*/
2020-02-25 10:56:03 +01:00
%highlight-pre-bg {
background: var(--highlight-bg-color);
2019-09-30 14:38:41 +02:00
}
2020-02-25 10:56:03 +01:00
%code-snippet-radius {
border-radius: 5px;
2019-09-30 14:38:41 +02:00
}
2020-02-25 10:56:03 +01:00
.highlighter-rouge {
2020-06-22 15:08:36 +02:00
background-color: var(--highlight-bg-color);
2020-02-25 10:56:03 +01:00
@extend %code-snippet-radius;
color: var(--highlighter-rouge-color);
2020-02-25 10:56:03 +01:00
margin-bottom: 1.2em; /* Override BS Inline-code style */
2019-09-30 14:38:41 +02:00
}
2020-02-25 10:56:03 +01:00
.highlight {
@extend %code-snippet-radius;
background: var(--highlight-bg-color);
2020-02-25 10:56:03 +01:00
@at-root figure#{&} {
background: var(--highlight-bg-color);
2020-02-25 10:56:03 +01:00
}
overflow: auto;
.lineno {
margin: .8rem 0rem;
padding: 0 .5rem;
min-width: 2.2rem;
text-align: right;
color: var(--highlight-lineno-color);
border-right: 1px solid var(--highlight-lineno-border-color);
2020-02-25 10:56:03 +01:00
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
table {
padding: 0;
border: 0;
td pre {
overflow: visible; /* Fixed iOS safari overflow-x */
word-break: normal; /* Fixed iOS safari linenos code break */
}
}
td {
padding: 0;
border: 0;
}
pre {
margin-bottom: 0;
font-size: .85rem;
line-height: 1.4rem;
word-wrap: normal;
/* Fixed Safari overflow-x */
}
2019-09-30 14:38:41 +02:00
} //.highlight
2019-09-30 14:38:41 +02:00
code {
-webkit-hyphens: none;
-ms-hyphens: none;
-moz-hyphens: none;
hyphens: none;
2020-02-25 10:56:03 +01:00
&.highlighter-rouge {
2020-06-22 15:08:36 +02:00
padding: 3px 5px;
2020-04-05 13:27:03 +02:00
margin: 0 .15rem;
2020-02-25 10:56:03 +01:00
border-radius: 4px;
2020-06-22 15:08:36 +02:00
background-color: var(--inline-code-bg);
2020-02-28 17:16:47 +01:00
}
@at-root a>&.highlighter-rouge {
padding-bottom: 0; // show link's underlinke
2020-06-22 15:08:36 +02:00
color: inherit;
2020-02-28 17:16:47 +01:00
}
@at-root a:hover>&.highlighter-rouge {
border-bottom: none;
2020-02-25 10:56:03 +01:00
}
2020-06-22 15:08:36 +02:00
blockquote &.highlighter-rouge {
color: inherit;
}
2019-09-30 14:38:41 +02:00
}
td.rouge-code {
padding-left: 1rem;
padding-right: 1rem;
}
2020-06-08 15:44:59 +02:00
/* Hide line numbers for default, console, and terminal code snippets */
div {
&[class^='highlighter-rouge'],
&.language-plaintext.highlighter-rouge,
&.language-console.highlighter-rouge,
&.language-terminal.highlighter-rouge {
pre.lineno {
display: none;
}
td.rouge-code {
padding: .8rem 1rem;
}
}
}