Markdown 增强
VuePress 的每个文档页面都是由 Markdown 渲染而成。所以你需要通过在相应路径创建编写 Markdown 建立你的文档或博客页面。
Markdown 介绍
如果你是一个新手,还不会编写 Markdown,请先阅读 Markdown 介绍 和 Markdown 演示。
::: info Frontmatter
Frontmatter 是 VuePress 中很重要的一个概念,如果你不了解它,你需要阅读 Frontmatter 介绍。
:::
VuePress 扩展
为了丰富文档写作,VuePress 对 Markdown 语法进行了扩展。
关于这些扩展,请阅读 VuePress 中的 Markdown 扩展。
主题扩展
一键启用
你可以设置在主题选项中设置 plugins.mdEnhance.enableAll: true 启用 md-enhance 插件的所有功能。
const { hopeTheme } = require("vuepress-theme-hope");
module.exports = {
theme: hopeTheme({
plugins: {
mdEnhance: {
enableAll: true,
},
},
}),
};
自定义容器
::: v-pre
安全的在 Markdown 中使用 。
:::
::: info 自定义标题
信息容器,包含 代码 与 链接。
const a = 1;
:::
::: tip 自定义标题
提示容器
:::
::: warning 自定义标题
警告容器
:::
::: danger 自定义标题
危险容器
:::
::: details 自定义标题
详情容器
:::
:::: details 代码
::: v-pre
安全的在 Markdown 中使用 {{ variable }}。
:::
::: info 自定义标题
信息容器
:::
::: tip 自定义标题
提示容器
:::
::: warning 自定义标题
警告容器
:::
::: danger 自定义标题
危险容器
:::
::: details 自定义标题
详情容器
:::
::::
代码块
:::: code-group
::: code-group-item pnpm
pnpm add -D vuepress-theme-hope
:::
::: code-group-item yarn
yarn add -D vuepress-theme-hope
:::
::: code-group-item npm:active
npm i -D vuepress-theme-hope
:::
::::
自定义对齐
::: center
我是居中的
:::
::: right
我在右对齐
:::
上下角标
19th H2O
脚注
此文字有脚注[1].
标记
你可以标记 重要的内容 。
任务列表
图表
::: chart 一个散点图案例
{
"type": "scatter",
"data": {
"datasets": [
{
"label": "散点数据集",
"data": [
{ "x": -10, "y": 0 },
{ "x": 0, "y": 10 },
{ "x": 10, "y": 5 },
{ "x": 0.5, "y": 5.5 }
],
"backgroundColor": "rgb(255, 99, 132)"
}
]
},
"options": {
"scales": {
"x": {
"type": "linear",
"position": "bottom"
}
}
}
}
:::
流程图
Mermaid
Tex 语法
代码演示
::: demo 一个普通 Demo
<h1>VuePress Theme Hope</h1>
<p><span id="very">非常</span>强大!</p>
document.querySelector("#very").addEventListener("click", () => {
alert("非常强大");
});
span {
color: red;
}
:::
幻灯片
@slidestart
幻灯片 1
一个有文字和 链接 的段落
幻灯片 2
- 项目 1
- 项目 2
幻灯片 3.1
const a = 1;
--
幻灯片 3.2
@slideend
这是脚注内容 ↩︎