图标
约 395 字
概述
图标组件 <Icon />,根据 markdown.icon 配置,从不同的图标库加载图标。
配置
.vuepress/config.ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
markdown: {
icon: { provider: 'iconify' } // 默认支持
}
})
})interface IconOptions {
/**
* 图标提供商
*/
provider: 'iconify' | 'iconfont' | 'fontawesome'
/**
* 图标默认前缀,不同的提供商默认前缀不同
* - iconify - 默认为 `''`
* - iconfont - 默认为 `iconfont icon-`
* - fontawesome - 默认为 `fas`
*/
prefix?: string
/**
* 图标资源地址
*/
assets?: IconAssetLink | IconAssetLink[]
size?: string | number
color?: string
}Props
Type:
string | { svg: string }图标名称。支持 iconify 图标名、图标链接(https://… 或 /…),以及内联 SVG 对象 { svg: '<svg>…</svg>' }。 当 markdown.icon.prefix 有值时,name 中的前缀可以省略。
Type:
'iconify' | 'iconfont' | 'fontawesome'默认值:由 `markdown.icon.provider` 决定(默认 `'iconify'`)
图标提供商。也可以在 name 中使用 iconify / iconfont / fontawesome 加空格前缀强制指定。
示例
输入:
- home - <Icon name="material-symbols:home" color="currentColor" size="1em" />
- vscode - <Icon name="skill-icons:vscode-dark" size="2em" />
- twitter - <Icon name="skill-icons:twitter" size="2em" />输出:
- home -
- vscode -
- twitter -
贡献者
更新日志
2026/10/13 15:56
查看所有更新日志
e4dae-docs: improve docs (#1071)于7a454-feat(plugin-md-power): dropoptionaltag infieldcontainer (#987)于1d04d-feat: add builtin auto-import-components (#932)于16c2d-docs: update field container于4d236-feat(theme)!: add collections support (#704)于14973-feat: add multiple provider support for icon, close #568 (#596)于d1496-docs: update docs于0fd6c-refactor(theme): improve types and flat config (#524)于e3b1c-docs: improve docs于
