diff options
author | 2022-07-21 01:36:26 +0000 | |
---|---|---|
committer | 2022-07-21 01:36:26 +0000 | |
commit | 29eef85ce55d0d8aad87c321613302d2b9dc5eee (patch) | |
tree | 1d674731cbf8e681bd95c3b943b43992ae711a38 /packages/integrations/mdx/src | |
parent | b2b367c969493aaf21c974064beb241d05228066 (diff) | |
download | astro-29eef85ce55d0d8aad87c321613302d2b9dc5eee.tar.gz astro-29eef85ce55d0d8aad87c321613302d2b9dc5eee.tar.zst astro-29eef85ce55d0d8aad87c321613302d2b9dc5eee.zip |
[ci] formatastro@0.0.0-rc-20220721064837@astrojs/vue@0.0.0-rc-20220721064837@astrojs/vercel@0.0.0-rc-20220721064837@astrojs/svelte@0.0.0-rc-20220721064837@astrojs/node@0.0.0-rc-20220721064837@astrojs/netlify@0.0.0-rc-20220721064837@astrojs/mdx@0.0.0-rc-20220721064837@astrojs/markdown-component@0.0.0-rc-20220721064837@astrojs/image@0.0.0-rc-20220721064837@astrojs/deno@0.0.0-rc-20220721064837@astrojs/cloudflare@0.0.0-rc-20220721064837
Diffstat (limited to 'packages/integrations/mdx/src')
-rw-r--r-- | packages/integrations/mdx/src/index.ts | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index d91f71c4b..66ab7b837 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -1,11 +1,11 @@ import mdxPlugin, { Options as MdxRollupPluginOptions } from '@mdx-js/rollup'; import type { AstroIntegration } from 'astro'; -import type { RemarkMdxFrontmatterOptions } from 'remark-mdx-frontmatter'; import { parse as parseESM } from 'es-module-lexer'; -import remarkGfm from 'remark-gfm'; -import remarkSmartypants from 'remark-smartypants'; import remarkFrontmatter from 'remark-frontmatter'; +import remarkGfm from 'remark-gfm'; +import type { RemarkMdxFrontmatterOptions } from 'remark-mdx-frontmatter'; import remarkMdxFrontmatter from 'remark-mdx-frontmatter'; +import remarkSmartypants from 'remark-smartypants'; import { getFileInfo } from './utils.js'; type WithExtends<T> = T | { extends: T }; @@ -18,15 +18,12 @@ type MdxOptions = { * @see https://github.com/remcohaszing/remark-mdx-frontmatter#options for a full list of options * @default {{ name: 'frontmatter' }} */ - frontmatterOptions?: RemarkMdxFrontmatterOptions; -} + frontmatterOptions?: RemarkMdxFrontmatterOptions; +}; const DEFAULT_REMARK_PLUGINS = [remarkGfm, remarkSmartypants]; -function handleExtends<T>( - config: WithExtends<T[] | undefined>, - defaults: T[] = [], -): T[] { +function handleExtends<T>(config: WithExtends<T[] | undefined>, defaults: T[] = []): T[] { if (Array.isArray(config)) return config; return [...defaults, ...(config?.extends ?? [])]; @@ -50,10 +47,13 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration { // We can revisit this if a strong use case to *remove* // YAML frontmatter via config is reported. remarkFrontmatter, - [remarkMdxFrontmatter, { - name: 'frontmatter', - ...mdxOptions.frontmatterOptions, - }], + [ + remarkMdxFrontmatter, + { + name: 'frontmatter', + ...mdxOptions.frontmatterOptions, + }, + ], ], rehypePlugins: handleExtends(mdxOptions.rehypePlugins), jsx: true, |