diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index f4bb441c3c..317e03f179 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -704,6 +704,16 @@ export interface AstroUserConfig { buildOptions?: never; /** @deprecated `devOptions` has been renamed to `server` */ devOptions?: never; + + legacy?: { + /** + * Enable components and JSX expressions in markdown + * Consider our MDX integration before applying this flag! + * @see https://docs.astro.build/en/guides/integrations-guide/mdx/ + * Default: false + */ + jsxInMarkdown?: boolean; + }; } // NOTE(fks): We choose to keep our hand-generated AstroUserConfig interface so that diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index b474b29dfa..17f5483b94 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -50,6 +50,9 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = { rehypePlugins: [], }, vite: {}, + legacy: { + jsxInMarkdown: false, + } }; async function resolvePostcssConfig(inlineOptions: any, root: URL): Promise { @@ -216,6 +219,12 @@ export const AstroConfigSchema = z.object({ vite: z .custom((data) => data instanceof Object && !Array.isArray(data)) .default(ASTRO_CONFIG_DEFAULTS.vite), + legacy: z + .object({ + markdownJsx: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.legacy.jsxInMarkdown), + }) + .optional() + .default({}), }); /** Turn raw config values into normalized values */