Skip to content

Commit 7d156d7

Browse files
authored
fix(theme-default): fix code block misalignment (close #901) (#1185)
1 parent 5fac2e6 commit 7d156d7

File tree

1 file changed

+8
-4
lines changed
  • ecosystem/theme-default/src/client/styles

1 file changed

+8
-4
lines changed

ecosystem/theme-default/src/client/styles/code.scss

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
@import '_variables';
22

3+
// Safari only support integer pixel value for line-height
4+
// the original font-size is 16px, 1.375 will make line-height be 22px
5+
$line-height: 1.375;
6+
37
// ===============================
48
// Forked and modified from prismjs/themes/prism-tomorrow.css
59

@@ -124,7 +128,7 @@ pre[class*='language-'] {
124128
.theme-default-content {
125129
pre,
126130
pre[class*='language-'] {
127-
line-height: 1.4;
131+
line-height: $line-height;
128132
padding: 1.3rem 1.5rem;
129133
margin: 0.85rem 0;
130134
border-radius: 6px;
@@ -176,7 +180,7 @@ div[class*='language-'] {
176180
top: 0;
177181
left: 0;
178182
width: 100%;
179-
line-height: 1.4;
183+
line-height: $line-height;
180184

181185
.highlight-line {
182186
background-color: var(--code-hl-bg-color);
@@ -218,14 +222,14 @@ div[class*='language-'] {
218222
text-align: center;
219223
color: var(--code-ln-color);
220224
padding-top: 1.25rem;
221-
line-height: 1.4;
225+
line-height: $line-height;
222226
counter-reset: line-number;
223227

224228
.line-number {
225229
position: relative;
226230
z-index: 3;
227231
user-select: none;
228-
height: 1.4em;
232+
height: #{$line-height}em;
229233

230234
&::before {
231235
counter-increment: line-number;

0 commit comments

Comments
 (0)