Skip to main content
Module

std/front_matter/toml.ts>extract

Deno standard library
Go to Latest
variable extract
import { extract } from "https://deno.land/std@0.221.0/front_matter/toml.ts";

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

Examples

Example 1

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

const output = `---toml
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" }