Skip to content

schemas/config/rendererConfig

Defined in: studiocms/packages/studiocms/src/schemas/config/rendererConfig.ts:28

Custom Renderer Type

A custom renderer that can be used in StudioCMS

const customRenderer: CustomRenderer = {
name: 'custom',
renderer: async (content: string) => {
return content;
},
};
#### Properties
<a id="name"></a>
##### name
```ts
name: string;

Defined in: studiocms/packages/studiocms/src/schemas/config/rendererConfig.ts:29

The name of the renderer

renderer: Renderer;

Defined in: studiocms/packages/studiocms/src/schemas/config/rendererConfig.ts:30

The renderer function

type Renderer = (content: string) => Promise<string>;

Defined in: studiocms/packages/studiocms/src/schemas/config/rendererConfig.ts:9

string

Promise<string>


type StudioCMSRendererConfig = {
markdocConfig: {
argParse: {
file: string;
location: boolean;
slots: boolean;
};
renderType: | "html"
| "react-static"
| MarkdocRenderer;
transformConfig: {
functions: Record<string, any>;
nodes: Record<string, {}>;
partials: Record<string, any>;
tags: Record<string, {}>;
validation: {
environment: string;
parents: any[];
validateFunctions: boolean;
};
variables: Record<string, any>;
};
};
mdxConfig: {
recmaPlugins: PluggableList;
rehypePlugins: PluggableList;
remarkPlugins: PluggableList;
remarkRehypeOptions: {
allowDangerousHtml: null | boolean;
clobberPrefix: null | string;
file: any;
footnoteBackContent: | null
| string
| (...args: [number, number, ...unknown[]]) =>
| string
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
}
| (
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
})[];
footnoteBackLabel: | null
| string
| (...args: [number, number, ...unknown[]]) => string;
footnoteLabel: null | string;
footnoteLabelProperties: | null
| Record<string, undefined | null | string | number | boolean | (string | number)[]>;
footnoteLabelTagName: null | string;
handlers: any;
passThrough: null | string[];
unknownHandler: any;
};
};
renderer: | "studiocms"
| "astro"
| "markdoc"
| "mdx"
| CustomRenderer;
studiocms: {
autoLinkHeadings: boolean;
callouts: {
enabled: boolean;
theme: "github" | "obsidian" | "vitepress";
};
discordSubtext: boolean;
sanitize: {
allowAttributes: Record<string, string[]>;
allowComments: boolean;
allowComponents: boolean;
allowCustomElements: boolean;
allowElements: string[];
blockElements: string[];
dropAttributes: Record<string, string[]>;
dropElements: string[];
};
};
};

Defined in: studiocms/packages/studiocms/src/schemas/config/rendererConfig.ts:89

Type for the StudioCMS Renderer Configuration

markdocConfig: {
argParse: {
file: string;
location: boolean;
slots: boolean;
};
renderType: | "html"
| "react-static"
| MarkdocRenderer;
transformConfig: {
functions: Record<string, any>;
nodes: Record<string, {}>;
partials: Record<string, any>;
tags: Record<string, {}>;
validation: {
environment: string;
parents: any[];
validateFunctions: boolean;
};
variables: Record<string, any>;
};
} = markdocConfigSchema;

Allows customization of the Markdoc Configuration

Markdoc is a powerful, flexible, Markdown-based authoring framework. Built by Stripe.

https://markdoc.dev/^ for more info about markdoc.

optional argParse: {
file: string;
location: boolean;
slots: boolean;
};

The MarkDoc Arg Parse to use for rendering pages and posts

optional file: string;

optional location: boolean;

optional slots: boolean;

renderType:
| "html"
| "react-static"
| MarkdocRenderer;

The MarkDoc Content Renderer to use for rendering pages and posts

Can be one of the following: html, react-static, or a custom renderer

optional transformConfig: {
functions: Record<string, any>;
nodes: Record<string, {}>;
partials: Record<string, any>;
tags: Record<string, {}>;
validation: {
environment: string;
parents: any[];
validateFunctions: boolean;
};
variables: Record<string, any>;
};

The MarkDoc Transform Config to use for rendering pages and posts

https://markdoc.dev/docs/config^

optional functions: Record<string, any>;

optional nodes: Record<string, {}>;

optional partials: Record<string, any>;

optional tags: Record<string, {}>;

optional validation: {
environment: string;
parents: any[];
validateFunctions: boolean;
};

optional environment: string;

optional parents: any[];

optional validateFunctions: boolean;

optional variables: Record<string, any>;

mdxConfig: {
recmaPlugins: PluggableList;
rehypePlugins: PluggableList;
remarkPlugins: PluggableList;
remarkRehypeOptions: {
allowDangerousHtml: null | boolean;
clobberPrefix: null | string;
file: any;
footnoteBackContent: | null
| string
| (...args: [number, number, ...unknown[]]) =>
| string
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
}
| (
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
})[];
footnoteBackLabel: | null
| string
| (...args: [number, number, ...unknown[]]) => string;
footnoteLabel: null | string;
footnoteLabelProperties: | null
| Record<string, undefined | null | string | number | boolean | (string | number)[]>;
footnoteLabelTagName: null | string;
handlers: any;
passThrough: null | string[];
unknownHandler: any;
};
} = mdxConfigSchema;

Allows customization of the MDX Configuration

MDX is a JSX in Markdown loader, parser, and renderer for ambitious projects.

https://mdxjs.com/^ for more info about MDX.

recmaPlugins: PluggableList;

List of recma plugins (optional); this is a new ecosystem, currently in beta, to transform esast trees (JavaScript)

rehypePlugins: PluggableList;

List of rehype plugins (optional).

remarkPlugins: PluggableList;

List of remark plugins (optional).

remarkRehypeOptions: {
allowDangerousHtml: null | boolean;
clobberPrefix: null | string;
file: any;
footnoteBackContent: | null
| string
| (...args: [number, number, ...unknown[]]) =>
| string
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
}
| (
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
})[];
footnoteBackLabel: | null
| string
| (...args: [number, number, ...unknown[]]) => string;
footnoteLabel: null | string;
footnoteLabelProperties: | null
| Record<string, undefined | null | string | number | boolean | (string | number)[]>;
footnoteLabelTagName: null | string;
handlers: any;
passThrough: null | string[];
unknownHandler: any;
};

Options to pass through to remark-rehype (optional); the option allowDangerousHtml will always be set to true and the MDX nodes (see nodeTypes) are passed through; In particular, you might want to pass configuration for footnotes if your content is not in English.

optional allowDangerousHtml: null | boolean;

optional clobberPrefix: null | string;

optional file: any;

optional footnoteBackContent:
| null
| string
| (...args: [number, number, ...unknown[]]) =>
| string
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
}
| (
| {
type: "comment";
value: string;
}
| {
children: any[];
properties: Record<string, any>;
tagName: string;
type: "element";
}
| {
type: "text";
value: string;
})[];

optional footnoteBackLabel:
| null
| string
| (...args: [number, number, ...unknown[]]) => string;

optional footnoteLabel: null | string;

optional footnoteLabelProperties:
| null
| Record<string, undefined | null | string | number | boolean | (string | number)[]>;

optional footnoteLabelTagName: null | string;

optional handlers: any;

optional passThrough: null | string[];

optional unknownHandler: any;

renderer:
| "studiocms"
| "astro"
| "markdoc"
| "mdx"
| CustomRenderer;

The Markdown Content Renderer to use for rendering pages and posts

Astro is the built-in Astro remark-markdown plugin.

Markdoc is a powerful, flexible, Markdown-based authoring framework. Built by Stripe.

studiocms: {
autoLinkHeadings: boolean;
callouts: {
enabled: boolean;
theme: "github" | "obsidian" | "vitepress";
};
discordSubtext: boolean;
sanitize: {
allowAttributes: Record<string, string[]>;
allowComments: boolean;
allowComponents: boolean;
allowCustomElements: boolean;
allowElements: string[];
blockElements: string[];
dropAttributes: Record<string, string[]>;
dropElements: string[];
};
} = StudioCMSMarkdownExtendedSchema;

Allows customization of the StudioCMS Markdown Extended Configuration

StudioCMS Markdown Extended is a collection of custom markdown features for StudioCMS.

https://github.com/withstudiocms/markdown-remark/tree/main^ for more info about StudioCMS Markdown Extended.

autoLinkHeadings: boolean;

callouts: {
enabled: boolean;
theme: "github" | "obsidian" | "vitepress";
};

enabled: boolean = true;

theme: "github" | "obsidian" | "vitepress";

discordSubtext: boolean;

optional sanitize: {
allowAttributes: Record<string, string[]>;
allowComments: boolean;
allowComponents: boolean;
allowCustomElements: boolean;
allowElements: string[];
blockElements: string[];
dropAttributes: Record<string, string[]>;
dropElements: string[];
} = StudioCMSSanitizeOptionsSchema;

optional allowAttributes: Record<string, string[]>;

An object where each key is the attribute name and the value is an array of allowed tag names. Matching attributes will not be removed. All attributes that are not in the array will be dropped.

optional allowComments: boolean;

A boolean value to remove HTML comments. Set to true in order to keep comments. Default is false.

optional allowComponents: boolean;

A boolean value to remove components and their children. If set to true, components will be subject to built-in and custom configuration checks (and will be retained or dropped based on those checks). Default is false.

optional allowCustomElements: boolean;

A boolean value to remove custom elements and their children. If set to true, custom elements will be subject to built-in and custom configuration checks (and will be retained or dropped based on those checks). Default is false

optional allowElements: string[];

An Array of strings indicating elements that the sanitizer should not remove. All elements not in the array will be dropped.

optional blockElements: string[];

An Array of strings indicating elements that the sanitizer should remove. Children will be kept.

optional dropAttributes: Record<string, string[]>;

An object where each key is the attribute name and the value is an array of dropped tag names. Matching attributes will be removed.

optional dropElements: string[];

An Array of strings indicating elements (including nested elements) that the sanitizer should remove.

const StudioCMSRendererConfigSchema: ZodDefault<StudioCMSRendererConfig>;

Defined in: studiocms/packages/studiocms/src/schemas/config/rendererConfig.ts:38

StudioCMS Renderer Configuration Schema

Allows customization of the current renderer being used

Re-exports markdocRenderer

Re-exports MarkdocRenderer

Re-exports TransformToProcessor