Skip to content

Commit 80673e0

Browse files
committed
fix(stringify): empty line between frontmatter and content
1 parent e539b63 commit 80673e0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/frontmatter.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@ const FRONTMATTER_DELIMITER_CODEBLOCK_STYLE = '```yaml [props]'
66

77
export function stringifyFrontMatter(data: any, content = '') {
88
if (!Object.keys(data).length) {
9-
return ''
9+
return content.trim()
1010
}
1111

1212
data = flat.unflatten(data || {}, {})
1313

14-
return [
14+
const frontmatter = [
1515
FRONTMATTER_DELIMITER_DEFAULT,
1616
stringify(data).trim(),
1717
FRONTMATTER_DELIMITER_DEFAULT,
18-
content,
18+
'',
1919
].join('\n')
20+
21+
if (content) {
22+
return [frontmatter, content.trim(), ''].join('\n')
23+
}
24+
25+
return frontmatter
2026
}
2127

2228
export function stringifyCodeBlockProps(data: any, content = '') {

0 commit comments

Comments
 (0)