Skip to content

Commit 9e68c73

Browse files
committed
fix expressive code after rehype-external-links
1 parent 8a34864 commit 9e68c73

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/rehype-external-links.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@ import type { Plugin } from 'unified';
55
// eslint-disable-next-line @typescript-eslint/no-explicit-any
66
export const rehypeExternalLinks: [Plugin<any[], any>, any] = [
77
rehypeExternalLinksPlugin,
8-
{ target: '_blank', rel: ['noopener', 'noreferrer'] },
8+
{
9+
target: '_blank',
10+
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)',
14+
},
915
];

0 commit comments

Comments
 (0)