index
Esta página aún no está disponible en tu idioma.
Functions
Section titled “Functions”studiocmsMD()
Section titled “studiocmsMD()”function studiocmsMD(options?: | { flavor: "astro"; sanitize: { allowAttributes: Record<string, string[]>; allowComments: boolean; allowComponents: boolean; allowCustomElements: boolean; allowElements: string[]; blockElements: string[]; dropAttributes: Record<string, string[]>; dropElements: string[]; }; } | { autoLinkHeadings: boolean; callouts: false | "github" | "obsidian" | "vitepress"; discordSubtext: boolean; flavor: "studiocms"; sanitize: { allowAttributes: Record<string, string[]>; allowComments: boolean; allowComponents: boolean; allowCustomElements: boolean; allowElements: string[]; blockElements: string[]; dropAttributes: Record<string, string[]>; dropElements: string[]; }; }): StudioCMSPlugin
Defined in: studiocms/packages/@studiocms/md/src/index.ts:35^
Creates a StudioCMS plugin for Markdown page types.
This plugin configures StudioCMS to support Markdown content, including rendering and editing components, integration with Astro, and optional callout themes. It resolves user-provided options, sets up virtual imports, and injects necessary styles and scripts for Markdown rendering.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional configuration for Markdown schema and rendering behavior.
{
flavor
: "astro"
;
sanitize
: {
allowAttributes
: Record
<string
, string
[]>;
allowComments
: boolean
;
allowComponents
: boolean
;
allowCustomElements
: boolean
;
allowElements
: string
[];
blockElements
: string
[];
dropAttributes
: Record
<string
, string
[]>;
dropElements
: string
[];
};
}
Optional configuration for Markdown schema and rendering behavior.
flavor
Section titled “flavor”"astro"
= ...
Specifies the Markdown flavor, fixed to ‘astro’. This property is used to differentiate between different Markdown configurations.
sanitize?
Section titled “sanitize?”{
allowAttributes
: Record
<string
, string
[]>;
allowComments
: boolean
;
allowComponents
: boolean
;
allowCustomElements
: boolean
;
allowElements
: string
[];
blockElements
: string
[];
dropAttributes
: Record
<string
, string
[]>;
dropElements
: string
[];
} = StudioCMSSanitizeOptionsSchema
Schema for options used to sanitize Markdown content in StudioCMS.
Remarks
This schema defines the configuration for controlling which elements and attributes are allowed, blocked, or dropped during the sanitization process. It also provides options for handling components, custom elements, and comments.
sanitize.allowAttributes?
Section titled “sanitize.allowAttributes?”Record
<string
, string
[]>
sanitize.allowComments?
Section titled “sanitize.allowComments?”boolean
sanitize.allowComponents?
Section titled “sanitize.allowComponents?”boolean
sanitize.allowCustomElements?
Section titled “sanitize.allowCustomElements?”boolean
sanitize.allowElements?
Section titled “sanitize.allowElements?”string
[]
sanitize.blockElements?
Section titled “sanitize.blockElements?”string
[]
sanitize.dropAttributes?
Section titled “sanitize.dropAttributes?”Record
<string
, string
[]>
sanitize.dropElements?
Section titled “sanitize.dropElements?”string
[]
|
{
autoLinkHeadings
: boolean
;
callouts
: false
| "github"
| "obsidian"
| "vitepress"
;
discordSubtext
: boolean
;
flavor
: "studiocms"
;
sanitize
: {
allowAttributes
: Record
<string
, string
[]>;
allowComments
: boolean
;
allowComponents
: boolean
;
allowCustomElements
: boolean
;
allowElements
: string
[];
blockElements
: string
[];
dropAttributes
: Record
<string
, string
[]>;
dropElements
: string
[];
};
}
Optional configuration for Markdown schema and rendering behavior.
autoLinkHeadings
Section titled “autoLinkHeadings”boolean
= ...
Optionally enables automatic linking of headings, defaults to true. This property allows users to automatically create links for headings in Markdown content.
callouts
Section titled “callouts”false
| "github"
| "obsidian"
| "vitepress"
= ...
Optional callouts style, defaults to ‘obsidian’. This property allows users to choose a specific callout theme for Markdown content.
discordSubtext
Section titled “discordSubtext”boolean
= ...
Optionally enables Discord subtext, defaults to true. This property allows users to include Discord-style subtext in Markdown content.
flavor
Section titled “flavor”"studiocms"
= ...
Specifies the markdown flavor, fixed to ‘studiocms’. This property is used to differentiate between different Markdown configurations.
sanitize?
Section titled “sanitize?”{
allowAttributes
: Record
<string
, string
[]>;
allowComments
: boolean
;
allowComponents
: boolean
;
allowCustomElements
: boolean
;
allowElements
: string
[];
blockElements
: string
[];
dropAttributes
: Record
<string
, string
[]>;
dropElements
: string
[];
} = StudioCMSSanitizeOptionsSchema
Schema for options used to sanitize Markdown content in StudioCMS.
Remarks
This schema defines the configuration for controlling which elements and attributes are allowed, blocked, or dropped during the sanitization process. It also provides options for handling components, custom elements, and comments.
sanitize.allowAttributes?
Section titled “sanitize.allowAttributes?”Record
<string
, string
[]>
sanitize.allowComments?
Section titled “sanitize.allowComments?”boolean
sanitize.allowComponents?
Section titled “sanitize.allowComponents?”boolean
sanitize.allowCustomElements?
Section titled “sanitize.allowCustomElements?”boolean
sanitize.allowElements?
Section titled “sanitize.allowElements?”string
[]
sanitize.blockElements?
Section titled “sanitize.blockElements?”string
[]
sanitize.dropAttributes?
Section titled “sanitize.dropAttributes?”Record
<string
, string
[]>
sanitize.dropElements?
Section titled “sanitize.dropElements?”string
[]
Returns
Section titled “Returns”StudioCMSPlugin
A StudioCMSPlugin instance configured for Markdown support.
Remarks
Section titled “Remarks”- Supports custom callout themes if enabled in options.
- Integrates with Astro via virtual imports and injected scripts.
- Stores resolved options and Astro markdown configuration in shared context.
Example
Section titled “Example”import { studiocmsMD } from '@studiocms/md';const plugin = studiocmsMD({ flavor: 'studiocms', callouts: 'obsidian' });
References
Section titled “References”default
Section titled “default”Renames and re-exports studiocmsMD