@studiocms/markdoc
Version:
Add MarkDoc Support to your StudioCMS project with ease!
57 lines (39 loc) • 1.39 kB
Markdown
[](https://codecov.io/github/withstudiocms/studiocms)
Add MarkDoc support to StudioCMS
Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)
```ts
import { defineStudioCMSConfig } from 'studiocms/config';
import markdocPlugin from '@studiocms/markdoc';
export default defineStudioCMSConfig({
// other options here
plugins: [markdocPlugin()]
});
```
**Type:** `'html'` | `'react-static'` | [`MarkDocRenderer`](
**Default:** `'html'`
Set the type of MarkDoc rendering that you would like to do.
**Type:** `ParserArgs` | `undefined`
Optional Parser args for MarkDoc
**Type:** `ConfigType` | `undefined`
Optional Transform config for MarkDoc
**Type:** `{ name: string; render: (content: import('@markdoc/markdoc').RenderableTreeNode) => Promise<string>; }`
Example Renderer
```ts
import type { RenderableTreeNode } from '@markdoc/markdoc';
import type { MarkDocRenderer } from '@studiocms/markdoc/types';
export const renderHTML: MarkDocRenderer = {
name: 'html',
render: async (content: RenderableTreeNode) => {
return Markdoc.renderers.html(content);
},
};
```
[](./LICENSE).