@@ -26,16 +26,43 @@ export default {
26
26
}
27
27
```
28
28
29
- We support multiple types of icons as well :
29
+ We support multiple types of icons:
30
30
31
31
- ` iconify ` (default)
32
32
- ` fontawesome `
33
33
- ` iconfont `
34
34
35
- Also, images links are supported with any icon types (relative links are NOT supported).
35
+ Also, you can use images links with any icon types (relative links are NOT supported).
36
36
37
37
If you want a new type of icon, please open an issue or submit a PR.
38
38
39
+ In markdown, you can use ` ::icon decorators... =size /color key=value complex-key="complex value"...:: ` to insert custom icons.
40
+
41
+ - A string starting with ` = ` will be treated as a size definition.
42
+ - A string starting with ` / ` will be treated as a color definition.
43
+ - Any string which itself is a valid html attribute will parsed, standardized and added to the icon element.
44
+ - The rest part will be treated as the icon name.
45
+
46
+ ``` md
47
+ ::icon =16 /red:: <!-- <VPIcon class="icon" color="red" size="16px" -->
48
+
49
+ ::icon rotate vertical-align=middle:: <!-- <VPIcon icon="icon rotate" vertical-align="middle" -->
50
+ ```
51
+
52
+ ::: info Demo
53
+
54
+ ::mdi: home /blue::
55
+ ::mdi: apple =2rem vertical-align=text-bottom::
56
+
57
+ ``` md
58
+ ::mdi:home /blue::
59
+ ::mdi:apple =2rem vertical-align=text-bottom::
60
+ ```
61
+
62
+ :::
63
+
64
+ ## Icon Types
65
+
39
66
### Iconify
40
67
41
68
For full icon list, see < https://icon-sets.iconify.design/ > . To use a icon, copy it's icon name of ` iconify-icon ` in the selector.
@@ -50,8 +77,8 @@ Additionally, iconify support the following props:
50
77
If you use 1 icon set mostly, you can set the prefix to the icon set name (E.g.: ` mdi: ` ), Then you can use the icon name without the prefix. Manually declaring a full icon name will override the prefix:
51
78
52
79
``` md
53
- <VPIcon icon=" home" /> <!-- mdi:home -->
54
- <VPIcon icon=" svg-spinners:180-ring" /> <!-- svg-spinners:180-ring -->
80
+ :: home:: <!-- mdi:home -->
81
+ :: svg-spinners:180-ring:: <!-- svg-spinners:180-ring -->
55
82
```
56
83
57
84
### Font Awesome
@@ -63,38 +90,38 @@ The `fontawesome` keyword only includes the free solid and regular icons. If you
63
90
Solid icons can be used directly. if you want to use regular or brand icons, you need to add the ` regular: ` or ` brands: ` prefix to the icon name:
64
91
65
92
``` md
66
- <VPIcon icon=" home" /> <!-- fas fa-home (solid is default) -->
67
- <VPIcon icon=" solid:home" /> <!-- fas fa-home -->
68
- <VPIcon icon=" regular:heart" /> <!-- far fa-heart -->
69
- <VPIcon icon=" brands:apple" /> <!-- fab fa-apple -->
93
+ :: home:: <!-- fas fa-home (solid is default) -->
94
+ :: solid:home:: <!-- fas fa-home -->
95
+ :: regular:heart:: <!-- far fa-heart -->
96
+ :: brands:apple:: <!-- fab fa-apple -->
70
97
```
71
98
72
99
Besides, a three letter prefix, first letter or full class name are also supported:
73
100
74
101
``` md
75
- <VPIcon icon=" s:home" /> <!-- fas fa-home -->
76
- <VPIcon icon=" fas:home" /> <!-- fas fa-home -->
77
- <VPIcon icon=" fa-solid:home" /> <!-- fa-solid fa-home -->
102
+ :: s:home:: <!-- fas fa-home -->
103
+ :: fas:home:: <!-- fas fa-home -->
104
+ :: fa-solid:home:: <!-- fa-solid fa-home -->
78
105
79
- <VPIcon icon=" b:apple" /> <!-- fab fa-apple -->
80
- <VPIcon icon=" fab:apple" /> <!-- fab fa-apple -->
81
- <VPIcon icon=" fa-brands:apple" /> <!-- fa-brands fa-apple -->
106
+ :: b:apple:: <!-- fab fa-apple -->
107
+ :: fab:apple:: <!-- fab fa-apple -->
108
+ :: fa-brands:apple:: <!-- fa-brands fa-apple -->
82
109
83
- <VPIcon icon=" r:heart" /> <!-- far fa-heart -->
84
- <VPIcon icon=" far:heart" /> <!-- far fa-heart -->
85
- <VPIcon icon=" fa-regular:heart" /> <!-- fa-regular fa-heart -->
110
+ :: r:heart:: <!-- far fa-heart -->
111
+ :: far:heart:: <!-- far fa-heart -->
112
+ :: fa-regular:heart:: <!-- fa-regular fa-heart -->
86
113
```
87
114
88
115
You can add other classes that fontawesome supports after the icon name and split them with a space, where ` fa- ` prefix is optional:
89
116
90
117
``` md
91
118
<!-- a small size icon -->
92
119
93
- <VPIcon icon=" home fa-sm" /> <!-- fas fa-home fa-sm -->
120
+ :: home fa-sm:: <!-- fas fa-home fa-sm -->
94
121
95
122
<!-- rotate 180deg -->
96
123
97
- <VPIcon icon=" home rotate-180" /> <!-- fas fa-home fa-rotate-180 -->
124
+ :: home rotate-180:: <!-- fas fa-home fa-rotate-180 -->
98
125
```
99
126
100
127
See < https://docs.fontawesome.com/web/style/styling > for all available classes.
@@ -166,16 +193,13 @@ Images links are supported with any icon types (relative links are NOT supported
166
193
167
194
``` md
168
195
<!-- A full link -->
169
- <VPIcon icon="https://example.com/icon.png" />
170
196
171
- <!-- icon.png should be placed in .vuepress/public folder -->
172
- <VPIcon icon="/icon.png" />
173
- ```
197
+ ::https://example.com/icon.png::
174
198
175
- ## Demo
199
+ <!-- icon.png should be placed in .vuepress/public folder -->
176
200
177
- - <VPIcon icon =" mdi:home " color = " blue " />: home icon
178
- - < VPIcon icon = " mdi:apple " size = " 2rem " vertical-align = " text-bottom " />: apple icon
201
+ <VPIcon icon="/icon.png" /> <!-- ::/ icon.png:: is NOT supported as it will be parsed as color -->
202
+ ```
179
203
180
204
## Options
181
205
@@ -248,9 +272,17 @@ Images links are supported with any icon types (relative links are NOT supported
248
272
249
273
Name of the icon component. If set to ` null ` , the plugin will not register the icon component globally.
250
274
275
+ ### markdown
276
+
277
+ - Type: ` boolean `
278
+ - Default: ` true `
279
+ - Details:
280
+
281
+ Whether to enable icon syntax ( ` :: icon :: ` ) in markdown.
282
+
251
283
## Component Props
252
284
253
- ### icon
285
+ ### icon {#icon-prop}
254
286
255
287
- Type: ` string `
256
288
- Required: Yes
0 commit comments