Component
Less than 1 minute
You can easily insert components in Markdown content with component code block.
Settings
TS
// .vuepress/config.ts
import { defineUserConfig } from "vuepress";
import { hopeTheme } from "vuepress-theme-hope";
export default defineUserConfig({
theme: hopeTheme({
plugins: {
mdEnhance: {
components: true,
},
},
}),
});
JS
// .vuepress/config.js
import { hopeTheme } from "vuepress-theme-hope";
export default {
theme: hopeTheme({
plugins: {
mdEnhance: {
components: true,
},
},
}),
};
Usage
You can use component fence block to add a component into your markdown content. Both YAML and JSON format props data are supported:
```component ComponentName
# component data here
```
```component ComponentName
{
// component data here
}
```
Demo
```component VPCard
title: Mr.Hope
desc: Where there is light, there is hope
logo: https://mister-hope.com/logo.svg
link: https://mister-hope.com
color: rgba(253, 230, 138, 0.15)
```
```component VPCard
{
"title": "Mr.Hope",
"desc": "Where there is light, there is hope",
"logo": "https://mister-hope.com/logo.svg",
"link": "https://mister-hope.com",
"color": "rgba(253, 230, 138, 0.15)"
}
```