mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-22 22:15:42 -05:00
Migrate filters to external plugins (remove-draft, explicit-publish)
Delete internal RemoveDrafts and ExplicitPublish filter implementations, install them as community plugins, and update quartz.config.ts to use ExternalPlugin.RemoveDrafts().
This commit is contained in:
parent
074951afea
commit
70ef4f9fd5
@ -70,7 +70,7 @@ const config: QuartzConfig = {
|
|||||||
ExternalPlugin.Description(),
|
ExternalPlugin.Description(),
|
||||||
ExternalPlugin.Latex({ renderEngine: "katex" }),
|
ExternalPlugin.Latex({ renderEngine: "katex" }),
|
||||||
],
|
],
|
||||||
filters: [Plugin.RemoveDrafts()],
|
filters: [ExternalPlugin.RemoveDrafts()],
|
||||||
emitters: [
|
emitters: [
|
||||||
Plugin.AliasRedirects(),
|
Plugin.AliasRedirects(),
|
||||||
Plugin.ComponentResources(),
|
Plugin.ComponentResources(),
|
||||||
@ -122,6 +122,8 @@ const config: QuartzConfig = {
|
|||||||
"github:quartz-community/citations",
|
"github:quartz-community/citations",
|
||||||
"github:quartz-community/ox-hugo",
|
"github:quartz-community/ox-hugo",
|
||||||
"github:quartz-community/roam",
|
"github:quartz-community/roam",
|
||||||
|
"github:quartz-community/remove-draft",
|
||||||
|
"github:quartz-community/explicit-publish",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -174,6 +174,18 @@
|
|||||||
"resolved": "https://github.com/quartz-community/roam.git",
|
"resolved": "https://github.com/quartz-community/roam.git",
|
||||||
"commit": "b6e6fab11cde1430d396822ebcefd501b486adf1",
|
"commit": "b6e6fab11cde1430d396822ebcefd501b486adf1",
|
||||||
"installedAt": "2026-02-13T22:03:27.359Z"
|
"installedAt": "2026-02-13T22:03:27.359Z"
|
||||||
|
},
|
||||||
|
"remove-draft": {
|
||||||
|
"source": "github:quartz-community/remove-draft",
|
||||||
|
"resolved": "https://github.com/quartz-community/remove-draft.git",
|
||||||
|
"commit": "6f7fbeb4b092e7549e3e04b8de5e830f5660015d",
|
||||||
|
"installedAt": "2026-02-13T22:27:58.368Z"
|
||||||
|
},
|
||||||
|
"explicit-publish": {
|
||||||
|
"source": "github:quartz-community/explicit-publish",
|
||||||
|
"resolved": "https://github.com/quartz-community/explicit-publish.git",
|
||||||
|
"commit": "f870ac6a13d297c0f4451986c7f7042f006c3b38",
|
||||||
|
"installedAt": "2026-02-13T22:28:08.774Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
import { QuartzFilterPlugin } from "../types"
|
|
||||||
|
|
||||||
export const RemoveDrafts: QuartzFilterPlugin<{}> = () => ({
|
|
||||||
name: "RemoveDrafts",
|
|
||||||
shouldPublish(_ctx, [_tree, vfile]) {
|
|
||||||
const draftFlag: boolean =
|
|
||||||
vfile.data?.frontmatter?.draft === true || vfile.data?.frontmatter?.draft === "true"
|
|
||||||
return !draftFlag
|
|
||||||
},
|
|
||||||
})
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
import { QuartzFilterPlugin } from "../types"
|
|
||||||
|
|
||||||
export const ExplicitPublish: QuartzFilterPlugin = () => ({
|
|
||||||
name: "ExplicitPublish",
|
|
||||||
shouldPublish(_ctx, [_tree, vfile]) {
|
|
||||||
return vfile.data?.frontmatter?.publish === true || vfile.data?.frontmatter?.publish === "true"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
@ -1,2 +1 @@
|
|||||||
export { RemoveDrafts } from "./draft"
|
export {}
|
||||||
export { ExplicitPublish } from "./explicit"
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user