Skip to content
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

fix(frontmatter): issue with windows carriage return #1161

Merged
merged 1 commit into from May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 0 additions & 41 deletions src/runtime/markdown-parser/frontmatter.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/runtime/markdown-parser/index.ts
Expand Up @@ -9,7 +9,7 @@ import rehypeSortAttributeValues from 'rehype-sort-attribute-values'
import rehypeSortAttributes from 'rehype-sort-attributes'
import rehypeRaw from 'rehype-raw'
import { MarkdownOptions, Toc } from '../types'
import { parseFrontMatter } from './frontmatter'
import { parseFrontMatter } from './remark-mdc/frontmatter'
import { generateToc } from './toc'
import { contentHeading, generateBody } from './content'

Expand Down Expand Up @@ -92,4 +92,4 @@ function useExcerpt (content: string, delimiter = /<!--\s*?more\s*?-->/i) {
return content
}

export * from './frontmatter'
export * from './remark-mdc/frontmatter'
2 changes: 1 addition & 1 deletion src/runtime/markdown-parser/remark-mdc/frontmatter.ts
Expand Up @@ -22,7 +22,7 @@ export function stringifyFrontMatter (data: any, content: string = '') {

export function parseFrontMatter (content: string) {
let data = {}
if (content.startsWith(FRONTMATTER_DELIMITER + '\n')) {
if (content.startsWith(FRONTMATTER_DELIMITER)) {
const idx = content.indexOf('\n' + FRONTMATTER_DELIMITER)
if (idx !== -1) {
const frontmatter = content.slice(4, idx)
Expand Down