Skip to content

Commit 3b3c612

Browse files
committed
fix external links success, pass rehypePlugins ony in markdown, remove from mdx
1 parent 6395c69 commit 3b3c612

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

astro.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ export default defineConfig({
3232
expressiveCodeIntegration(),
3333
sitemapIntegration(),
3434
react(),
35-
mdx({
36-
/* rehypePlugins */
37-
}), // todo: breaks expressive-code, disable it
35+
// don't pass any plugins here, it will disable all mdx integrations, e.g. expressive-code above
36+
mdx(),
3837
// applyBaseStyles: false prevents double loading of tailwind
3938
tailwind({ applyBaseStyles: false }),
4039
icon({ iconDir: 'src/assets/icons' }),
4140
partytown({
4241
config: { forward: ['dataLayer.push'] },
4342
}),
4443
],
45-
markdown: { remarkPlugins /* rehypePlugins */ },
44+
// pass rehype plugins only here, mdx will reuse them
45+
markdown: { remarkPlugins, rehypePlugins },
4646
vite: {
4747
build: {
4848
sourcemap: false,

plugins/rehype-external-links.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,5 @@ export const rehypeExternalLinks: [Plugin<any[], any>, any] = [
88
{
99
target: '_blank',
1010
rel: ['noopener', 'noreferrer'],
11-
// filter out expressive-code, important
12-
// skip <a> tags inside <pre> or <code>
13-
selectors: 'a:not(pre a):not(code a)',
1411
},
1512
];

0 commit comments

Comments
 (0)