Saltearse al contenido

index

Esta página aún no está disponible en tu idioma.

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.

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.

"astro" = ...

Specifies the Markdown flavor, fixed to ‘astro’. This property is used to differentiate between different Markdown configurations.

{ 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.

Record<string, string[]>

boolean

boolean

boolean

string[]

string[]

Record<string, string[]>

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.

boolean = ...

Optionally enables automatic linking of headings, defaults to true. This property allows users to automatically create links for headings in Markdown content.

false | "github" | "obsidian" | "vitepress" = ...

Optional callouts style, defaults to ‘obsidian’. This property allows users to choose a specific callout theme for Markdown content.

boolean = ...

Optionally enables Discord subtext, defaults to true. This property allows users to include Discord-style subtext in Markdown content.

"studiocms" = ...

Specifies the markdown flavor, fixed to ‘studiocms’. This property is used to differentiate between different Markdown configurations.

{ 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.

Record<string, string[]>

boolean

boolean

boolean

string[]

string[]

Record<string, string[]>

string[]

StudioCMSPlugin

A StudioCMSPlugin instance configured for Markdown support.

  • 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.
import { studiocmsMD } from '@studiocms/md';
const plugin = studiocmsMD({ flavor: 'studiocms', callouts: 'obsidian' });

Renames and re-exports studiocmsMD