0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

refactor: add legacy.jsxInMarkdown flag to config

This commit is contained in:
bholmesdev 2022-07-21 11:04:37 -04:00
parent 29eef85ce5
commit 5572e8d9b3
2 changed files with 19 additions and 0 deletions

View file

@ -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

View file

@ -50,6 +50,9 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = {
rehypePlugins: [],
},
vite: {},
legacy: {
jsxInMarkdown: false,
}
};
async function resolvePostcssConfig(inlineOptions: any, root: URL): Promise<PostCSSConfigResult> {
@ -216,6 +219,12 @@ export const AstroConfigSchema = z.object({
vite: z
.custom<ViteUserConfig>((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 */