fix(markdown): trailing spaces after front matters are allowed (#5107)

```md
---···· <--- allowed
yaml
---···· <--- allowed

markdown
```
master
Ika 2018-09-21 19:51:03 +08:00 committed by GitHub
parent 27bf64f6ce
commit 0cbacd3156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 2 deletions

View File

@ -13,14 +13,17 @@ function parse(text) {
.join("|");
const match = text.match(
new RegExp(`^(${delimiterRegex})\\n(?:([\\s\\S]*?)\\n)?\\1(\\n|$)`)
// trailing spaces after delimiters are allowed
new RegExp(
`^(${delimiterRegex})[^\\n\\S]*\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)`
)
);
if (match === null) {
return { frontMatter: null, content: text };
}
const raw = match[0].trimRight();
const raw = match[0].replace(/\n$/, "");
const delimiter = match[1];
const value = match[2];

View File

@ -64,3 +64,22 @@ hello: world
Content
`;
exports[`trailing-spaces.md - markdown-verify 1`] = `
---
v spaces
---
This paragraph should be considered part of the _markdown_ instead of *yaml*.
---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
v spaces
---
This paragraph should be considered part of the _markdown_ instead of _yaml_.
---
`;

View File

@ -0,0 +1,7 @@
---
v spaces
---
This paragraph should be considered part of the _markdown_ instead of *yaml*.
---