Closed longdafeng closed 2 years ago
@longdafeng
I assume your yaml file has extra space or tag. Please check them.
https://github.com/hexojs/hexo/issues/832#issuecomment-54764743
I don't think the problem is #832.
There is no Front-matter in my documents.
there are no section like this:
---
title: test
---
Some markdown documents are fine, but some occur probjem, which there are ":" in these document with problem.
@longdafeng
I assume your yaml file has extra space or tag. Please check them.
any help will be appreciated. @stevenjoezhang , do you have any idea to resolve it? Thanks in advance.
You need to add a Front-matter section in the posts:
---
title: test
---
Otherwise ":" in the post content will be parsed as YAML Front-matter, causing syntax error
I want to migrate my markdown books from MkDocs to Hexo. There are more than 1000 markdown documents, this is an huge task for me (I can write a script do this task). what's more there are 2 document systems to display these documents, so I can't add "front-matter" to these documents.
In my oponion, there should be a method to skip render front-matter.
@stevenjoezhang, thanks in advance
Sorry for disturbing, @curbengh , @tommy351 , @SukkaW , @segayuu , @NoahDragon , may I ask how to resolve this problem? Any help are appreciated, thanks in advance.
@yoshinorin Do you have any ideas to resolve this problem, any help are appreciated.
I don't know why your environment has a problem (YAMLException
).
Anyway, hexo 6.x.x
can process a post without front-matter. I just tried it locally.
// create new hexo pj
$ hexo init issue4961
INFO Validating config
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO Install dependencies
...
INFO Start blogging with Hexo!
After creating a new project, I wrote a post without frontmatter.
// in _posts\test-no-front-matter.md
$ hexo new test-no-front-matter
INFO Validating config
INFO Created: ~\sandbox\issue4961\source\_posts\test-no-front-matter.md
And run hexo server
I can see the content without Errors.
Also, hexo can generate HTML from it.
$ hexo g
INFO Validating config
INFO Start processing
....
INFO Generated: 2022/05/12/test-no-front-matter/index.html
INFO 18 files generated in 357 ms
I assume you can use hexo API, if you want to add a title
(or other metadata) to your posts without front-matter.
I have been never tried to use them for update metadata, but may be effective.
https://hexo.io/api/generator#Generate-All-Posts https://hexo.io/api/#Execute-Commands
@yoshinorin Thanks
There is no : in your markdown, so it won't occur problem.
There is one or more colon in the document, at the same time, there is no front-matter, it will occur "YAMLException"
This error does not happen only :
.
But, when I use ---
with :
the YAMLException
sometimes happens.
I wrote some patterns below.
// OK (without ---)
This is a test for issue:4916
// Sometimes happens (not every time)
This is a test for issue:4916
---
// Sometimes happens (not every time)
This is a test for issue : 4916
---
// every time happen
---
This is a test for issue:4916
This is a test for issue : 4916
---
// OK
---
This is a test for issue:4916
---
// No-errors but nothing is rendered
---
This is a test for issue : 4916
---
Not sure but as far as I know, can not ignore parsing yaml.
IMHO, we will not implement ignore parsing yaml option, because this case (nothing front-matter) assumes a very rare case. But, we may implement it if we receive many requests from users.
Also, we may accept if someone submits PR about this.
@yoshinorin Today I debug my document, I found the root cause, what I found is the same as what you found.
The document doesn't allow '---'
For example:
Architecture
=================================
The architecture of Developer Center (ODC) consists of three parts:
* **[Basic features](#basic-features)**
* **[Core features](#core-features)**
* **[Advanced features](#advanced-features)**
Basic features
-----------------------
* User Management: This feature provides services such as account creation, system logon, and password modification.
* Connection Management: This feature allows you to manage connections to Database in MySQL and Oracle modes. You can create, save, copy, and delete database connections.
Event if there is one "-----------------------" between ``` and ``` , it will also exist problem
Due to "-----------------------" can be regcognize asone format of title in markdown,
For example
so could we ignore "-----------------------", don't parse it as YAML.
@yoshinorin @stevenjoezhang @bkeepers @jjgod @NoahDragon @SukkaW
Do you have any idea about this issue, any help are appreciated.
I am disappointed at Hexo, one month past, no one give me an answer how to resolve it.
In my oponion, the label of this issue is wrong, it should be feature-request
close this issue, due to no one answer
I have answered your question 2 months ago. I have no idea why you think no one give you an answer how to resolve it.
Check List
Please check followings before submitting a new issue.
hexo version
to check)Promblem
I meet the problem "err: YAMLException: end of the stream or a document separator is expected"
I migration my markdown books from MkDocs to Hexo.
There is no Front-matter in my documents. There are more than 1000 markdown documents, so I can't add front-matter to every document.
If there is one ":" in my document, it will leading to this problem.
I found there are several template in the directory of scaffolds, "draft.md/page.md/post.md"
I want to :
How to do?
Is the problem still there under "Safe mode"?
Safe mode works fine.
Environment & Settings
Node.js & npm version(
node -v && npm -v
)