feat(layout): add the language and a button to copy code blocks
This commit is contained in:
parent
7c3facdd0f
commit
7b84496201
3 changed files with 124 additions and 12 deletions
|
@ -58,6 +58,9 @@
|
|||
--pico-background-color: rgb(247 249 252 / 100%);
|
||||
--pico-card-background-color: rgb(255 255 255 / 100%);
|
||||
--pico-card-sectioning-background-color: transparent;
|
||||
--pico-code-color: inherit;
|
||||
|
||||
--color-codeblock-meta-background: rgb(255 255 255 / 100%);
|
||||
}
|
||||
|
||||
.admonition.warning {
|
||||
|
@ -72,6 +75,11 @@
|
|||
}
|
||||
|
||||
@media only screen and (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme]) {
|
||||
--pico-code-color: inherit;
|
||||
|
||||
--color-codeblock-meta-background: rgb(0 0 0 / 30%);
|
||||
}
|
||||
.admonition.warning {
|
||||
--admonition-background-color: rgb(52 46 38 / 100%);
|
||||
--admonition-border-color: rgb(255 208 143 / 100%);
|
||||
|
@ -444,3 +452,47 @@ main {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code blocks
|
||||
*/
|
||||
|
||||
.highlight {
|
||||
position: relative;
|
||||
|
||||
> div {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
padding: 0.5em 1.2em;
|
||||
color: var(--pico-muted-color);
|
||||
background-color: var(--color-codeblock-meta-background);
|
||||
font-family: var(--pico-font-family-monospace);
|
||||
font-size: 0.7em;
|
||||
line-height: 1em;
|
||||
border-end-start-radius: var(--pico-border-radius);
|
||||
|
||||
span {
|
||||
border-inline-start: inset 1px var(--pico-muted-color);
|
||||
padding-inline-start: 1em;
|
||||
margin-inline-start: 1em;
|
||||
cursor: pointer;
|
||||
|
||||
&::before {
|
||||
content: "\ecd5";
|
||||
font-family: "remixicon";
|
||||
font-weight: normal;
|
||||
margin-inline-end: 0.5em;
|
||||
}
|
||||
|
||||
&.copied::before {
|
||||
content: "\eb7b";
|
||||
}
|
||||
|
||||
&.not-copied::before {
|
||||
content: "\eca1";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue