-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathplugins.mjs
More file actions
40 lines (35 loc) · 1.23 KB
/
plugins.mjs
File metadata and controls
40 lines (35 loc) · 1.23 KB
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
35
36
37
38
39
40
'use strict';
import rehypeShikiji from '@node-core/rehype-shiki/plugin';
import platform from '@platform/next.config.mjs';
import remarkHeadings from '@vcarl/remark-headings';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
import remarkGfm from 'remark-gfm';
import readingTime from 'remark-reading-time';
import remarkTableTitles from '../util/table';
// Shiki is created out here to avoid an async rehype plugin
const singletonShiki = await rehypeShikiji(platform.mdx);
/**
* Provides all our Rehype Plugins that are used within MDX
*/
export const rehypePlugins = [
// Generates `id` attributes for headings (H1, ...)
rehypeSlug,
// Automatically add anchor links to headings (H1, ...)
[rehypeAutolinkHeadings, { behavior: 'wrap' }],
// Transforms sequential code elements into code tabs and
// adds our syntax highlighter (Shikiji) to Codeboxes
() => singletonShiki,
];
/**
* Provides all our Remark Plugins that are used within MDX
*/
export const remarkPlugins = [
// Support GFM syntax to be used within Markdown
remarkGfm,
// Generates metadata regarding headings
remarkHeadings,
// Calculates the reading time of the content
readingTime,
remarkTableTitles,
];