Skip to content

Commit 23fdc2b

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

File tree

7 files changed

+31
-75
lines changed

7 files changed

+31
-75
lines changed

bun.lock

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"astro": "5.5.3",
1818
"astro-expressive-code": "^0.41.3",
1919
"astro-icon": "^1.1.5",
20-
"astro-pure": "1.3.2",
20+
"astro-pure": "1.3.1",
2121
"font-carrier": "^0.3.1",
2222
"katex": "^0.16.22",
2323
"rehype-katex": "^7.0.1",
@@ -586,7 +586,7 @@
586586

587587
"astro-icon": ["[email protected]", "", { "dependencies": { "@iconify/tools": "^4.0.5", "@iconify/types": "^2.0.0", "@iconify/utils": "^2.1.30" } }, "sha512-CJYS5nWOw9jz4RpGWmzNQY7D0y2ZZacH7atL2K9DeJXJVaz7/5WrxeyIxO8KASk1jCM96Q4LjRx/F3R+InjJrw=="],
588588

589-
"astro-pure": ["[email protected].2", "", { "dependencies": { "@astrojs/mdx": "^4.3.0", "@astrojs/sitemap": "^3.4.1", "@pagefind/default-ui": "^1.3.0", "@unocss/reset": "^66.3.3", "astro": "^5.11.1", "hast-util-select": "^6.0.4", "node-html-parser": "^7.0.1", "pagefind": "^1.3.0", "unocss": "^66.3.3" }, "bin": { "astro-pure": "scripts/index.js" } }, "sha512-yfBxaT1Xmzt1g+VXAV5e8cC6QVXgiTiFVIyyAWmsXQ14riVhlpWVA6JB117+7mjs476J65poKb6grRJSgA3biw=="],
589+
"astro-pure": ["[email protected].1", "", { "dependencies": { "@astrojs/mdx": "^4.3.0", "@astrojs/sitemap": "^3.4.0", "@pagefind/default-ui": "^1.3.0", "astro": "^5.8.1", "hast-util-select": "^6.0.4", "node-html-parser": "^7.0.1", "pagefind": "^1.3.0", "rehype-external-links": "^3.0.0", "unocss": "^66.1.3" }, "bin": { "astro-pure": "scripts/index.js" } }, "sha512-0edjNNQyWZwLp5qCC1gACBKdelTGWh02tNsFLewWT0qgxhb7pth8JsZj0yNYp6BwSGRqsmJ978MBh42BJxZelw=="],
590590

591591
"astrojs-compiler-sync": ["[email protected]", "", { "dependencies": { "synckit": "^0.11.0" }, "peerDependencies": { "@astrojs/compiler": ">=0.27.0" } }, "sha512-0mKvB9sDQRIZPsEJadw6OaFbGJ92cJPPR++ICca9XEyiUAZqgVuk25jNmzHPT0KF80rI94trSZrUR5iHFXGGOQ=="],
592592

@@ -1038,6 +1038,8 @@
10381038

10391039
"iron-webcrypto": ["[email protected]", "", {}, "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg=="],
10401040

1041+
"is-absolute-url": ["[email protected]", "", {}, "sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A=="],
1042+
10411043
"is-alphabetical": ["[email protected]", "", {}, "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ=="],
10421044

10431045
"is-alphanumerical": ["[email protected]", "", { "dependencies": { "is-alphabetical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw=="],
@@ -1470,6 +1472,8 @@
14701472

14711473
"rehype-expressive-code": ["[email protected]", "", { "dependencies": { "expressive-code": "^0.41.3" } }, "sha512-8d9Py4c/V6I/Od2VIXFAdpiO2kc0SV2qTJsRAaqSIcM9aruW4ASLNe2kOEo1inXAAkIhpFzAHTc358HKbvpNUg=="],
14721474

1475+
"rehype-external-links": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-is-element": "^3.0.0", "is-absolute-url": "^4.0.0", "space-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw=="],
1476+
14731477
"rehype-katex": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/katex": "^0.16.0", "hast-util-from-html-isomorphic": "^2.0.0", "hast-util-to-text": "^4.0.0", "katex": "^0.16.0", "unist-util-visit-parents": "^6.0.0", "vfile": "^6.0.0" } }, "sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA=="],
14741478

14751479
"rehype-parse": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-html": "^2.0.0", "unified": "^11.0.0" } }, "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag=="],
@@ -1944,8 +1948,6 @@
19441948

19451949
"astro/sharp": ["[email protected]", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="],
19461950

1947-
"astro-pure/@unocss/reset": ["@unocss/[email protected]", "", {}, "sha512-f0t2YIRF7uVUwEB0aDR6yPMqBO+QgGdgACWQmCrZ84Kir9HV+5d50tK5tXDflHmFTu9mqS9MUG4Ba3sPp44vZw=="],
1948-
19491951
"astro-pure/astro": ["[email protected]", "", { "dependencies": { "@astrojs/compiler": "^2.12.2", "@astrojs/internal-helpers": "0.7.1", "@astrojs/markdown-remark": "6.3.5", "@astrojs/telemetry": "3.3.0", "@capsizecss/unpack": "^2.4.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.1.4", "acorn": "^8.14.1", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "boxen": "8.0.1", "ci-info": "^4.2.0", "clsx": "^2.1.1", "common-ancestor-path": "^1.0.1", "cookie": "^1.0.2", "cssesc": "^3.0.0", "debug": "^4.4.0", "deterministic-object-hash": "^2.0.2", "devalue": "^5.1.1", "diff": "^5.2.0", "dlv": "^1.1.3", "dset": "^3.1.4", "es-module-lexer": "^1.6.0", "esbuild": "^0.25.0", "estree-walker": "^3.0.3", "flattie": "^1.1.1", "fontace": "~0.3.0", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.1.1", "import-meta-resolve": "^4.1.0", "js-yaml": "^4.1.0", "kleur": "^4.1.5", "magic-string": "^0.30.17", "magicast": "^0.3.5", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", "p-limit": "^6.2.0", "p-queue": "^8.1.0", "package-manager-detector": "^1.1.0", "picomatch": "^4.0.2", "prompts": "^2.4.2", "rehype": "^13.0.2", "semver": "^7.7.1", "shiki": "^3.2.1", "smol-toml": "^1.3.4", "tinyexec": "^0.3.2", "tinyglobby": "^0.2.12", "tsconfck": "^3.1.5", "ultrahtml": "^1.6.0", "unifont": "~0.5.0", "unist-util-visit": "^5.0.0", "unstorage": "^1.15.0", "vfile": "^6.0.3", "vite": "^6.3.4", "vitefu": "^1.0.6", "xxhash-wasm": "^1.1.0", "yargs-parser": "^21.1.1", "yocto-spinner": "^0.2.1", "zod": "^3.24.4", "zod-to-json-schema": "^3.24.5", "zod-to-ts": "^1.2.0" }, "optionalDependencies": { "sharp": "^0.33.3" }, "bin": { "astro": "astro.js" } }, "sha512-KkJ7FR+c2SyZYlpakm48XBiuQcRsrVtdjG5LN5an0givI/tLik+ePJ4/g3qrAVhYMjJOxBA2YgFQxANPiWB+Mw=="],
19501952

19511953
"boxen/chalk": ["[email protected]", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="],

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
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"": {
55
"name": "astro-pure",
66
"dependencies": {
7-
"@astrojs/mdx": "^4.3.1",
8-
"@astrojs/sitemap": "^3.4.1",
7+
"@astrojs/mdx": "^4.3.0",
8+
"@astrojs/sitemap": "^3.4.0",
99
"@pagefind/default-ui": "^1.3.0",
10-
"@unocss/reset": "^66.3.3",
11-
"astro": "^5.12.0",
10+
"astro": "^5.8.1",
1211
"hast-util-select": "^6.0.4",
1312
"node-html-parser": "^7.0.1",
1413
"pagefind": "^1.3.0",
15-
"unocss": "^66.3.3",
14+
"rehype-external-links": "^3.0.0",
15+
"unocss": "^66.1.3",
1616
},
1717
},
1818
},
@@ -567,6 +567,8 @@
567567

568568
"iron-webcrypto": ["[email protected]", "https://registry.npmmirror.com/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz", {}, "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg=="],
569569

570+
"is-absolute-url": ["[email protected]", "", {}, "sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A=="],
571+
570572
"is-alphabetical": ["[email protected]", "https://registry.npmmirror.com/is-alphabetical/-/is-alphabetical-2.0.1.tgz", {}, "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ=="],
571573

572574
"is-alphanumerical": ["[email protected]", "https://registry.npmmirror.com/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", { "dependencies": { "is-alphabetical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw=="],
@@ -817,6 +819,8 @@
817819

818820
"rehype": ["[email protected]", "https://registry.npmmirror.com/rehype/-/rehype-13.0.2.tgz", { "dependencies": { "@types/hast": "^3.0.0", "rehype-parse": "^9.0.0", "rehype-stringify": "^10.0.0", "unified": "^11.0.0" } }, "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A=="],
819821

822+
"rehype-external-links": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-is-element": "^3.0.0", "is-absolute-url": "^4.0.0", "space-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw=="],
823+
820824
"rehype-parse": ["[email protected]", "https://registry.npmmirror.com/rehype-parse/-/rehype-parse-9.0.1.tgz", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-html": "^2.0.0", "unified": "^11.0.0" } }, "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag=="],
821825

822826
"rehype-raw": ["[email protected]", "https://registry.npmmirror.com/rehype-raw/-/rehype-raw-7.0.0.tgz", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-raw": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww=="],

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)