The Node.js® Website
1'use strict';
2
3import remarkHeadings from '@vcarl/remark-headings';
4import rehypeAutolinkHeadings from 'rehype-autolink-headings';
5import rehypeSlug from 'rehype-slug';
6import remarkGfm from 'remark-gfm';
7import readingTime from 'remark-reading-time';
8
9import rehypeShikiji from './next.mdx.shiki.mjs';
10
11/**
12 * Provides all our Rehype Plugins that are used within MDX
13 *
14 * @type {Array<import('unified').Plugin>}
15 */
16export const NEXT_REHYPE_PLUGINS = [
17 // Generates `id` attributes for headings (H1, ...)
18 rehypeSlug,
19 // Automatically add anchor links to headings (H1, ...)
20 [
21 rehypeAutolinkHeadings,
22 { properties: { ariaHidden: true, tabIndex: -1, class: 'anchor' } },
23 ],
24 // Transforms sequential code elements into code tabs and
25 // adds our syntax highlighter (Shikiji) to Codeboxes
26 rehypeShikiji,
27];
28
29/**
30 * Provides all our Remark Plugins that are used within MDX
31 *
32 * @type {Array<import('unified').Plugin>}
33 */
34export const NEXT_REMARK_PLUGINS = [remarkGfm, remarkHeadings, readingTime];