Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

创建草稿

1
$ hexo new draft "My Draft Post"

发布草稿

1
$ hexo publish "My Draft Post"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

class myPromise {
constructor(Fn) {
if(Object.prototype.toString.call(Fn) !== '[object Function]') { /*传入必须为function*/
throw new TypeError('Pass function object to create a Promise object')
}

this.status = "pending" /*初始化状态*/
this.promiseResolvedArray = [] /*Promise resolve时的回调数组*/
this.promiseRejectedArray = [] /*Promise reject时的回调数组*/

this.onResolve = this.onResolve.bind(this)
this.onReject = this.onReject.bind(this)
Fn(this.onResolve, this.onReject)
}

then(onResolve, onReject) {
console.log()
this.promiseResolvedArray.push(onResolve)
this.promiseRejectedArray.push(onReject || null)
return this
}

catch(onReject) {
return this.then(null, onReject)
}

onResolve(value) {
if(this.status === 'pending') {
this.status = 'resolved'
} else {
throw new TypeError('You have to use pending state to convert')
}

let storedValue = value

try {
this.promiseResolvedArray.forEach((nextFunction) => {
storedValue = nextFunction(storedValue)
})
} catch (error) {
throw new TypeError(error)
}
}

onReject(error) {
if(this.status === 'pending') {
this.status = 'rejected'
} else {
throw new TypeError(error)
}

let storedValue = error

try {
this.promiseRejectedArray.forEach((nextFunction) => {
storedValue = nextFunction(storedValue)
})
} catch (error) {
throw new TypeError(error)
}
}
}

var p = function (){
return new myPromise(function(resolve, reject){
setTimeout(function(){
reject('p 的结果')
}, 100);
});
}

p().then(function(data) {
console.log('resolve: ' + data)
}, function(data) {
console.log('reject: ' + data )
})

Run server

1
$ hexo server

More info: Server

本地预览选项

  • -p 指定端口
  • -l 只监听本地连接
  • -o 自动打开浏览器

Generate static files

1
$ hexo generate

More info: Generating

生成选项

  • -d 生成后立即部署
  • -w 监听文件变化
  • -b 生成前清理缓存

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

高级功能

插件管理

Hexo 支持丰富的插件系统

常用插件

  • hexo-generator-feed:RSS 订阅
  • hexo-generator-sitemap:站点地图
  • hexo-deployer-git:Git 部署

主题定制

可以通过修改主题文件来自定义外观

自定义样式

  • 修改 CSS 文件
  • 添加自定义 JavaScript
  • 调整布局模板


这是居中的红色文字
点击展开 这里是隐藏的内容

这是一个脚注^1

这是一个引用块

1
2
3
function hello() {
console.log("Hello World!");
}
链接标题
  • 已完成的任务
  • 未完成的任务
  • 另一个任务
    左对齐 居中对齐 右对齐
    内容1 内容2 内容3