Skip to content

Commit c55865f

Browse files
authored
docs: add vitepress-plugin-group-icons (#904)
1 parent 498713c commit c55865f

14 files changed

+188
-16
lines changed

docs/.vitepress/config.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import type { DefaultTheme } from 'vitepress'
22
import { bundledThemes } from 'shiki'
33
import { defineConfig } from 'vitepress'
4-
import { withMermaid } from 'vitepress-plugin-mermaid'
4+
import { groupIconMdPlugin } from 'vitepress-plugin-group-icons'
55

6+
import { withMermaid } from 'vitepress-plugin-mermaid'
67
import { version } from '../../package.json'
78
import { transformerColorizedBrackets } from '../../packages/colorized-brackets/src'
89
import { transformerMetaWordHighlight, transformerNotationWordHighlight, transformerRemoveNotationEscape } from '../../packages/transformers/src'
@@ -144,6 +145,9 @@ export default withMermaid(defineConfig({
144145
],
145146
// @ts-expect-error Waits for https://github.com/vuejs/vitepress/pull/4507
146147
languages: ['js', 'jsx', 'ts', 'tsx'],
148+
config: (md) => {
149+
md.use(groupIconMdPlugin)
150+
},
147151
},
148152

149153
cleanUrls: true,

docs/.vitepress/theme/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import '../../../packages/vitepress-twoslash/src/style.css'
1111
import 'uno.css'
1212
import './style.css'
1313
import './transformers.css'
14+
import 'virtual:group-icons.css'
1415

1516
// @unocss-include
1617

docs/.vitepress/vite.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import UnoCSS from 'unocss/vite'
33
import Components from 'unplugin-vue-components/vite'
44
import { defineConfig } from 'vite'
55
import Tsconfig from 'vite-tsconfig-paths'
6+
import { groupIconVitePlugin as GroupIconVitePlugin } from 'vitepress-plugin-group-icons'
67

78
export default defineConfig({
89
plugins: [
@@ -22,5 +23,10 @@ export default defineConfig({
2223
UnoCSS(
2324
fileURLToPath(new URL('./uno.config.ts', import.meta.url)),
2425
),
26+
GroupIconVitePlugin({
27+
customIcon: {
28+
vitepress: 'https://vitepress.dev/vitepress-logo-mini.svg',
29+
},
30+
}),
2531
],
2632
})

docs/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"unocss": "catalog:",
2020
"unplugin-vue-components": "catalog:",
2121
"vitepress": "catalog:",
22+
"vitepress-plugin-group-icons": "catalog:",
2223
"vue": "catalog:"
2324
}
2425
}

docs/packages/cli.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,27 @@ npx @shikijs/cli README.md
1616

1717
You can also install it globally. Command aliases `@shikijs/cli`, `shiki`, `skat` are registered.
1818

19-
```bash
19+
::: code-group
20+
21+
```sh [npm]
2022
npm i -g @shikijs/cli
23+
```
24+
25+
```sh [yarn]
26+
yarn global add @shikijs/cli
27+
```
28+
29+
```sh [pnpm]
30+
pnpm add -g @shikijs/cli
31+
```
32+
33+
```sh [bun]
34+
bun add -g @shikijs/cli
35+
```
36+
37+
:::
2138

39+
```sh
2240
skat src/index.ts
2341
```
2442

docs/packages/colorized-brackets.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ VSCode-style colorized brackets transformer for Shiki.
1010

1111
## Install
1212

13-
```bash
13+
::: code-group
14+
15+
```sh [npm]
1416
npm i -D @shikijs/colorized-brackets
1517
```
1618

19+
```sh [yarn]
20+
yarn add -D @shikijs/colorized-brackets
21+
```
22+
23+
```sh [pnpm]
24+
pnpm add -D @shikijs/colorized-brackets
25+
```
26+
27+
```sh [bun]
28+
bun add -D @shikijs/colorized-brackets
29+
```
30+
31+
:::
32+
1733
## Usage
1834

1935
Add to your Shiki transformers:

docs/packages/markdown-it.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,26 @@
66

77
## Install
88

9-
```bash
9+
::: code-group
10+
11+
```sh [npm]
1012
npm i -D @shikijs/markdown-it
1113
```
1214

15+
```sh [yarn]
16+
yarn add -D @shikijs/markdown-it
17+
```
18+
19+
```sh [pnpm]
20+
pnpm add -D @shikijs/markdown-it
21+
```
22+
23+
```sh [bun]
24+
bun add -D @shikijs/markdown-it
25+
```
26+
27+
:::
28+
1329
## Usage
1430

1531
```ts twoslash

docs/packages/monaco.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ Heavily inspired by [`monaco-editor-textmate`](https://github.com/zikaari/monaco
1010

1111
## Install
1212

13-
```bash
13+
::: code-group
14+
15+
```sh [npm]
1416
npm i -D @shikijs/monaco
1517
```
1618

19+
```sh [yarn]
20+
yarn add -D @shikijs/monaco
21+
```
22+
23+
```sh [pnpm]
24+
pnpm add -D @shikijs/monaco
25+
```
26+
27+
```sh [bun]
28+
bun add -D @shikijs/monaco
29+
```
30+
31+
:::
32+
1733
```ts
1834
import { shikiToMonaco } from '@shikijs/monaco'
1935
import * as monaco from 'monaco-editor-core'

docs/packages/rehype.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ outline: deep
1010

1111
## Install
1212

13-
```bash
13+
::: code-group
14+
15+
```sh [npm]
1416
npm i -D @shikijs/rehype
1517
```
1618

19+
```sh [yarn]
20+
yarn add -D @shikijs/rehype
21+
```
22+
23+
```sh [pnpm]
24+
pnpm add -D @shikijs/rehype
25+
```
26+
27+
```sh [bun]
28+
bun add -D @shikijs/rehype
29+
```
30+
31+
:::
32+
1733
## Usage
1834

1935
```ts twoslash

docs/packages/transformers.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ Common transformers for Shiki, inspired by [shiki-processor](https://github.com/
1010

1111
## Install
1212

13-
```bash
13+
::: code-group
14+
15+
```sh [npm]
1416
npm i -D @shikijs/transformers
1517
```
1618

19+
```sh [yarn]
20+
yarn add -D @shikijs/transformers
21+
```
22+
23+
```sh [pnpm]
24+
pnpm add -D @shikijs/transformers
25+
```
26+
27+
```sh [bun]
28+
bun add -D @shikijs/transformers
29+
```
30+
31+
:::
32+
1733
## Usage
1834

1935
```ts twoslash

docs/packages/twoslash.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,26 @@ A Shiki transformer for [Twoslash](https://github.com/twoslashes/twoslash), prov
1212

1313
## Install
1414

15-
```bash
16-
npm i -D @shikijs/twoslash
15+
::: code-group
16+
17+
```sh [npm]
18+
npm install -D @shikijs/twoslash
19+
```
20+
21+
```sh [yarn]
22+
yarn add -D @shikijs/twoslash
23+
```
24+
25+
```sh [pnpm]
26+
pnpm add -D @shikijs/twoslash
1727
```
1828

29+
```sh [bun]
30+
bun add -D @shikijs/twoslash
31+
```
32+
33+
:::
34+
1935
This package is **a transformer addon** to Shiki. This means that for every integration that supports passing Shiki transformers, you can use this package.
2036

2137
```ts twoslash

docs/packages/vitepress.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,29 @@ To enable [TypeScript Twoslash](/packages/twoslash) (type hover on code snippets
1616

1717
### Setup
1818

19-
```bash
19+
::: code-group
20+
21+
```sh [npm]
2022
npm i -D @shikijs/vitepress-twoslash
2123
```
2224

25+
```sh [yarn]
26+
yarn add -D @shikijs/vitepress-twoslash
27+
```
28+
29+
```sh [pnpm]
30+
pnpm add -D @shikijs/vitepress-twoslash
31+
```
32+
33+
```sh [bun]
34+
bun add -D @shikijs/vitepress-twoslash
35+
```
36+
37+
:::
38+
2339
In your [`.vitepress/config.ts`](https://vitepress.dev/reference/site-config):
2440

25-
```ts
26-
// .vitepress/config.ts
41+
```ts [.vitepress/config.ts]
2742
import { transformerTwoslash } from '@shikijs/vitepress-twoslash' // [!code hl]
2843
import { defineConfig } from 'vitepress'
2944

@@ -41,9 +56,8 @@ export default defineConfig({
4156

4257
And then in your [`.vitepress/theme/index.ts`](https://vitepress.dev/guide/custom-theme), install the Vue plugin and import the css with `@shikijs/vitepress-twoslash/styles.css`.
4358

44-
```ts twoslash
59+
```ts twoslash [.vitepress/theme/index.ts]
4560
// @noErrors: true
46-
// .vitepress/theme/index.ts
4761
import type { EnhanceAppContext } from 'vitepress' // [!code hl]
4862
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
4963
import Theme from 'vitepress/theme'
@@ -127,8 +141,7 @@ To speed up the build process, you can enable the file system cache for the gene
127141

128142
In your [`.vitepress/config.ts`](https://vitepress.dev/reference/site-config):
129143

130-
```ts
131-
// .vitepress/config.ts
144+
```ts [.vitepress/config.ts]
132145
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
133146
import { createFileSystemTypesCache } from '@shikijs/vitepress-twoslash/cache-fs' // [!code hl]
134147
import { defineConfig } from 'vitepress'

0 commit comments

Comments
 (0)