Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/front_matter/yaml.ts>extract

The Deno Standard Library
Latest
variable extract
import { extract } from "https://deno.land/std@0.224.0/front_matter/yaml.ts";

Extracts and parses YAML from the metadata of front matter content.

Examples

Example 1

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

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

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