Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Dec 5, 2024
1 parent fac9fc4 commit be95adc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/markdown/remark/src/frontmatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export function isFrontmatterValid(frontmatter: Record<string, any>) {
return typeof frontmatter === 'object' && frontmatter !== null;
}

// Capture frontmatter wrapped with `---`, including any characters and new lines within it.
// Only capture if it exists near the top of the file (whitespaces between the start of file and
// the start of `---` are allowed)
const frontmatterRE = /^\s*---([\s\S]*?\n)---/;
export function extractFrontmatter(code: string): string | undefined {
return frontmatterRE.exec(code)?.[1];
Expand Down

0 comments on commit be95adc

Please sign in to comment.