extract<T>(text: string): Extract<T>
Extracts and parses YAML, TOML, or JSON from the metadata of front matter content, depending on the format.
Usage
Usage
import { extract } from "@std/front-matter/any"; import { assertEquals } from "@std/assert"; const output = `---json { "title": "Three dashes marks the spot" } --- Hello, world!`; const result = extract(output); assertEquals(result, { frontMatter: '{\n "title": "Three dashes marks the spot"\n}', body: "Hello, world!", attrs: { title: "Three dashes marks the spot" } })
text: string
The text to extract front matter from.