{"record":{"id":"d45d62b1351cc198","repo":"withastro/astro","slug":"colors-bold-plugin-not-applied","errorCode":null,"errorMessage":"${colors.bold(plugin)} not applied.","messagePattern":"(.+?) not applied\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/integrations/mdx/src/utils.ts","lineNumber":93,"sourceCode":"\t\ttype: 'mdxjsEsm',\n\t\tvalue: '',\n\t\tdata: {\n\t\t\t// @ts-expect-error `parse` return types is incompatible but it should work in runtime\n\t\t\testree: {\n\t\t\t\t...parse(jsString, acornOpts),\n\t\t\t\ttype: 'Program',\n\t\t\t\tsourceType: 'module',\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport function ignoreStringPlugins(plugins: any[], logger: AstroIntegrationLogger): PluggableList {\n\tlet validPlugins: PluggableList = [];\n\tlet hasInvalidPlugin = false;\n\tfor (const plugin of plugins) {\n\t\tif (typeof plugin === 'string') {\n\t\t\tlogger.warn(`${colors.bold(plugin)} not applied.`);\n\t\t\thasInvalidPlugin = true;\n\t\t} else if (Array.isArray(plugin) && typeof plugin[0] === 'string') {\n\t\t\tlogger.warn(`${colors.bold(plugin[0])} not applied.`);\n\t\t\thasInvalidPlugin = true;\n\t\t} else {\n\t\t\tvalidPlugins.push(plugin);\n\t\t}\n\t}\n\tif (hasInvalidPlugin) {\n\t\tlogger.warn(\n\t\t\t`To inherit Markdown plugins in MDX, please use explicit imports in your config instead of \"strings.\" See Markdown docs: https://docs.astro.build/en/guides/markdown-content/#markdown-plugins`,\n\t\t);\n\t}\n\treturn validPlugins;\n}\n","sourceCodeStart":75,"sourceCodeEnd":109,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/integrations/mdx/src/utils.ts#L75-L109","documentation":"The MDX integration drops any markdown plugin passed as a plain string (e.g. 'remark-gfm') from the markdown config it inherits. MDX compiles through its own Vite/esbuild pipeline, which can only use actual imported plugin functions, so string plugin names are filtered out by ignoreStringPlugins() with this warning. The plugin silently does not run for .mdx files while still working for .md files.","triggerScenarios":" astro.config.mjs sets markdown.remarkPlugins or markdown.rehypePlugins to an array containing a bare string, e.g. remarkPlugins: ['remark-gfm'], while the @astrojs/mdx integration is installed. MDX reads config.markdown plugins during astro:config:setup and hits the typeof plugin === 'string' branch of ignoreStringPlugins().","commonSituations":" Copying an older Astro v1-era config or a blog tutorial that registered plugins by name; sharing one markdown config between Astro and another tool (e.g. Eleventy or eslint-plugin-markdown) that accepts strings; passing tuples like ['rehype-external-links', {target:'_blank'}] where the first element is a string.","solutions":["Import the plugin and pass the function instead of the name: import remarkGfm from 'remark-gfm' then remarkPlugins: [remarkGfm].","For tuple plugins, import the function too: import rehypeExternalLinks from 'rehype-external-links' then rehypePlugins: [[rehypeExternalLinks, { target: '_blank' }]].","Keep syntax-highlighter style string options separate; only remarkPlugins/rehypePlugins need function references.","Rebuild after config changes (pnpm build) and confirm the warning no longer prints during 'astro:config:setup' for MDX."],"exampleFix":"// before (astro.config.mjs)\nexport default defineConfig({\n  markdown: { remarkPlugins: ['remark-gfm'] },\n  integrations: [mdx()],\n});\n\n// after\nimport remarkGfm from 'remark-gfm';\nexport default defineConfig({\n  markdown: { remarkPlugins: [remarkGfm] },\n  integrations: [mdx()],\n});","handlingStrategy":"type-guard","validationCode":"const isPluginRef = (p: unknown): boolean =>\n  typeof p === 'function' || (Array.isArray(p) && typeof p[0] === 'function');\nconst allValid = config.markdown.remarkPlugins.every(isPluginRef) &&\n  config.markdown.rehypePlugins.every(isPluginRef);","typeGuard":"type PluginRef = unknown;\nconst isPluginRef = (p: PluginRef): p is ((...a: any[]) => any) | [(...a: any[]) => any, any] =>\n  typeof p === 'function' || (Array.isArray(p) && typeof p[0] === 'function');","tryCatchPattern":null,"preventionTips":["Always import remark/rehype plugins and pass the function, never the package name string.","Add a config smoke test that asserts every markdown plugin entry is a function or a function-headed tuple.","Treat any 'not applied' warning in CI logs as a build failure for MDX content parity."],"tags":["mdx","remark","rehype","plugins","config","markdown"],"backgroundTag":"invalid-plugin-config","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}