Skip to content

feat: enhance code block & code group #3235

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import llmstxt from 'vitepress-plugin-llms'
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 @@ -757,6 +758,7 @@ export default defineConfigWithTheme<ThemeConfig>({
theme: 'github-dark',
config(md) {
md.use(headerPlugin)
.use(groupIconMdPlugin)
// .use(textAdPlugin)
}
},
Expand Down Expand Up @@ -808,6 +810,12 @@ Vue.js - The Progressive JavaScript Framework
## Table of Contents

{toc}`
}) as Plugin,
groupIconVitePlugin({
customIcon: {
cypress: 'vscode-icons:file-type-cypress',
'testing library': 'logos:testing-library'
}
}) as Plugin
]
}
Expand Down
2 changes: 2 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
import SponsorsAside from './components/SponsorsAside.vue'
import VueSchoolLink from './components/VueSchoolLink.vue'
import Banner from './components/Banner.vue'
import 'vitepress/dist/client/theme-default/styles/components/vp-code-group.css'
import 'virtual:group-icons.css'
// import TextAd from './components/TextAd.vue'

export default Object.assign({}, VPTheme, {
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 @@ -23,6 +23,7 @@
"@types/markdown-it": "^14.1.2",
"@types/node": "^22.7.5",
"typescript": "^5.6.3",
"vitepress-plugin-group-icons": "^1.5.4",
"vitepress-plugin-llms": "^0.0.8",
"vue-tsc": "^2.1.6"
},
Expand Down
Loading