Contribute
Note: Please create a new branch based on the main, develop on the new branch, and create PR to main after development
Install dependency
bashpnpm install
Add process middleware
typescriptexport default async function customMiddleware(context: ProcessorContext, visit: TVisitor, next: Next) { //visit:In depth priority traversing Markdown AST's interface, which is convenient for users to modify node. Note that this process is synchronized. If you want to process it asynchronous, find the corresponding Node first, then add asynchronous processing. //next: Call next after processing, otherwise it will cause stuck and will not execute }
Add publish plugin
typescriptexport function XXXPublisherPlugin(option: any) { return { name: "XXXPublisherPlugin", async process(articleTitle: string, visit: TVisitor, toMarkdown: ToMarkdown): Promise<PublishResult> => { //visit:In depth priority traversing Markdown AST's interface, which is convenient for users to modify node. Note that this process is synchronized. //toMarkdown: The modified AST will regenerate markdown. Content is Markdown content let { content } = toMarkdown(); let res: PublishResult = { success: true, info: "Published to XXX", }; //TODO: return res; } }; }
build
bashpnpm build
playground:
- First pnpm Build package artipub
- cd playground for verification test (Note: Do not submit the file in playground, only local tests)