David Fischer
2024-11-09 31e0b7c6f802cfab7250b7e9dfb321b3889ef6ca
quartz/plugins/transformers/frontmatter.ts
@@ -8,12 +8,12 @@
import { i18n } from "../../i18n"
export interface Options {
  delims: string | string[]
  delimiters: string | [string, string]
  language: "yaml" | "toml"
}
const defaultOptions: Options = {
  delims: "---",
  delimiters: "---",
  language: "yaml",
}
@@ -40,7 +40,7 @@
    .map((tag: string | number) => tag.toString())
}
export const FrontMatter: QuartzTransformerPlugin<Partial<Options> | undefined> = (userOpts) => {
export const FrontMatter: QuartzTransformerPlugin<Partial<Options>> = (userOpts) => {
  const opts = { ...defaultOptions, ...userOpts }
  return {
    name: "FrontMatter",
@@ -57,9 +57,9 @@
              },
            })
            if (data.title) {
            if (data.title != null && data.title.toString() !== "") {
              data.title = data.title.toString()
            } else if (data.title === null || data.title === undefined) {
            } else {
              data.title = file.stem ?? i18n(cfg.configuration.locale).propertyDefaults.title
            }
@@ -88,10 +88,12 @@
        tags: string[]
        aliases: string[]
        description: string
        publish: boolean
        draft: boolean
        publish: boolean | string
        draft: boolean | string
        lang: string
        enableToc: string
        cssclasses: string[]
        comments: boolean | string
      }>
  }
}