mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
feat: support light/dark theme in code blocks (#327)
Update Astro and its related dependencies. Support light/dark theme in code-blocks.
This commit is contained in:
+2
-1
@@ -27,7 +27,8 @@ export default defineConfig({
|
||||
],
|
||||
],
|
||||
shikiConfig: {
|
||||
theme: "one-dark-pro",
|
||||
// For more themes, visit https://shiki.style/themes
|
||||
themes: { light: "min-light", dark: "night-owl" },
|
||||
wrap: true,
|
||||
},
|
||||
},
|
||||
|
||||
Generated
+1512
-1636
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -16,10 +16,10 @@
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.4.1",
|
||||
"@astrojs/rss": "^4.0.2",
|
||||
"@astrojs/check": "^0.8.2",
|
||||
"@astrojs/rss": "^4.0.7",
|
||||
"@resvg/resvg-js": "^2.6.0",
|
||||
"astro": "^4.2.1",
|
||||
"astro": "^4.12.2",
|
||||
"fuse.js": "^7.0.0",
|
||||
"github-slugger": "^2.0.0",
|
||||
"remark-collapse": "^0.1.2",
|
||||
@@ -29,8 +29,8 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/react": "^3.0.9",
|
||||
"@astrojs/sitemap": "^3.0.5",
|
||||
"@astrojs/react": "^3.6.0",
|
||||
"@astrojs/sitemap": "^3.1.6",
|
||||
"@astrojs/tailwind": "^5.1.0",
|
||||
"@divriots/jampack": "^0.23.2",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
|
||||
@@ -115,6 +115,10 @@
|
||||
@apply bg-skin-card-muted;
|
||||
}
|
||||
|
||||
/* ===== Code Blocks & Syntax Highlighting ===== */
|
||||
pre:has(code) {
|
||||
@apply border border-skin-line;
|
||||
}
|
||||
code,
|
||||
blockquote {
|
||||
word-wrap: break-word;
|
||||
@@ -123,6 +127,16 @@
|
||||
pre > code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
/* Apply Dark Theme (if multi-theme specified) */
|
||||
html[data-theme="dark"] pre:has(code),
|
||||
html[data-theme="dark"] pre:has(code) span {
|
||||
color: var(--shiki-dark) !important;
|
||||
background-color: var(--shiki-dark-bg) !important;
|
||||
font-style: var(--shiki-dark-font-style) !important;
|
||||
font-weight: var(--shiki-dark-font-weight) !important;
|
||||
text-decoration: var(--shiki-dark-text-decoration) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
|
||||
Reference in New Issue
Block a user