Skip to content

feat: enhance code block & code group #2594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import fs from 'fs'
import path from 'path'
import { defineConfigWithTheme, type HeadConfig } from 'vitepress'
import type { Config as ThemeConfig } from '@vue/theme'

import baseConfig from '@vue/theme/config'
import { headerPlugin } from './headerMdPlugin'
// import { textAdPlugin } from './textAdMdPlugin'
import { groupIconMdPlugin,groupIconVitePlugin } from 'vitepress-plugin-group-icons'

const nav: ThemeConfig['nav'] = [
{
Expand Down Expand Up @@ -790,6 +792,7 @@ export default defineConfigWithTheme<ThemeConfig>({
theme: 'github-dark',
config(md) {
md.use(headerPlugin)
.use(groupIconMdPlugin)
// .use(textAdPlugin)
}
},
Expand Down Expand Up @@ -818,6 +821,14 @@ export default defineConfigWithTheme<ThemeConfig>({
},
json: {
stringify: true
}
},
plugins: [
groupIconVitePlugin({
customIcon: {
cypress: 'vscode-icons:file-type-cypress',
'testing library': 'logos:testing-library'
}
}) as Plugin
]
}
})
3 changes: 3 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import ScrimbaLink from './components/ScrimbaLink.vue'
// import Banner from './components/Banner.vue'
// import TextAd from './components/TextAd.vue'

import 'vitepress/dist/client/theme-default/styles/components/vp-code-group.css'
import 'virtual:group-icons.css'

export default Object.assign({}, VPTheme, {
Layout: () => {
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletions .vitepress/theme/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@import "./inline-demo.css";
@import "./utilities.css";
@import "./style-guide.css";
@import "./vars.css";
16 changes: 16 additions & 0 deletions .vitepress/theme/styles/vars.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
:root {
--vp-code-tab-active-bar-color: var(--vt-c-green);
--vp-code-tab-active-text-color: var(--vt-c-text-inverse-1);
--vp-code-tab-text-color: var(--vt-c-text-inverse-2);
--vp-code-tab-hover-text-color: var(--vt-c-text-inverse-1);
--vp-code-tab-bg: #292d3ef0;
--vp-code-block-bg: #292d3ef0;
}

.dark {
--vp-code-tab-text-color: var(--vt-c-text-2);
--vp-code-tab-hover-text-color: var(--vt-c-text-1);
--vp-code-tab-active-text-color: var(--vt-c-text-1);
--vp-code-tab-bg: var(--vt-c-black-mute);
--vp-code-block-bg: var(--vt-c-black-mute);
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"textlint-filter-rule-comments": "^1.2.2",
"textlint-rule-preset-vuejs-jp": "github:vuejs-jp/textlint-rule-preset-vuejs-jp",
"typescript": "^5.6.3",
"vitepress-plugin-group-icons": "^1.5.4",
"vue-tsc": "^2.1.6"
},
"gitHooks": {
Expand Down
Loading