Skip to content

Commit 23fdc2b

Browse files
committed
修复 expressive-code 折叠效果和 details 样式冲突问题
1 parent 9254ff9 commit 23fdc2b

7 files changed

Lines changed: 31 additions & 75 deletions

File tree

‎bun.lock‎

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"astro": "5.5.3",
3232
"astro-expressive-code": "^0.41.3",
3333
"astro-icon": "^1.1.5",
34-
"astro-pure": "1.3.2",
34+
"astro-pure": "1.3.1",
3535
"font-carrier": "^0.3.1",
3636
"katex": "^0.16.22",
3737
"rehype-katex": "^7.0.1",

‎packages/pure/bun.lock‎

Lines changed: 9 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/pure/index.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import type { AstroIntegration, RehypePlugins, RemarkPlugins } from 'astro'
66
// Integrations
77
import mdx from '@astrojs/mdx'
88
import sitemap from '@astrojs/sitemap'
9+
import rehypeExternalLinks from 'rehype-external-links'
910
import UnoCSS from 'unocss/astro'
10-
11-
import rehypeExternalLinks from './plugins/rehype-external-links'
1211
import rehypeTable from './plugins/rehype-table'
12+
1313
import { remarkAddZoomable, remarkReadingTime } from './plugins/remark-plugins'
1414
import { vitePluginUserConfig } from './plugins/virtual-user-config'
1515
import { UserConfigSchema, type UserInputConfig } from './types/user-config'

‎packages/pure/package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "astro-pure",
3-
"version": "1.3.2",
3+
"version": "1.3.1",
44
"description": "A simple, clean but powerful blog theme build by astro.",
55
"type": "module",
66
"author": "CWorld",
@@ -35,14 +35,14 @@
3535
"./libs": "./libs/index.ts"
3636
},
3737
"dependencies": {
38-
"@astrojs/mdx": "^4.3.1",
39-
"@astrojs/sitemap": "^3.4.1",
38+
"@astrojs/mdx": "^4.3.0",
39+
"@astrojs/sitemap": "^3.4.0",
4040
"@pagefind/default-ui": "^1.3.0",
41-
"@unocss/reset": "^66.3.3",
42-
"astro": "^5.12.0",
41+
"astro": "^5.8.1",
4342
"hast-util-select": "^6.0.4",
4443
"node-html-parser": "^7.0.1",
4544
"pagefind": "^1.3.0",
46-
"unocss": "^66.3.3"
45+
"rehype-external-links": "^3.0.0",
46+
"unocss": "^66.1.3"
4747
}
4848
}

‎src/assets/styles/app.css‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -80,64 +80,7 @@ a {
8080
}
8181

8282
/* Details/Summary Styles */
83-
details {
84-
border-radius: 8px;
85-
margin: 1rem 0;
86-
padding: 1rem;
87-
border: 1px solid hsl(var(--border));
88-
background-color: hsl(var(--muted) / var(--un-bg-opacity, 1)) !important;
89-
transition: background-color 0.2s ease, border-color 0.2s ease;
90-
}
9183

92-
details summary {
93-
font-weight: 700;
94-
margin: 0;
95-
display: flex;
96-
align-items: center;
97-
gap: 0.5rem;
98-
cursor: pointer;
99-
list-style: none;
100-
color: hsl(var(--foreground));
101-
transition: color 0.2s ease;
102-
}
103-
104-
details summary::-webkit-details-marker {
105-
display: none;
106-
}
107-
108-
details summary::before {
109-
content: ''; /* No character content */
110-
display: inline-block;
111-
width: 1em; /* Adjust size as needed */
112-
height: 1em; /* Adjust size as needed */
113-
margin-right: 0.5rem;
114-
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='hsl(240 10% 3.9%)' d='m8.177.677 2.896 2.896a.25.25 0 0 1-.177.427H8.75v1.25a.75.75 0 0 1-1.5 0V4H5.104a.25.25 0 0 1-.177-.427L7.823.677a.25.25 0 0 1 .354 0ZM7.25 10.75a.75.75 0 0 1 1.5 0V12h2.146a.25.25 0 0 1 .177.427l-2.896 2.896a.25.25 0 0 1-.354 0l-2.896-2.896A.25.25 0 0 1 5.104 12H7.25v-1.25Zm-5-2a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM6 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 6 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM12 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 12 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5Z'/></svg>");
115-
background-repeat: no-repeat;
116-
background-position: center;
117-
background-size: contain;
118-
transition: background-image 0.2s ease;
119-
}
120-
121-
html.dark details summary::before {
122-
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='hsl(0 0% 98%)' d='m8.177.677 2.896 2.896a.25.25 0 0 1-.177.427H8.75v1.25a.75.75 0 0 1-1.5 0V4H5.104a.25.25 0 0 1-.177-.427L7.823.677a.25.25 0 0 1 .354 0ZM7.25 10.75a.75.75 0 0 1 1.5 0V12h2.146a.25.25 0 0 1 .177.427l-2.896 2.896a.25.25 0 0 1-.354 0l-2.896-2.896A.25.25 0 0 1 5.104 12H7.25v-1.25Zm-5-2a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM6 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 6 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM12 8a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5A.75.75 0 0 1 12 8Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5Z'/></svg>");
123-
}
124-
125-
126-
details[open] summary::before {
127-
transform: none;
128-
}
129-
130-
details .details-content {
131-
margin-top: 1rem;
132-
color: hsl(var(--muted-foreground));
133-
}
134-
135-
details .details-content > :first-child {
136-
margin-top: 0;
137-
}
138-
details .details-content > :last-child {
139-
margin-bottom: 0;
140-
}
14184

14285
/* inline code css*/
14386
.prose :where(:not(pre) > code):not(:where(.not-prose, .not-prose *)) {

‎src/assets/styles/expressive-code.css‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,11 @@
2727
.expressive-code .frame.has-title:not(.is-terminal) .title {
2828
/* copy from expressive border css*/
2929
border-bottom: var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol) !important;
30+
}
31+
32+
/* 修复 details 样式冲突, 未知 css 来源 */
33+
.prose :where(details):not(:where(.not-prose, .not-prose *)) {
34+
margin: 0 !important;
35+
padding: 0 !important;
36+
/* background: var(--un-prose-bg-soft);*/
3037
}

0 commit comments

Comments
 (0)