MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / extractFrontmatter

Function extractFrontmatter

tests/unit/services/MdbaseSpecService.test.ts:14–17  ·  view source on GitHub ↗

Extract the YAML frontmatter string (between --- delimiters) from markdown

(markdown: string)

Source from the content-addressed store, hash-verified

12
13/** Extract the YAML frontmatter string (between --- delimiters) from markdown */
14function extractFrontmatter(markdown: string): string {
15 const match = markdown.match(/^---\n([\s\S]*?)\n---/);
16 return match ? match[1] : "";
17}
18
19/** Extract the markdown body (after the closing ---) */
20function extractBody(markdown: string): string {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected