diff options
author | 2022-07-21 20:46:16 +0000 | |
---|---|---|
committer | 2022-07-21 20:46:16 +0000 | |
commit | c2968b05421bffe5e3f033e9c5423191ee6a1cf7 (patch) | |
tree | 8213466291b2dd39e5f316004a49648a0437a142 /packages/integrations/mdx/src/index.ts | |
parent | 3b8a7445247221100462ba035f6778b43ea180e7 (diff) | |
download | astro-c2968b05421bffe5e3f033e9c5423191ee6a1cf7.tar.gz astro-c2968b05421bffe5e3f033e9c5423191ee6a1cf7.tar.zst astro-c2968b05421bffe5e3f033e9c5423191ee6a1cf7.zip |
[ci] format
Diffstat (limited to 'packages/integrations/mdx/src/index.ts')
-rw-r--r-- | packages/integrations/mdx/src/index.ts | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index 2ac6cc66a..b33b09886 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -1,13 +1,13 @@ -import type { RemarkMdxFrontmatterOptions } from 'remark-mdx-frontmatter'; -import type { AstroIntegration } from 'astro'; -import remarkShikiTwoslash from 'remark-shiki-twoslash'; import { nodeTypes } from '@mdx-js/mdx'; -import rehypeRaw from 'rehype-raw'; import mdxPlugin, { Options as MdxRollupPluginOptions } from '@mdx-js/rollup'; +import type { AstroIntegration } from 'astro'; import { parse as parseESM } from 'es-module-lexer'; +import rehypeRaw from 'rehype-raw'; import remarkFrontmatter from 'remark-frontmatter'; import remarkGfm from 'remark-gfm'; +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 remarkPrism from './remark-prism.js'; import { getFileInfo } from './utils.js'; @@ -27,10 +27,7 @@ type MdxOptions = { 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 ?? [])]; @@ -56,7 +53,7 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration { ]); rehypePlugins.push([rehypeRaw, { passThrough: nodeTypes }]); } - + if (config.markdown.syntaxHighlight === 'prism') { remarkPlugins.push(remarkPrism); rehypePlugins.push([rehypeRaw, { passThrough: nodeTypes }]); |