Skip to content

Commit

Permalink
fix(frontmatter): issue with windows carriage return (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed May 27, 2022
1 parent e23e86e commit 047b2f2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
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

0 comments on commit 047b2f2

Please sign in to comment.