github项目地址:https://github.com/x-cold/yuque-hexo
1、前提
- 事先拥有一个 hexo 项目,在package.json配置相关信息,详见 例子。
- node版本需要在8.x以上。
2、配置
package.json
{
"name": "your hexo project",
"yuqueConfig": {
"baseUrl": "
https://www.yuque.com/api/v2
",
"login": "yinzhi",
"repo": "blog",
"mdNameFormat": "title",
"postPath": "source/_posts/yuque"
}
}
"postPath": 存放从语雀下载的 Markdown 文件的文件夹,除了 Hexo ,理论上可以支持其他支持 Front-matter 的 Markdown 静态博客
3、安装
npm i -g yuque-hexo
npm i --save-dev yuque-hexo
4、同步语雀文章
yuque-hexo sync
5、清楚hexo文章
6、Npm 脚本
{
"dev": "npm run sync && hexo s",
"sync": "yuque-hexo sync",
"clean:yuque": "yuque-hexo clean"
}
7、Debug
DEBUG=yuque-hexo.* yuque-hexo sync
8、提示
语雀同步过来的文章会生成两部分文件;
yuque.json: 从语雀 API 拉取的数据
source/_posts/yuque/*.md: 生成的 md 文件
9、例子
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.8.0"
},
"scripts": {
"clean": "hexo clean",
"clean:yuque": "DEBUG=yuque-hexo.* yuque-hexo clean",
"deploy": "hexo deploy",
"publish": "npm run clean && npm run deploy",
"dev": "hexo s",
"sync": "DEBUG=yuque-hexo.* yuque-hexo sync",
"reset": "npm run clean:yuque && npm run sync"
},
"dependencies": {
"hexo": "^3.7.0",
"hexo-generator-archive": "^0.1.5",
"hexo-generator-category": "^0.1.3",
"hexo-generator-index": "^0.2.1",
"hexo-generator-searchdb": "^1.0.8",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-ejs": "^0.3.1",
"hexo-renderer-marked": "^0.3.2",
"hexo-renderer-stylus": "^0.3.3",
"hexo-server": "^0.3.1",
"yuque-hexo": "^1.3.0"
},
"yuqueConfig": {
"baseUrl": "https://www.yuque.com/api/v2",
"login": "chf",
"repo": "note",
"mdNameFormat": "slug",
"postPath": "source/_posts/yuque"
}
}
手机观看扫描下方微信小程序二维码
本作品采用知识共享署名-相同方式共享 4.0 国际许可协议进行许可。
暂无评论
要发表评论,您必须先 登录