From a7e20804f5fe68dff7b71f3065f60e2147d633ba Mon Sep 17 00:00:00 2001 From: Sam Stokes Date: Mon, 4 Dec 2023 18:18:47 -0800 Subject: [PATCH] feat: Support space-delimited tags in `FrontMatter` transformer (#620) --- quartz/plugins/transformers/frontmatter.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quartz/plugins/transformers/frontmatter.ts b/quartz/plugins/transformers/frontmatter.ts index 04b1105c..017d3d1f 100644 --- a/quartz/plugins/transformers/frontmatter.ts +++ b/quartz/plugins/transformers/frontmatter.ts @@ -8,11 +8,13 @@ import { slugTag } from "../../util/path" export interface Options { delims: string | string[] language: "yaml" | "toml" + oneLineTagDelim: string } const defaultOptions: Options = { delims: "---", language: "yaml", + oneLineTagDelim: ",", } export const FrontMatter: QuartzTransformerPlugin | undefined> = (userOpts) => { @@ -20,6 +22,8 @@ export const FrontMatter: QuartzTransformerPlugin | undefined> return { name: "FrontMatter", markdownPlugins() { + const { oneLineTagDelim } = opts + return [ [remarkFrontmatter, ["yaml", "toml"]], () => { @@ -45,7 +49,7 @@ export const FrontMatter: QuartzTransformerPlugin | undefined> if (data.tags && !Array.isArray(data.tags)) { data.tags = data.tags .toString() - .split(",") + .split(oneLineTagDelim) .map((tag: string) => tag.trim()) }