If your project needs some processing that docu-notion doesn't already provide, you can provide a plugin that does it. If there is call for it, we'll add more documentation in the future. But for now, here's the steps:
- Add a
docu-notion.config.ts
to the root level of your project directory. - Add something like this:
import { IDocuNotionConfig } from "docu-notion";
const dummyMarkdownModifier: IPlugin = {
name: "dummyMarkdownModifier",
regexMarkdownModifications: [
{
regex: /aaa(.*)aaa/,
replacementPattern: "bbb$1bbb",
},
],
};
const config: IDocuNotionConfig = {
plugins: [dummyMarkdownModifier],
};
export default config;
For other available plugin points, see pluginTypes.ts. All of the built-in processing is also done via built-in plugins, so those files and their unit tests should serve as good examples.
If your plugin needs custom parameters, just supply the user with a function that will return the IPlugin
in a closure containing the parameters. See docu-notion-config.ts for an example of this.
Once you have your plugin working, you have three options:
- just keep it as part of your Docusaurus project.
- publish it to NPM so that others can use it. Let us know so that we can advertise it here.
- talk to us about making it a built-in part of
docu-notion