Features
💡 Fill Icons
Automatically fill the missing product icons for code groups.
Input
md
::: code-group
```sh [npm]
npm install vitepress-plugin-group-icons
```
```sh [yarn]
yarn add vitepress-plugin-group-icons
```
```sh [pnpm]
pnpm add vitepress-plugin-group-icons
```
```sh [bun]
bun add vitepress-plugin-group-icons
```
:::
Output
sh
npm install vitepress-plugin-group-icons
sh
yarn add vitepress-plugin-group-icons
sh
pnpm add vitepress-plugin-group-icons
sh
bun add vitepress-plugin-group-icons
🪧 Title Bar
Add a title bar with icon and name for code blocks.
Input
```js [vite.config.js]
import legacy from '@vitejs/plugin-legacy'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
})
```
Output
js
import legacy from '@vitejs/plugin-legacy'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
})
Includes Code Snippets
If you also want to add title bar for Code Snippets :
ts
export default defineConfig({
markdown: {
config(md) {
md.use(groupIconMdPlugin, {
titleBar: { includeSnippet: true },
})
},
},
})
Built-in Icons
Package Managers
Frameworks
Bundlers
Configuration Files
Filename Extension
Icon mapping
ts
export const builtinIcons = {
// package managers
'pnpm': 'vscode-icons:file-type-light-pnpm',
'npm': 'vscode-icons:file-type-npm',
'yarn': 'vscode-icons:file-type-yarn',
'bun': 'vscode-icons:file-type-bun',
'deno': 'vscode-icons:file-type-light-deno',
// frameworks
'vue': 'vscode-icons:file-type-vue',
'svelte': 'vscode-icons:file-type-svelte',
'angular': 'vscode-icons:file-type-angular',
'react': 'vscode-icons:file-type-reactjs',
'next': 'vscode-icons:file-type-light-next',
'nuxt': 'vscode-icons:file-type-nuxt',
'solid': 'logos:solidjs-icon',
'astro': 'vscode-icons:file-type-light-astro',
// bundlers
'rollup': 'vscode-icons:file-type-rollup',
'webpack': 'vscode-icons:file-type-webpack',
'vite': 'vscode-icons:file-type-vite',
'esbuild': 'vscode-icons:file-type-esbuild',
// configuration files
'package.json': 'vscode-icons:file-type-node',
'tsconfig.json': 'vscode-icons:file-type-tsconfig',
'.npmrc': 'vscode-icons:file-type-npm',
'.editorconfig': 'vscode-icons:file-type-editorconfig',
'.eslintrc': 'vscode-icons:file-type-eslint',
'.eslintignore': 'vscode-icons:file-type-eslint',
'eslint.config': 'vscode-icons:file-type-eslint',
'.gitignore': 'vscode-icons:file-type-git',
'.gitattributes': 'vscode-icons:file-type-git',
'.env': 'vscode-icons:file-type-dotenv',
'.env.example': 'vscode-icons:file-type-dotenv',
'.vscode': 'vscode-icons:file-type-vscode',
'tailwind.config': 'vscode-icons:file-type-tailwind',
'uno.config': 'vscode-icons:file-type-unocss',
// filename extensions
'.ts': 'vscode-icons:file-type-typescript',
'.tsx': 'vscode-icons:file-type-typescript',
'.mjs': 'vscode-icons:file-type-js',
'.cjs': 'vscode-icons:file-type-js',
'.json': 'vscode-icons:file-type-json',
'.js': 'vscode-icons:file-type-js',
'.jsx': 'vscode-icons:file-type-js',
'.md': 'vscode-icons:file-type-markdown',
'.py': 'vscode-icons:file-type-python',
'.ico': 'vscode-icons:file-type-favicon',
'.html': 'vscode-icons:file-type-html',
'.css': 'vscode-icons:file-type-css',
'.yml': 'vscode-icons:file-type-light-yaml',
'.yaml': 'vscode-icons:file-type-light-yaml',
}
Custom Icons
You can add any icons from iconify or local svg file.
ts
import { defineConfig } from 'vitepress'
import { groupIconMdPlugin, groupIconVitePlugin, localIconLoader } from 'vitepress-plugin-group-icons'
export default defineConfig({
markdown: {
config(md) {
md.use(groupIconMdPlugin)
},
},
vite: {
plugins: [
groupIconVitePlugin({
customIcon: {
'.mdx': 'vscode-icons:file-type-light-mdx',
'babel': 'vscode-icons:file-type-babel',
'vitepress': localIconLoader(import.meta.url, '../assets/vitepress.svg'),
'oxc': 'https://cdn.jsdelivr.net/gh/oxc-project/oxc-assets/round.svg',
},
})
],
}
})