229 lines
4.4 KiB
SCSS

.dark .vp-code span {
color: var(--shiki-dark, rgba(235, 235, 245, 0.6));
}
html:not(.dark) .vp-code span {
color: var(--shiki-light, rgba(60, 60, 67, 0.78));
}
.plume-content {
pre {
padding: 1.3rem 1.5rem;
margin: 0 0 0.85rem 0;
border-radius: 6px;
overflow: auto;
scrollbar-width: thin;
scrollbar-color: var(--vp-c-brand-1) var(--vp-c-border);
font-size: 14px;
code {
color: #fff;
padding: 0;
background-color: transparent;
border-radius: 0;
overflow-wrap: unset;
-webkit-font-smoothing: auto;
-moz-osx-font-smoothing: auto;
}
}
.line-number {
font-family: var(--vp-font-family-mono);
}
.code-tabs {
.div[class*='language-'] {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
}
}
div[class*='language-'] {
position: relative;
background-color: var(--vp-code-block-bg);
border-radius: 6px;
&::before {
content: attr(data-ext);
position: absolute;
z-index: 3;
top: 0.8em;
right: 1em;
font-size: 0.75rem;
color: var(--vp-code-line-number-color);
}
code {
display: inline-block;
min-width: 100%;
}
pre {
// force override the background color to be compatible with shiki
background: transparent !important;
position: relative;
z-index: 1;
}
.highlight-lines {
user-select: none;
padding-top: 1.3rem;
position: absolute;
top: 0;
left: 0;
width: 100%;
line-height: 1.5;
.highlight-line {
background-color: var(--vp-c-default-soft);
}
}
&:not(.line-numbers-mode) {
.line-numbers {
display: none;
}
}
&.line-numbers-mode {
.highlight-lines .highlight-line {
position: relative;
&::before {
content: ' ';
position: absolute;
z-index: 2;
left: 0;
top: 0;
display: block;
height: 100%;
}
}
pre {
margin-left: 2rem;
padding-left: 1rem;
vertical-align: middle;
}
.line-numbers {
position: absolute;
top: 0;
left: 0;
width: 2rem;
height: 100%;
text-align: center;
z-index: 1;
color: var(--vp-code-line-number-color);
padding-top: 1.25rem;
line-height: var(--vp-code-line-height);
counter-reset: line-number;
border-right: var(--vp-code-block-divider-color) 1px solid;
.line-number {
position: relative;
z-index: 3;
user-select: none;
height: 1.5rem;
&::before {
counter-increment: line-number;
content: counter(line-number);
font-size: 0.85em;
}
}
}
}
}
.plume-content [class*='language-'] code .highlighted {
background-color: var(--vp-code-line-highlight-color);
transition: background-color 0.5s;
margin: 0 -24px;
padding: 0 24px;
width: calc(100% + 2 * 24px);
display: inline-block;
z-index: 2;
&.error {
background-color: var(--vp-code-line-error-color);
}
&.warning {
background-color: var(--vp-code-line-warning-color);
}
}
.plume-content [class*='language-'] code .diff {
transition: background-color 0.5s;
margin: 0 -24px;
padding: 0 24px;
width: calc(100% + 2 * 24px);
display: inline-block;
&::before {
position: absolute;
left: 10px;
}
&.remove {
background-color: var(--vp-code-line-diff-remove-color);
opacity: 0.7;
}
&.remove::before {
content: '-';
color: var(--vp-code-line-diff-remove-symbol-color);
transform: translateX(-6px);
}
&.add {
background-color: var(--vp-code-line-diff-add-color);
}
&.add::before {
content: '+';
color: var(--vp-code-line-diff-add-symbol-color);
transform: translateX(-6px);
}
}
.plume-content [class*='language-'] .has-focused-lines .line:not(.has-focus) {
filter: blur(0.095rem);
opacity: 0.7;
transition:
filter 0.35s,
opacity 0.35s;
}
.plume-content
[class*='language-']:hover
.has-focused-lines
.line:not(.has-focus) {
filter: blur(0);
opacity: 1;
}
.code-tabs-nav {
margin-bottom: 0rem;
}
// narrow mobile
@media (max-width: 419px) {
.plume-content {
div[class*='language-'] {
margin: 0.85rem -1.5rem;
border-radius: 0;
}
.hint-container div[class*='language-'] {
margin: 0.85rem -1rem 0.85rem -1.25rem;
}
}
.plume-content .vp-code-tabs-nav {
margin: 0 -1.5rem -0.85rem;
}
}