mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-03 07:18:14 +00:00
refactor plugins to be functions instead of classes
This commit is contained in:
parent
b8c011410d
commit
352075ae81
20 changed files with 464 additions and 507 deletions
quartz/plugins/filters
|
@ -1,10 +1,9 @@
|
|||
import { QuartzFilterPlugin } from "../types"
|
||||
import { ProcessedContent } from "../vfile"
|
||||
|
||||
export class RemoveDrafts extends QuartzFilterPlugin {
|
||||
name = "RemoveDrafts"
|
||||
shouldPublish([_tree, vfile]: ProcessedContent): boolean {
|
||||
export const RemoveDrafts: QuartzFilterPlugin<{}> = () => ({
|
||||
name: "RemoveDrafts",
|
||||
shouldPublish([_tree, vfile]) {
|
||||
const draftFlag: boolean = vfile.data?.frontmatter?.draft ?? false
|
||||
return !draftFlag
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { QuartzFilterPlugin } from "../types"
|
||||
import { ProcessedContent } from "../vfile"
|
||||
|
||||
export class ExplicitPublish extends QuartzFilterPlugin {
|
||||
name = "ExplicitPublish"
|
||||
shouldPublish([_tree, vfile]: ProcessedContent): boolean {
|
||||
export const ExplicitPublish: QuartzFilterPlugin = () => ({
|
||||
name: "ExplicitPublish",
|
||||
shouldPublish([_tree, vfile]) {
|
||||
const publishFlag: boolean = vfile.data?.frontmatter?.publish ?? false
|
||||
return publishFlag
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue