Coder Social home page Coder Social logo

yuque-hexo's Introduction

yuque-hexo

NPM version build status Test coverage David deps Known Vulnerabilities npm download

A downloader for articles from yuque

Usage

Premise

事先拥有一个 hexo 项目,在package.json配置相关信息,详见 例子

Config

package.json

{
  "name": "your hexo project",
  "yuqueConfig": {
    "baseUrl": "https://www.yuque.com/api/v2",
    "login": "yinzhi",
    "repo": "blog",
    "mdNameFormat": "title",
    "postPath": "source/_posts/yuque"
  }
}

"mdNameFormat": 生成的 Markdown 文件的文件名,可以选择 "title" 或者 "slug",默认 "title",slug 是语雀的永久链接名,一般是几个随机字母。

"postPath": 存放从语雀下载的 Markdown 文件的文件夹,除了 Hexo ,理论上可以支持其他支持 Front-matter 的 Markdown 静态博客

Install

npm i -g yuque-hexo
# or
npm i --save-dev yuque-hexo

Sync

yuque-hexo sync

Clean

yuque-hexo clean

Npm Scripts

{
  "dev": "npm run sync && hexo s",
  "sync": "yuque-hexo sync",
  "clean:yuque": "yuque-hexo clean"
}

Debug

DEBUG=yuque-hexo.* yuque-hexo sync

Notice

  1. 语雀同步过来的文章会生成两部分文件;

    • yuque.json: 从语雀 API 拉取的数据
    • source/_posts/yuque/*.md: 生成的 md 文件
  2. 支持配置front-matter, 语雀编辑器编写示例如下:

    • 语雀编辑器示例,可参考原文image.png 语雀编辑器转换成的markdown 如下(已做兼容):
      tags: [hexo, node]<br />date: 2018-06-09<br />categories: 前端
    
      ---
    • 标准 markdown 示例:
      date: 2015-04-18 00:00:00
      tags: [css]
      categories: CSS 
      ---

    注意:分割线不能少,兼容一个或多个属性的自定义

Example

https://github.com/x-cold/blog/blob/master/package.json

Changelog

v1.1.1

  • 支持 hexo-front-matter,可以在文章中编辑 tags / date 等属性

v1.2.1

  • 修复 windows 环境下命令行报错的问题
  • 支持自定义文件夹和博客文件命名

v1.3.1

  • 修复 front-matter 处理格式问题

yuque-hexo's People

Contributors

ghostdar avatar k-water avatar x-cold avatar xenv avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.