File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,31 @@ DEBUG=yuque-hexo.* yuque-hexo sync
87
87
88
88
# Notice
89
89
90
- 语雀同步过来的文章会生成两部分文件;
90
+ 1 . 语雀同步过来的文章会生成两部分文件;
91
91
92
- - yuque.json: 从语雀 API 拉取的数据
93
- - source/_ posts/yuque/* .md: 生成的 md 文件
92
+ - yuque.json: 从语雀 API 拉取的数据
93
+ - source/_ posts/yuque/* .md: 生成的 md 文件
94
+
95
+ 2 . 支持配置front-matter, 语雀编辑器编写示例如下:
96
+ - 语雀编辑器示例,可参考[ 原文] ( https://www.yuque.com/u46795/blog/dlloc7 ) :
97
+ ![ image.png] ( https://cdn.nlark.com/yuque/0/2019/png/155457/1547033073596-797e3d68-fac4-40fd-8e8d-16ea1da4b705.png )
98
+ 语雀编辑器转换成的markdown 如下(已做兼容):
99
+ ``` markdown
100
+ tags: [hexo, node]<br />date: 2018-06-09<br />categories: 前端
101
+
102
+ ---
103
+ ```
104
+
105
+ - 标准 markdown 示例:
106
+
107
+ ```markdown
108
+ date: 2015-04-18 00:00:00
109
+ tags: [css]
110
+ categories: CSS
111
+ ---
112
+ ```
113
+
114
+ > 注意:分割线不能少,兼容一个或多个属性的自定义
94
115
95
116
# Example
96
117
Original file line number Diff line number Diff line change @@ -242,6 +242,9 @@ function formatRaw(body) {
242
242
function parseMatter ( body ) {
243
243
body = entities . decode ( body ) ;
244
244
try {
245
+ // front matter信息的<br/>换成 \n
246
+ const regex = / ( t i t l e : | l a y o u t : | t a g s : | d a t e : | c a t e g o r i e s : ) { 1 } ( \S | \s ) + ?- - - / gi;
247
+ body = body . replace ( regex , a => a . replace ( / ( < b r \/ > | < b r > | < b r \/ > ) / gi, '\n' ) ) ;
245
248
const result = FrontMatter . parse ( body ) ;
246
249
result . body = result . _content ;
247
250
if ( result . date ) {
You can’t perform that action at this time.
0 commit comments