You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/code-groups.md
+42-15Lines changed: 42 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -33,11 +33,17 @@ pnpm add @slidev/cli
33
33
34
34
## Title Icon Matching
35
35
36
-
`code groups` and `code block` also supports the automatically icon matching by the title name:
36
+
`code groups` and `code block` also supports the automatically icon matching by the title name.
37
37
38
38

39
39
40
-
::: details All builtin icons
40
+
::: info
41
+
42
+
By default, we provide some built-in icons, you can use them by install [@iconify-json/vscode-icons](https://www.npmjs.com/package/@iconify-json/vscode-icons).
43
+
44
+
:::
45
+
46
+
::: details All built-in icons
41
47
42
48
```js
43
49
constbuiltinIcons= {
@@ -103,26 +109,47 @@ const builtinIcons = {
103
109
104
110
:::
105
111
106
-
## Custom Icon
112
+
## Custom Icons
113
+
114
+
You can use any name from the [iconify](https://icones.js.org) collection by using the `~icon~` syntax, for example:
115
+
116
+
````md
117
+
```js [npm ~i-uil:github~]
118
+
console.log('Hello, GitHub!')
119
+
```
120
+
````
121
+
122
+
To make it work, you need to:
123
+
124
+
1. Install the icon's collection.
125
+
126
+
:::code-group
107
127
108
-
You can also specify the icon manually by the following steps:
128
+
```sh [npm]
129
+
npm add @iconify-json/uil
130
+
```
109
131
110
-
1. Add the icon to the `uno.config.ts` file:
132
+
```sh [yarn]
133
+
yarn add @iconify-json/uil
134
+
```
135
+
136
+
```sh [pnpm]
137
+
pnpm add @iconify-json/uil
138
+
```
139
+
140
+
```sh [bun]
141
+
bun add @iconify-json/uil
142
+
```
143
+
144
+
:::
145
+
146
+
2. Add the icon to the `uno.config.ts` file.
111
147
112
148
```ts [uno.config.ts] {3-5}
113
149
import { defineConfig } from'unocss'
114
-
115
150
exportdefaultdefineConfig({
116
151
safelist: [
117
-
'i-vscode-icons:file-type-coverage',
152
+
'i-uil:github',
118
153
],
119
154
})
120
155
```
121
-
122
-
2. Use the icon in the code block with the `~icon~` syntax:
0 commit comments