使用vuepress-hope构建你的文档和博客
在我们使用 vuepress-hope 搭建自己的站点的时候,出现了任何问题均可以查看作者的博客源代码仓库Mister-Hope.github.io。还有查看 vuepress-hope 的官方文档。
markdown 语法
具体来说,Hexo使用了一个名为marked的Markdown渲染器,它可以将Markdown文本转换为HTML格式。而marked渲染器本身是基于Google的开源项目Markdown库实现的,该库支持标准的Markdown语法。
而 vuepress 使用 markdown-it 来实现 markdown 语法,另外vuepress-hope额外配置了markdown语法增强插件来实现更多语法
换行
https://theme-hope.vuejs.press/zh/cookbook/markdown/demo.html#换行
永久链接
可以使用:https://vuepress.github.io/zh/reference/frontmatter.html#permalink 来自定义文章永久链接
主页
设置了star选项的文章才会显示在主页文章下面
多语言
我觉得自己只需要中文,就注释了多语言选项,修改后的代码如下:
lang: "zh-CN",
// locales: {
// "/": {
// lang: "en-US",
// title: "Blog Demo",
// description: "A blog demo for vuepress-theme-hope",
// },
// "/zh/": {
// lang: "zh-CN",
// title: "博客演示",
// description: "vuepress-theme-hope 的博客演示",
// },
// },主题配置
// src/.vuepress/theme.ts图标支持
建议直接用内置的,如果不用内置的得先清空前缀iconPrefix,然后你得去网上自己生成再导入资源,具体方法见文档。当你清空前缀之后就可以直接使用完整的图标名称了,比如fa-sharp fa-light fa-house。建议用fontawesome或者iconify,别的都不推荐
文档参考:https://theme-hope.vuejs.press/zh/guide/interface/icon.html
升级你的 vuepress-hope
我在升级vuepress的时候,出现了报错,最终发现还是源的设置问题,通过查看 GitHub issue,我通过修改源解决了问题,成功升级
# 重新设置源
pnpm config set registry https://registry.npmmirror.com
# 需要重新加载node_modules
pnpm install
# 升级vuepress
pnpm dlx vp-update问题日志
我把deploy-docs.yml的pnpm版本设置成8就解决了这个问题
Running pnpm recursive install...
. | WARN Your pnpm-lock.yaml was generated by a newer version of pnpm. It is a compatible version but it might get downgraded to version 6.0
Lockfile is up to date, resolution step is skipped
undefined
ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY Broken lockfile: no entry for '/@vuepress/client/2.0.0-beta.62' in pnpm-lock.yaml
This issue is probably caused by a badly resolved merge conflict.
To fix the lockfile, run 'pnpm install --no-frozen-lockfile'.
Error: Command pnpm recursive install (cwd: undefined) exits with status 1自动化部署
- https://github.com/JamesIves/github-pages-deploy-action
- https://github.com/jenkey2011/vuepress-deploy
这两个脚本配置分别,有所不同,vuepress-hope默认支持的是第一个,第二个🈶️cname选项,可以在自动化部署的时候同时选择域名