docs(front_matter): complete documentation (#4166)

This commit is contained in:
Asher Gomez 2024-01-11 18:33:15 +11:00 committed by GitHub
parent 7cb9b2055a
commit eb214d4d13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,16 +7,19 @@ import {
type Format = "yaml" | "toml" | "json" | "unknown";
/** Return type for {@linkcode Extractor}. */
export type Extract<T> = {
frontMatter: string;
body: string;
attrs: T;
};
/** Function return type for {@linkcode createExtractor}. */
export type Extractor = <T = Record<string, unknown>>(
str: string,
) => Extract<T>;
/** Parser function type used alongside {@linkcode createExtractor}. */
export type Parser = <T = Record<string, unknown>>(str: string) => T;
function _extract<T>(