Skip to content

Commit 071ad79

Browse files
committed
readme for plugins
1 parent a2c07dc commit 071ad79

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,7 @@ Options:
129129
| -i, --img-output-path <string> | | Path to directory where images will be stored. If this is not included, images will be placed in the same directory as the document that uses them, which then allows for localization of screenshots. |
130130
| -p, --img-prefix-in-markdown <string> | | When referencing an image from markdown, prefix with this path instead of the full img-output-path. Should be used only in conjunction with --img-output-path. |
131131
| -h, --help | | display help for command |
132+
133+
# Plugins
134+
135+
If your project needs some processing that docu-notion doesn't already provide, you can provide a plugin that does it. See the [plugin readme](src/plugins/README.md).

src/plugins/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Plugins (Advanced & Experimental)
2+
3+
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:
4+
5+
1. Add a `docu-notion.config.ts` to the root level of your project directory.
6+
1. Add something like this:
7+
8+
```
9+
import { IDocuNotionConfig } from "docu-notion";
10+
11+
const config: IDocuNotionConfig = {
12+
plugins: [bloomBookEmbedding],
13+
};
14+
const dummyMarkdownModifier: IPlugin = {
15+
name: "dummyMarkdownModifier",
16+
17+
regexMarkdownModifications: [
18+
{
19+
regex: /aaa(.*)aaa/,
20+
replacementPattern: "bbb$1bbb",
21+
},
22+
],
23+
};
24+
const config: IDocuNotionConfig = {
25+
plugins: [dummyMarkdownModifier],
26+
};
27+
export default config;
28+
29+
```
30+
31+
For other available plugin points, see [pluginTypes.ts](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.
32+
33+
Once you have your plugin working, you have three options:
34+
35+
- just keep it as part of your Docusaurus project.
36+
- publish it to NPM so that others can use it. Let us know so that we can advertise it here.
37+
- talk to us about making it a built-in part of `docu-notion`

0 commit comments

Comments
 (0)