Skip to content

types

type AstroMarkdownOptions = {
flavor: "astro";
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/md/src/types.ts:82^

Schema definition for Astro-flavored Markdown content.

flavor: "astro";

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

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

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.

optional allowAttributes: Record<string, string[]>;
optional allowComments: boolean;
optional allowComponents: boolean;
optional allowCustomElements: boolean;
optional allowElements: string[];
optional blockElements: string[];
optional dropAttributes: Record<string, string[]>;
optional dropElements: string[];

This schema is used to validate Markdown objects that are specifically intended for use with the Astro flavor. It ensures that the flavor property is set to 'astro' and that the sanitize property conforms to the StudioCMSSanitizeOptionsSchema.


type MarkdownSchemaOptions =
| {
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[];
};
};

Defined in: studiocms/packages/@studiocms/md/src/types.ts:84^

Defines a Zod schema for Markdown content, allowing either AstroMarkdownSchema or StudioCMSMarkdownSchema. The schema is optional and defaults to an object with the flavor set to ‘studiocms’.

{
flavor: "astro";
sanitize?: {
allowAttributes?: Record<string, string[]>;
allowComments?: boolean;
allowComponents?: boolean;
allowCustomElements?: boolean;
allowElements?: string[];
blockElements?: string[];
dropAttributes?: Record<string, string[]>;
dropElements?: string[];
};
}
flavor: "astro";

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

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

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.

optional allowAttributes: Record<string, string[]>;
optional allowComments: boolean;
optional allowComponents: boolean;
optional allowCustomElements: boolean;
optional allowElements: string[];
optional blockElements: string[];
optional dropAttributes: Record<string, string[]>;
optional 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[];
};
}
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: false | "github" | "obsidian" | "vitepress";

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

discordSubtext: boolean;

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

flavor: "studiocms";

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

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

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.

optional allowAttributes: Record<string, string[]>;
optional allowComments: boolean;
optional allowComponents: boolean;
optional allowCustomElements: boolean;
optional allowElements: string[];
optional blockElements: string[];
optional dropAttributes: Record<string, string[]>;
optional dropElements: string[];

This schema is useful for validating Markdown data that may conform to different formats, providing flexibility in content handling within the application.


type StudioCMSMarkdownOptions = {
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[];
};
};

Defined in: studiocms/packages/@studiocms/md/src/types.ts:83^

Schema definition for StudioCMS Markdown configuration.

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: false | "github" | "obsidian" | "vitepress";

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

discordSubtext: boolean;

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

flavor: "studiocms";

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

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

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.

optional allowAttributes: Record<string, string[]>;
optional allowComments: boolean;
optional allowComponents: boolean;
optional allowCustomElements: boolean;
optional allowElements: string[];
optional blockElements: string[];
optional dropAttributes: Record<string, string[]>;
optional dropElements: string[];

const AstroMarkdownSchema: ZodObject<AstroMarkdownOptions>;

Defined in: studiocms/packages/@studiocms/md/src/types.ts:17^

Schema definition for Astro-flavored Markdown content.

This schema is used to validate Markdown objects that are specifically intended for use with the Astro flavor. It ensures that the flavor property is set to 'astro' and that the sanitize property conforms to the StudioCMSSanitizeOptionsSchema.


const MarkdownSchema: ZodDefault<MarkdownSchemaOptions>;

Defined in: studiocms/packages/@studiocms/md/src/types.ts:77^

Defines a Zod schema for Markdown content, allowing either AstroMarkdownSchema or StudioCMSMarkdownSchema. The schema is optional and defaults to an object with the flavor set to ‘studiocms’.

This schema is useful for validating Markdown data that may conform to different formats, providing flexibility in content handling within the application.


const StudioCMSMarkdownSchema: ZodObject<StudioCMSMarkdownOptions>;

Defined in: studiocms/packages/@studiocms/md/src/types.ts:43^

Schema definition for StudioCMS Markdown configuration.