Hexo 出现 Cannot read property '1' of undefined

在使用 Hexo-2.8.3 命令 hexo g 生成 HTML 页面时出现 TypeError: Cannot read property ‘1’ of undefined ,错误信息如下

1
2
3
4
5
6
7
8
9
10
11
12
[error] HexoError: Process failed: _posts/OS-X-Yosemite.md
TypeError: Cannot read property '1' of undefined
at /usr/local/lib/node_modules/hexo/lib/plugins/filter/backtick_code_block.js:32:27
at String.replace (native)
at module.exports (/usr/local/lib/node_modules/hexo/lib/plugins/filter/backtick_code_block.js:14:31)
at /usr/local/lib/node_modules/hexo/lib/post/render.js:77:9
at iterate (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:149:13)
at Object.async.eachSeries (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:165:9)
at async.series.options (/usr/local/lib/node_modules/hexo/lib/post/render.js:76:13)
at /usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:610:21
at /usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:249:17
at iterate (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:149:13)

经排查发现是因为在使用 Markdown 代码区块语法后面多了一个空格

生成 HTML 成功

1
2
3
```#这里没有空格
code
...

生成 HTML 出错

1
2
3
``` #前面多了一个空格
code
...

完。