deno.land / std@0.224.0 / front_matter / toml.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { createExtractor, type Extractor, type Parser,} from "./create_extractor.ts";import { parse } from "../toml/parse.ts";
/** * Extracts and parses {@link https://toml.io | TOML} from the metadata of * front matter content. * * @example * ```ts * import { extract } from "https://deno.land/std@$STD_VERSION/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" } * ``` */export const extract: Extractor = createExtractor({ ["toml"]: parse as Parser,});
std

Version Info

Tagged at
3 weeks ago