Skip to content

Commit 70fce9a

Browse files
committed
调整 quote和行内代码块的样式
1 parent 80a9613 commit 70fce9a

2 files changed

Lines changed: 44 additions & 20 deletions

File tree

src/assets/styles/app.css

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,34 @@ starlight-tabs {
8282
margin-top: .5em;
8383
}
8484

85-
/* inline code css , config font in uno.config.ts*/
85+
/* Inline code styles */
8686
.prose :where(:not(pre) > code):not(:where(.not-prose, .not-prose *)) {
87-
border-radius: .25rem;
88-
padding: .15rem;
89-
--un-bg-opacity: .13;
90-
background-color: hsl(var(--foreground) / var(--un-bg-opacity)) !important;
87+
font-size: 0.9em !important;
88+
font-weight: 500 !important;
89+
border-radius: 0.25rem !important;
90+
padding: 0.1rem 0.35rem !important;
91+
border: 1px solid hsl(var(--border)) !important;
92+
background-color: hsl(45 25% 92%) !important;
93+
background-image:
94+
repeating-linear-gradient(45deg, transparent, transparent 2px, hsl(45 20% 88%) 2px, hsl(45 20% 88%) 4px),
95+
repeating-linear-gradient(-45deg, transparent, transparent 2px, hsl(45 20% 88%) 2px, hsl(45 20% 88%) 4px) !important;
9196
color: hsl(var(--foreground)) !important;
97+
display: inline-block !important;
98+
box-decoration-break: clone !important;
99+
-webkit-box-decoration-break: clone !important;
100+
line-height: 1.6 !important;
92101
&::before, &::after {
93102
content: '' !important;
94103
}
95104
}
96105

97106
html.dark .prose :where(:not(pre) > code):not(:where(.not-prose, .not-prose *)) {
98-
background-color: rgba(220, 220, 220, 0.13) !important;
99-
color: #f8fafc;
107+
border-color: hsl(var(--border)) !important;
108+
background-color: hsl(30 15% 18%) !important;
109+
background-image:
110+
repeating-linear-gradient(45deg, transparent, transparent 2px, hsl(30 12% 22%) 2px, hsl(30 12% 22%) 4px),
111+
repeating-linear-gradient(-45deg, transparent, transparent 2px, hsl(30 12% 22%) 2px, hsl(30 12% 22%) 4px) !important;
112+
color: hsl(var(--foreground)) !important;
100113
}
101114

102115
/* Reading progress bar using modern CSS scroll-driven animations */

uno.config.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ const bgMuted = 'hsl(var(--muted) / var(--un-bg-opacity, 1))'
66

77
const typographyConfig = {
88
cssExtend: {
9-
// 覆盖 UnoCSS reset 中的默认 monospace 字体
9+
// Code styles
1010
'code, kbd, samp, pre': {
11-
'font-family': '"Noto Serif CJK", "Input Mono", "Fira Code", "Consolas", "Monaco", monospace',
11+
'font-family': '"Noto Serif CJK", "Input Mono", "Fira Code", "Consolas", "Monaco", monospace'
12+
},
13+
'pre code': {
1214
'font-size': '1.015em',
1315
'font-weight': '600'
1416
},
17+
'code:not(pre code)': {
18+
// 解决 inline code 在长单词时换行的问题
19+
'word-break': 'break-all!important'
20+
},
1521
details: {
1622
margin: '0',
1723
padding: '0'
@@ -40,24 +46,29 @@ const typographyConfig = {
4046
// Blockquote
4147
blockquote: {
4248
position: 'relative',
43-
overflow: 'hidden',
49+
overflow: 'visible',
4450
'border-width': '1px',
4551
'border-left': 'inherit',
4652
'border-radius': 'var(--radius)',
4753
'padding-inline': '1.6rem',
48-
'box-shadow': '0 5px 0 ' + bgMuted
54+
'font-style': 'normal'
4955
},
50-
'blockquote::after': {
56+
'blockquote::before': {
5157
color: fgMuted,
5258
position: 'absolute',
53-
content: '"”"',
54-
top: '2.6rem',
55-
right: '-1.4rem',
56-
'font-size': '10rem',
57-
'font-family':
58-
'"Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif',
59-
transform: 'rotate(-15deg)',
60-
opacity: '0.1'
59+
content: '"\\201C"',
60+
top: '0',
61+
left: '0.5rem',
62+
'font-size': '4rem',
63+
'font-family': 'serif',
64+
'line-height': '1',
65+
opacity: '0.3',
66+
'pointer-events': 'none',
67+
'z-index': '0'
68+
},
69+
'blockquote p': {
70+
position: 'relative',
71+
'z-index': '1'
6172
},
6273
// Table
6374
table: {

0 commit comments

Comments
 (0)