deno.land / x / lume@v2.1.4 / core / loaders / text.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { extract, test } from "../../deps/front_matter.ts";import { read } from "../utils/read.ts";
import type { RawData } from "../file.ts";
/** Load a text file. Detect and parse the front matter */export default async function text(path: string): Promise<RawData> { const content = await read(path, false);
if (test(content)) { let { attrs, body } = extract<RawData>(content); attrs ??= {}; attrs.content = body;
return attrs; }
return { content };}
lume

Version Info

Tagged at
7 months ago