最近重装了系统, 发现Hexo跑不了了, 后来发现是因为好多插件没有安装..结果又要一个个去网上找, 这里记录一下常用的几个插件..

插件列表

1
2
3
4
5
npm install --save hexo hexo-baidu-url-submit hexo-deployer-git \
hexo-generator-archive hexo-generator-baidu-sitemap hexo-generator-category \
hexo-generator-feed hexo-generator-index hexo-generator-json-content \
hexo-generator-sitemap hexo-generator-tag hexo-helper-qrcode hexo-renderer-ejs \
hexo-renderer-less hexo-renderer-marked hexo-renderer-stylus hexo-server

skapp

1
2
3
4
npm install --save hexo-autoprefixer hexo-filter-cleanup \
hexo-generator-feed hexo-generator-sitemap \
hexo-renderer-sass hexo-renderer-swig \
mamboer/lunr.js moment node-sass object-assign

windows还要安装:

1
2
npm install -g windows-build-tools
npm install -g node-gyp

看板娘

1
2
npm install --save hexo-helper-live2d
npm install --save live2d-widget-model-koharu

时序图 hexo-filter-sequence ^1.0.3

1
npm install --save hexo-filter-sequence

这个插件有bug,需要改源代码:

配置

站点配置文件 _config.yml 中增加如下配置:

1
2
3
4
5
6
7
8
9
sequence:
webfont: https://cdn.bootcss.com/webfont/1.6.28/webfontloader.js
raphael: https://cdn.bootcss.com/raphael/2.2.7/raphael.min.js
underscore: https://cdn.bootcss.com/underscore.js/1.8.3/underscore-min.js
sequence: https://cdn.bootcss.com/js-sequence-diagrams/1.0.6/sequence-diagram-min.js
css: # optional, the url for css, such as hand drawn theme
options:
theme: simple
css_class:

源码

源码修改后才能正常使用,进入插件目录作如下修改:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/ index.js
var assign = require('deep-assign');
var renderer = require('./lib/renderer');

hexo.config.sequence = assign({
webfont: 'https://cdn.bootcss.com/webfont/1.6.28/webfontloader.js',
raphael: 'https://cdn.bootcss.com/raphael/2.2.7/raphael.min.js',
underscore: 'https://cdn.bootcss.com/underscore.js/1.8.3/underscore-min.js',
sequence: 'https://cdn.bootcss.com/js-sequence-diagrams/1.0.6/sequence-diagram-min.js',
css: '',
options: {
theme: 'simple'
}
}, hexo.config.sequence);

hexo.extend.filter.register('before_post_render', renderer.render, 9);

-

1
2
3
4
5
6
7
8
9
10
// lib/renderer.js, 25 行
if (sequences.length) {
var config = this.config.sequence;
// resources
data.content += '<script src="' + config.webfont + '"></script>';
data.content += '<script src="' + config.raphael + '"></script>';
data.content += '<script src="' + config.underscore + '"></script>';
data.content += '<script src="' + config.sequence + '"></script>';
......
}

时序图 hexo-filter-mermaid-diagrams

1
npm install --save hexo-filter-mermaid-diagrams

需要修改配置以及ejs

配置

1
2
3
4
5
6
# mermaid chart 
mermaid: ## mermaid url https://github.com/knsv/mermaid
enable: true # default true
version: "7.1.2" # default v7.1.2
options: # find more api options from https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js
#startOnload: true // default true

ejs文件

修改主题文件夹下的footer.ejs,添加:

1
2
3
4
5
6
7
8
<% if (theme.mermaid.enable) { %>
<script src='https://unpkg.com/mermaid@<%= theme.mermaid.version %>/dist/mermaid.min.js'></script>
<script>
if (window.mermaid) {
mermaid.initialize({theme: 'forest'});
}
</script>
<% } %>

hexo-tag-gantt

依赖于mermaid

1
npm install https://github.com/threeq/hexo-tag-gantt.git --save