-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
code-block.css
61 lines (52 loc) · 1.43 KB
/
code-block.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
code {
@apply border-black/5 bg-black/5 break-words rounded-md border py-0.5 px-[0.25em] text-[0.9em];
@apply dark:border-white/10 dark:bg-white/10;
box-decoration-break: clone;
font-feature-settings: 'rlig' 1, 'calt' 1, 'ss01' 1;
&[data-line-numbers] {
counter-reset: line;
& > .line::before {
counter-increment: line;
content: counter(line);
@apply mr-6 inline-block w-4 text-right text-gray-500;
}
}
.line.highlighted {
@apply border-primary-600/60 bg-primary-600/10;
span {
@apply relative;
}
}
.line .highlighted {
@apply rounded-sm shadow-[0_0_0_3px_rgba(0,0,0,0.3)];
@apply bg-primary-800/10 shadow-primary-800/10;
@apply dark:bg-primary-300/10 dark:shadow-primary-300/10;
}
}
pre {
/* content-visibility: auto; */
contain: paint;
code {
@apply grid min-w-full rounded-none border-none bg-transparent p-0 text-sm leading-5 text-current dark:bg-transparent;
/* code blocks without languages don't have children that have px-4 */
&:not([data-language]) {
@apply px-4;
}
.line {
@apply border-l-2 border-transparent px-4;
}
}
}
[data-rehype-pretty-code-fragment] {
@apply relative;
&:hover .nextra-copy-button {
@apply opacity-100;
}
}
@supports (
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
) {
.nextra-copy-button {
@apply backdrop-blur-md bg-opacity-[.85] dark:bg-opacity-80;
}
}