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 { const content = await read(path, false); if (test(content)) { let { attrs, body } = extract(content); attrs ??= {}; attrs.content = body; return attrs; } return { content }; }