Skip to main content
Module

x/fastro/middleware/markdown/deps.ts>extract

Full Stack Framework for Deno, TypeScript, Preact JS and Tailwind CSS
Go to Latest
variable extract
import { extract } from "https://deno.land/x/fastro@v0.88.3/middleware/markdown/deps.ts";

Extracts and parses YAML, TOML, or JSON from the metadata of front matter content, depending on the format.

Examples

Example 1

import { extract } from "https://deno.land/std@0.224.0/front_matter/any.ts";

const output = `---json
{
  "title": "Three dashes marks the spot"
}
---
Hello, world!`;
const result = extract(output);

result.frontMatter; // '{\n "title": "Three dashes marks the spot"\n}'
result.body; // "Hello, world!"
result.attrs; // { title: "Three dashes marks the spot" }

type

Extractor