2023-05-30 18:02:20 +03:00
|
|
|
import { PluggableList } from "unified"
|
|
|
|
import { StaticResources } from "../resources"
|
|
|
|
import { ProcessedContent } from "./vfile"
|
2023-06-02 00:35:31 +03:00
|
|
|
import { GlobalConfiguration } from "../cfg"
|
2023-06-03 22:07:19 +03:00
|
|
|
import { QuartzComponent } from "../components/types"
|
2023-05-30 18:02:20 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-06-01 00:01:23 +03:00
|
|
|
export type EmitCallback = (data: EmitOptions) => Promise<string>
|
2023-05-30 18:02:20 +03:00
|
|
|
export abstract class QuartzEmitterPlugin {
|
|
|
|
abstract name: string
|
2023-06-02 00:35:31 +03:00
|
|
|
abstract emit(cfg: GlobalConfiguration, content: ProcessedContent[], resources: StaticResources, emitCallback: EmitCallback): Promise<string[]>
|
2023-06-03 22:07:19 +03:00
|
|
|
abstract getQuartzComponents(): QuartzComponent<any>[]
|
2023-05-30 18:02:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface PluginTypes {
|
|
|
|
transformers: QuartzTransformerPlugin[],
|
|
|
|
filters: QuartzFilterPlugin[],
|
|
|
|
emitters: QuartzEmitterPlugin[],
|
|
|
|
}
|