wiki/quartz/plugins/types.ts

34 lines
956 B
TypeScript
Raw Normal View History

2023-05-30 15:02:20 +00:00
import { PluggableList } from "unified"
import { StaticResources } from "../resources"
import { ProcessedContent } from "./vfile"
export abstract class QuartzTransformerPlugin {
abstract name: string
abstract markdownPlugins(): PluggableList
abstract htmlPlugins(): PluggableList
externalResources?: Partial<StaticResources>
}
export abstract class QuartzFilterPlugin {
abstract name: string
abstract shouldPublish(content: ProcessedContent): boolean
}
export interface EmitOptions {
slug: string
ext: `.${string}`
content: string
}
export type EmitCallback = (data: EmitOptions) => Promise<string>
2023-05-30 15:02:20 +00:00
export abstract class QuartzEmitterPlugin {
abstract name: string
abstract emit(content: ProcessedContent[], resources: StaticResources, emitCallback: EmitCallback): Promise<string[]>
2023-05-30 15:02:20 +00:00
}
export interface PluginTypes {
transformers: QuartzTransformerPlugin[],
filters: QuartzFilterPlugin[],
emitters: QuartzEmitterPlugin[],
}