2019-11-15 17:01:33 +01:00
|
|
|
/*
|
2019-09-30 14:38:41 +02:00
|
|
|
* The syntax highlight.
|
|
|
|
*/
|
|
|
|
|
2021-01-23 06:20:58 +01:00
|
|
|
@import "colors/light-syntax";
|
|
|
|
@import "colors/dark-syntax";
|
2020-01-03 13:18:19 +01:00
|
|
|
|
2020-08-19 15:18:14 +02:00
|
|
|
html:not([mode]),
|
|
|
|
html[mode=light] {
|
2020-02-27 14:05:50 +01:00
|
|
|
@include light-syntax;
|
|
|
|
}
|
|
|
|
|
|
|
|
html[mode=dark] {
|
|
|
|
@include dark-syntax;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (prefers-color-scheme: dark) {
|
2020-08-19 15:18:14 +02:00
|
|
|
html:not([mode]),
|
|
|
|
html[mode=dark] {
|
2020-02-27 14:05:50 +01:00
|
|
|
@include dark-syntax;
|
|
|
|
}
|
|
|
|
|
|
|
|
html[mode=light] {
|
|
|
|
@include light-syntax;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 15:18:14 +02:00
|
|
|
/* -- Codes Snippet -- */
|
2019-09-30 14:38:41 +02:00
|
|
|
|
2021-09-09 15:07:07 +02:00
|
|
|
$code-radius: 6px;
|
|
|
|
|
2020-08-15 15:05:48 +02:00
|
|
|
%code-snippet-bg {
|
2020-02-27 14:05:50 +01:00
|
|
|
background: var(--highlight-bg-color);
|
2019-09-30 14:38:41 +02:00
|
|
|
}
|
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
%code-snippet-radius {
|
2021-09-09 15:07:07 +02:00
|
|
|
border-radius: $code-radius;
|
2019-09-30 14:38:41 +02:00
|
|
|
}
|
|
|
|
|
2020-08-15 15:05:48 +02:00
|
|
|
%code-snippet-padding {
|
2021-09-09 15:07:07 +02:00
|
|
|
padding: 1.2rem;
|
2020-08-19 15:18:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
div > pre {
|
|
|
|
@extend %code-snippet-bg;
|
|
|
|
@extend %code-snippet-radius;
|
|
|
|
@extend %code-snippet-padding;
|
2020-08-15 15:05:48 +02:00
|
|
|
}
|
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
.highlighter-rouge {
|
2020-08-15 15:05:48 +02:00
|
|
|
@extend %code-snippet-bg;
|
2020-02-25 10:56:03 +01:00
|
|
|
@extend %code-snippet-radius;
|
2020-08-19 15:18:14 +02:00
|
|
|
|
2020-02-27 14:05:50 +01:00
|
|
|
color: var(--highlighter-rouge-color);
|
2020-12-24 12:37:33 +01:00
|
|
|
margin-top: 0.5rem;
|
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;
|
2020-08-15 15:05:48 +02:00
|
|
|
@extend %code-snippet-bg;
|
2020-08-19 15:18:14 +02:00
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
@at-root figure#{&} {
|
2020-08-15 15:05:48 +02:00
|
|
|
@extend %code-snippet-bg;
|
2020-02-25 10:56:03 +01:00
|
|
|
}
|
2020-08-19 15:18:14 +02:00
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
overflow: auto;
|
2021-07-08 15:07:31 +02:00
|
|
|
|
2020-08-19 15:18:14 +02:00
|
|
|
pre {
|
|
|
|
margin-bottom: 0;
|
2020-08-23 10:09:35 +02:00
|
|
|
font-size: $code-font-size;
|
2020-08-19 15:18:14 +02:00
|
|
|
line-height: 1.4rem;
|
|
|
|
word-wrap: normal; /* Fixed Safari overflow-x */
|
|
|
|
}
|
2021-07-08 15:07:31 +02:00
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
table {
|
|
|
|
padding: 0;
|
|
|
|
border: 0;
|
2021-10-25 21:04:15 +02:00
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
td pre {
|
|
|
|
overflow: visible; /* Fixed iOS safari overflow-x */
|
|
|
|
word-break: normal; /* Fixed iOS safari linenos code break */
|
|
|
|
}
|
|
|
|
}
|
2021-07-08 15:07:31 +02:00
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
td {
|
|
|
|
padding: 0;
|
|
|
|
border: 0;
|
|
|
|
}
|
2021-07-08 15:07:31 +02:00
|
|
|
|
|
|
|
.lineno {
|
|
|
|
padding-right: 0.5rem;
|
|
|
|
min-width: 2.2rem;
|
|
|
|
text-align: right;
|
|
|
|
color: var(--highlight-lineno-color);
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-khtml-user-select: none;
|
|
|
|
-moz-user-select: none;
|
|
|
|
-ms-user-select: none;
|
|
|
|
-o-user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the dollar sign to non-selectable */
|
|
|
|
.gp {
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
2020-02-27 14:05:50 +01:00
|
|
|
} //.highlight
|
2019-09-30 14:38:41 +02:00
|
|
|
|
|
|
|
code {
|
|
|
|
-webkit-hyphens: none;
|
|
|
|
-ms-hyphens: none;
|
|
|
|
-moz-hyphens: none;
|
|
|
|
hyphens: none;
|
2020-08-19 15:18:14 +02:00
|
|
|
|
2020-02-25 10:56:03 +01:00
|
|
|
&.highlighter-rouge {
|
2020-08-23 10:09:35 +02:00
|
|
|
font-size: $code-font-size;
|
2020-06-22 15:08:36 +02:00
|
|
|
padding: 3px 5px;
|
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
|
|
|
}
|
2020-08-19 15:18:14 +02:00
|
|
|
|
|
|
|
@at-root a > &.highlighter-rouge {
|
2020-02-28 17:16:47 +01:00
|
|
|
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
|
|
|
}
|
2020-08-19 15:18:14 +02:00
|
|
|
|
|
|
|
@at-root a:hover > &.highlighter-rouge {
|
2020-02-28 17:16:47 +01:00
|
|
|
border-bottom: none;
|
2020-02-25 10:56:03 +01:00
|
|
|
}
|
2020-08-19 15:18:14 +02: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 {
|
2021-09-09 15:07:07 +02:00
|
|
|
padding: 1.2rem 1.5rem 1.2rem 1rem;
|
2021-01-10 11:48:36 +01:00
|
|
|
|
|
|
|
// Prevent some browser extends from
|
|
|
|
// changing the URL string of code block.
|
|
|
|
a {
|
|
|
|
color: inherit !important;
|
|
|
|
border-bottom: none !important;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
2019-09-30 14:38:41 +02:00
|
|
|
}
|
|
|
|
|
2020-06-08 15:44:59 +02:00
|
|
|
/* Hide line numbers for default, console, and terminal code snippets */
|
2020-02-27 14:05:50 +01:00
|
|
|
div {
|
|
|
|
&[class^='highlighter-rouge'],
|
2020-06-23 10:26:12 +02:00
|
|
|
&.language-plaintext.highlighter-rouge,
|
2020-02-27 14:05:50 +01:00
|
|
|
&.language-console.highlighter-rouge,
|
2021-09-13 16:26:17 +02:00
|
|
|
&.language-terminal.highlighter-rouge,
|
|
|
|
&.nolineno {
|
2020-02-27 14:05:50 +01:00
|
|
|
pre.lineno {
|
|
|
|
display: none;
|
|
|
|
}
|
2021-10-25 21:04:15 +02:00
|
|
|
|
2020-02-27 14:05:50 +01:00
|
|
|
td.rouge-code {
|
2020-08-15 15:05:48 +02:00
|
|
|
@extend %code-snippet-padding;
|
2020-02-27 14:05:50 +01:00
|
|
|
}
|
2020-02-11 17:04:59 +01:00
|
|
|
}
|
|
|
|
}
|
2020-12-18 13:32:07 +01:00
|
|
|
|
2021-09-09 15:07:07 +02:00
|
|
|
.code-header {
|
|
|
|
background: var(--code-header-bg);
|
|
|
|
border-top-left-radius: $code-radius;
|
|
|
|
border-top-right-radius: $code-radius;
|
2021-09-09 16:09:07 +02:00
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
line-height: 1.85rem;
|
2020-12-18 13:32:07 +01:00
|
|
|
|
2021-09-22 15:27:15 +02:00
|
|
|
// icons
|
|
|
|
i {
|
|
|
|
font-size: 1rem;
|
|
|
|
color: var(--lang-badge-muted-color);
|
|
|
|
|
|
|
|
&.small {
|
|
|
|
font-size: 70%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-22 15:20:30 +02:00
|
|
|
// the label block
|
2021-09-22 12:25:46 +02:00
|
|
|
span {
|
2021-09-29 10:34:22 +02:00
|
|
|
padding-left: 0.35rem;
|
2021-09-22 12:25:46 +02:00
|
|
|
|
2021-09-24 09:32:23 +02:00
|
|
|
&::after {
|
2021-09-22 12:25:46 +02:00
|
|
|
content: attr(text-data);
|
2021-09-22 15:27:15 +02:00
|
|
|
font-size: 0.85rem;
|
2021-09-22 12:25:46 +02:00
|
|
|
font-weight: 600;
|
2021-09-22 15:27:15 +02:00
|
|
|
color: var(--lang-badge-color);
|
2021-09-22 15:20:30 +02:00
|
|
|
}
|
2021-09-15 16:50:28 +02:00
|
|
|
|
2021-09-29 10:34:22 +02:00
|
|
|
i {
|
|
|
|
margin: 0 0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@at-root [file] #{&} > i {
|
2021-09-22 12:25:46 +02:00
|
|
|
position: relative;
|
2021-09-29 10:34:22 +02:00
|
|
|
top: 1px; // center the file icon
|
|
|
|
margin-left: 0.25rem;
|
2021-09-15 16:50:28 +02:00
|
|
|
}
|
2021-09-22 12:25:46 +02:00
|
|
|
|
2020-12-18 13:32:07 +01:00
|
|
|
}
|
2021-09-09 16:09:07 +02:00
|
|
|
|
|
|
|
// clipboard
|
|
|
|
button {
|
2021-09-15 08:36:37 +02:00
|
|
|
border: 1px solid var(--code-header-bg);
|
|
|
|
border-radius: $code-radius;
|
|
|
|
padding: 0;
|
|
|
|
width: 1.95rem;
|
2021-09-09 16:09:07 +02:00
|
|
|
background-color: inherit;
|
|
|
|
|
2021-09-17 10:58:32 +02:00
|
|
|
@extend %cursor-pointer;
|
|
|
|
|
2021-09-16 09:38:59 +02:00
|
|
|
&[timeout] {
|
2021-09-22 16:21:33 +02:00
|
|
|
&:hover {
|
|
|
|
border-color: var(--clipboard-checked-color);
|
|
|
|
}
|
|
|
|
|
2021-09-22 15:27:15 +02:00
|
|
|
i {
|
|
|
|
color: var(--clipboard-checked-color);
|
|
|
|
}
|
2021-09-15 08:36:37 +02:00
|
|
|
}
|
|
|
|
|
2021-09-16 09:38:59 +02:00
|
|
|
&:not([timeout]):hover {
|
2021-09-22 16:21:33 +02:00
|
|
|
background-color: rgba(128, 128, 128, 0.37);
|
|
|
|
|
|
|
|
i {
|
2021-09-22 12:25:46 +02:00
|
|
|
color: white;
|
|
|
|
}
|
2021-09-09 16:09:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-18 13:32:07 +01:00
|
|
|
}
|
2021-02-07 20:46:20 +01:00
|
|
|
|
2021-09-09 15:07:07 +02:00
|
|
|
@media all and (max-width: 576px) {
|
|
|
|
.post-content {
|
|
|
|
> div[class^='language-'] {
|
|
|
|
@include ml-mr(-1.25rem);
|
|
|
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
2021-09-29 10:34:22 +02:00
|
|
|
.highlight {
|
|
|
|
padding-left: 0.25rem;
|
|
|
|
}
|
|
|
|
|
2021-09-09 15:07:07 +02:00
|
|
|
.code-header {
|
|
|
|
border-radius: 0;
|
2021-09-09 16:09:07 +02:00
|
|
|
padding-left: 0.4rem;
|
2021-09-15 08:36:37 +02:00
|
|
|
padding-right: 0.5rem;
|
2021-09-09 15:07:07 +02:00
|
|
|
}
|
|
|
|
}
|
2021-02-07 20:46:20 +01:00
|
|
|
}
|
|
|
|
}
|