diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index 9313d10ee..8b7831f27 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -1,4 +1,3 @@ -import type { Plugin as VitePlugin } from 'vite'; import { nodeTypes } from '@mdx-js/mdx'; import mdxPlugin, { Options as MdxRollupPluginOptions } from '@mdx-js/rollup'; import type { AstroIntegration } from 'astro'; @@ -10,6 +9,7 @@ import type { RemarkMdxFrontmatterOptions } from 'remark-mdx-frontmatter'; import remarkMdxFrontmatter from 'remark-mdx-frontmatter'; import remarkShikiTwoslash from 'remark-shiki-twoslash'; import remarkSmartypants from 'remark-smartypants'; +import type { Plugin as VitePlugin } from 'vite'; import remarkPrism from './remark-prism.js'; import { getFileInfo, getFrontmatter } from './utils.js'; @@ -77,7 +77,7 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration { // Note: disable `.md` support format: 'mdx', mdExtensions: [], - }) + }); updateConfig({ vite: { @@ -98,14 +98,14 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration { const frontmatter = getFrontmatter(code, id); if (frontmatter.layout) { const { layout, ...content } = frontmatter; - code += `\nexport default async function({ children }) {\nconst Layout = (await import(${ - JSON.stringify(frontmatter.layout) - })).default;\nreturn {children} }` + code += `\nexport default async function({ children }) {\nconst Layout = (await import(${JSON.stringify( + frontmatter.layout + )})).default;\nreturn {children} }`; } return mdxPluginTransform?.(code, id); - } + }, }, { name: '@astrojs/mdx', diff --git a/packages/integrations/mdx/src/utils.ts b/packages/integrations/mdx/src/utils.ts index 97bc72d74..ccce179c9 100644 --- a/packages/integrations/mdx/src/utils.ts +++ b/packages/integrations/mdx/src/utils.ts @@ -42,7 +42,7 @@ export function getFileInfo(id: string, config: AstroConfig): FileInfo { /** * Match YAML exception handling from Astro core errors * @see 'astro/src/core/errors.ts' - */ + */ export function getFrontmatter(code: string, id: string) { try { return matter(code).data;