UNPKG

@igor.dvlpr/strip-yaml-front-matter

Version:

🦓 Strips YAML front matter from a String or a file. 👾

22 lines (21 loc) • 657 B
/** * Strips YAML front matter from a String. * * Example YAML front matter: * * \--- * author: John Doe * publishDate: 27 Aug, 2024 * \--- * * @param content The string whose YAML front matter to strip. * @returns The original String without the YAML front matter. */ export declare function stripString(content: string): string; /** * Strips YAML front matter from a file. * @param path The path to the file. * @throws Will throw an error if the file path is not valid or the file cannot be read. * @returns The original file contents as a String without the YAML front matter. */ export declare function stripFile(path: string): string;