-
Notifications
You must be signed in to change notification settings - Fork 4
Support front-matter in the issue content #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
yaml中有特殊字符的话会break |
能否提供下yaml内容? |
|
@CloudyCity |
| @@ -4,7 +4,8 @@ | |||
| "description": "Github issue migrator plugin for Hexo.", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"version": "0.1.5" 直接改成0.16吧,merge后我就release
| var topPrefix = 'top_'; | ||
| var categoryPrefix = 'category_'; | ||
| var category_prefix = 'category_'; | ||
| var regexp = /^(-{3,})(\r\n)([\s\S]+?)\r\n\1\r\n?([\s\S]*)/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个regexp自己写的吗?靠谱不,看的头大。:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一段主要是将FrontMatter中的CRLF替换为LF(我的文章中都是CRLF,不知道你的有没有这个问题),不然无法正常解析。如果全文替换,又会影响文章生成,所以最后用了正则。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加个注释吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者是不是可以直接引用这个变量,防止发生变化。加个注释和链接也可以,你自己看吧。:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者是不是可以直接引用这个变量,防止发生变化。加个注释和链接也可以,你自己看吧。:)
正则稍有不同,hexo-front-matter用的是LF,这里是用CRLF。我注释个链接。
|
close and reopen to trigger CI, : ) |
|
好了,我没啥问题了。可以merge的话我就merge了 |
|
@Yikun 合并front-matter时的覆盖优先级你更偏向哪一种? |
|
meta应该可以覆盖掉data的。 当用户指定meta后,可以无视我们的规则(title的对应,label的对应等)。 这个文档补充一下: The front-matter will be transparently added in your post writings. Note that, the front-matter in issue has the highest priority, that means the internal front-matter(such as, |
| - "top_", set the top priority for the post. | ||
| - "draft", the post layout will be set to "draft", that means the post will be stored in draft dir | ||
| - "publish", if user migrate with "--publish" opt, only post with "publish" label will be created. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Front-matter support
If you specify the front-matter in the issue content, like:
---
cover: http://demo.jpeg
top: 1
---
# Title
Hello World!
The front-matter will be transparently added in your post writings.
Note that, the front-matter in the issue content has the highest priority, that means the internal front-matter which generated by migrator (such as, title, tags, number, date) will also be replaced.
Front-matter作为一个独立的章节写吧
#6