Skip to content

Commit 5cc2dd6

Browse files
committed
wip: Play with CSS styles shiki code block
1 parent 4cb9075 commit 5cc2dd6

File tree

1 file changed

+49
-16
lines changed

1 file changed

+49
-16
lines changed

packages/test-case-component/src/styles.css

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:root {
2-
--line-height: 16px;
2+
--line-height: 2rem;
33
--color-border: #0003;
44
}
55

@@ -15,6 +15,34 @@ body {
1515
/* background-image: radial-gradient(at 30% 89%, hsla(220,76%,68%,1) 0px, transparent 50%), radial-gradient(at 35% 0%, hsla(242,68%,61%,1) 0px, transparent 50%), radial-gradient(at 93% 46%, hsla(129,87%,73%,1) 0px, transparent 50%), radial-gradient(at 23% 49%, hsla(50,77%,67%,1) 0px, transparent 50%), radial-gradient(at 17% 27%, hsla(331,64%,60%,1) 0px, transparent 50%), radial-gradient(at 79% 30%, hsla(151,61%,77%,1) 0px, transparent 50%), radial-gradient(at 26% 40%, hsla(36,65%,63%,1) 0px, transparent 50%); */
1616
}
1717

18+
pre code {
19+
display: grid; /* Ensure each line is treated as a block */
20+
}
21+
22+
pre {
23+
counter-reset: line; /* Initialize a counter for line numbers */
24+
}
25+
26+
.line::before {
27+
counter-increment: line; /* Increment the line counter */
28+
content: counter(line); /* Display the current line number */
29+
padding-inline: 1em;
30+
text-align: right;
31+
color: gray; /* Style the line numbers */
32+
font-size: 0.9em;
33+
position: absolute;
34+
left: -40px; /* Align line numbers to the left */
35+
}
36+
37+
.line {
38+
margin-left: 1.5rem;
39+
position: relative;
40+
width: 100%;
41+
display: inline-block;
42+
/* display: block; */
43+
/* padding-top: 1rem; */
44+
}
45+
1846
pre.shiki,
1947
pre.shiki span {
2048
line-height: var(--line-height);
@@ -43,7 +71,7 @@ pre.shiki {
4371
display: flex;
4472
flex-direction: column;
4573
.line {
46-
display: block;
74+
display: inline-block;
4775
}
4876
}
4977

@@ -66,7 +94,7 @@ pre.shiki {
6694
}
6795

6896
.selection {
69-
display: inline-block;
97+
/* display: inline-block; */
7098
border-right: 2px solid #00b;
7199
animation: blink 1400ms infinite;
72100
padding: 0px 0.5px 0px 0;
@@ -80,11 +108,16 @@ pre.shiki {
80108
}
81109
.decoration {
82110
display: inline-block;
83-
padding: 0px 0.5px 0px 0.5px;
84-
margin: 0 0px 0 -1px;
85-
height: var(--line-height);
86-
background: green;
111+
/* padding: 0px 0.5px 0px 0.5px; */
112+
/* margin: 0 0px 0 -1px; */
113+
/* height: var(--line-height); */
114+
/* width: 100%; */
115+
}
116+
117+
.full {
118+
width: 100%;
87119
}
120+
88121
.decoration.pendingDeleteBackground {
89122
background-color: #ff00008a;
90123
}
@@ -122,22 +155,22 @@ pre.shiki {
122155
display: inline-block;
123156
&::after {
124157
content: "";
125-
display: inline;
158+
/* display: inline; */
126159
/* top: 0px; */
127-
left: 50%;
160+
/* left: 50%; */
128161
position: absolute;
129-
transform: translate(-50%, -100%);
130-
background-color: grey;
162+
transform: translate(-110%, -50%);
163+
background-color: #b8b6cd;
131164
mask-repeat: no-repeat;
132-
width: 10px;
133-
height: 10px;
165+
width: 0.5rem;
166+
height: 0.5rem;
134167
}
135168
}
136169
.hat.default::after {
137170
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 308.34 254.24"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><ellipse class="cls-1" cx="154.17" cy="127.12" rx="154.17" ry="127.12"/></g></g></svg>');
138-
top: -0.4px;
139-
width: 7px;
140-
height: 7px;
171+
top: 0.2rem;
172+
width: 0.5rem;
173+
height: 0.5rem;
141174
}
142175
.hat.wing::after {
143176
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 371.81 234.76" ><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M371.81,234.42h0s-153.27-57.29-185.9-54.08h0C154.36,177.24,0,234.76,0,234.76H0L158.55,101.69c.6-.49-.39,1.87-.23,1.12L186.24,0h0l26.84,101.37"/></g></g></svg>');

0 commit comments

Comments
 (0)