Skip to content

Commit 1f7748f

Browse files
⚡ Update CSS
1 parent 40434e7 commit 1f7748f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/utils/add-style.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,25 @@ const link = document.querySelector('head link, head style');
55

66
style.textContent = `
77
code-block {
8+
position: relative;
89
margin: 1em 0;
910
display: block;
11+
font-size: 80%;
1012
font-family: Consolas, Monaco, monospace;
1113
}
14+
code-block span[slot="name"] {
15+
position: absolute;
16+
top: 0;
17+
left: 0;
18+
padding: 0 5px;
19+
color: #fff;
20+
line-height: 1.5;
21+
background: #75758a;
22+
}
23+
code-block pre,
24+
code-block code {
25+
font-family: inherit;
26+
}
1227
code-block pre {
1328
margin: 0;
1429
}
@@ -18,7 +33,10 @@ style.textContent = `
1833
font-size: 100%;
1934
overflow-x: auto;
2035
}
21-
`;
36+
code-block[label] pre code {
37+
padding-top: 2em;
38+
}
39+
`;
2240

2341
if (link) {
2442
link.before(style);

0 commit comments

Comments
 (0)