安装hexo

安装npm

1
2
$ wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
$ NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node nvm install 4.3.1

安装hexo

1
npm install -g hexo-cli --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/mirrors/node

安装cnpm

1
2
npm --registry=https://registry.npm.taobao.org install cnpm -g
<!-- more -->

初始化环境

1
2
hexo init blog
cnpm install hexo-deployer-git --save

安装必要插件

1
2
3
4
5
6
7
8
npm un hexo-renderer-marked --save
npm i hexo-renderer-markdown-it --save

cd node_modules/hexo-renderer-markdown-it/
npm install markdown-it-footnote --save #添加脚注
npm install markdown-it-emoji --save #添加 Eomji
npm install markdown-it-sub --save #添加下标
npm install markdown-it-sup --save #添加下标

修改配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
vim _config.yml
markdown:
render:
html: true
xhtmlOut: false
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
plugins:
- markdown-it-abbr
- markdown-it-footnote
- markdown-it-ins
- markdown-it-sub
- markdown-it-sup
anchors:
level: 2
collisionSuffix: 'v'
permalink: true
permalinkClass: header-anchor
permalinkSymbol: ¶

从别的电脑使用

1
2
3
4
1.git clone xxx
2.git checkout hexo
3.hexo xxx
4.git push