-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdxOptions.js
34 lines (32 loc) · 942 Bytes
/
mdxOptions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import remarkGfm from 'remark-gfm';
import remarkUnwrapImages from 'remark-unwrap-images';
import rehypeSlug from 'rehype-slug';
import rehypePrettyCode from 'rehype-pretty-code';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
const mdxOptions = {
remarkPlugins: [remarkGfm, remarkUnwrapImages],
rehypePlugins: [
rehypeSlug,
[
rehypePrettyCode,
{
theme: 'one-dark-pro',
onVisitLine(node) {
if (node.children.length === 0) {
node.children = [{ type: 'text', value: ' ' }];
}
},
onVisitHighlightedLine(node) {
node.properties.className.push('line--highlighted');
},
onVisitHighlightedWord(node) {
node.properties.className = ['word--highlighted'];
},
},
],
[rehypeAutolinkHeadings, { properties: { className: ['anchor'] } }],
rehypeAccessibleEmojis,
],
};
export default mdxOptions;