| | |
| | | import remarkFrontmatter from "remark-frontmatter" |
| | | import { QuartzTransformerPlugin } from "../types" |
| | | import yaml from "js-yaml" |
| | | import toml from "toml" |
| | | import { slugTag } from "../../util/path" |
| | | |
| | | export interface Options { |
| | | delims: string | string[] |
| | | language: "yaml" | "toml" |
| | | } |
| | | |
| | | const defaultOptions: Options = { |
| | | delims: "---", |
| | | language: "yaml", |
| | | } |
| | | |
| | | export const FrontMatter: QuartzTransformerPlugin<Partial<Options> | undefined> = (userOpts) => { |
| | |
| | | ...opts, |
| | | engines: { |
| | | yaml: (s) => yaml.load(s, { schema: yaml.JSON_SCHEMA }) as object, |
| | | toml: (s) => toml.parse(s) as object, |
| | | }, |
| | | }) |
| | | |