add rehype-mdx-auto-import

This commit is contained in:
sup39 2023-02-16 23:55:50 +09:00
parent 8a6878d5ff
commit b1841fcfb7
3 changed files with 13 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import ExportHeadings from '@sup39/rehype-mdx-export-headings';
import ComponentWrapper from '@sup39/rehype-mdx-component-wrapper';
import AutoImport from '@sup39/rehype-mdx-auto-import';
const withMDX = mdx({
extension: /\.mdx?$/,
@ -20,6 +21,12 @@ const withMDX = mdx({
rehypeKatex,
[ExportHeadings, {tags: ['h2'], name: 'headings'}],
[ComponentWrapper, {props: ['headings', 'meta']}],
[AutoImport,
{
import: ['T', 'S', 'C'],
from: '@sup39/mdx-components',
},
],
],
},
});

View file

@ -45,6 +45,7 @@
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "13.0.7",
"@sup39/rehype-mdx-auto-import": "^1.0.0",
"@sup39/rehype-mdx-component-wrapper": "^0.1.0",
"@sup39/rehype-mdx-export-headings": "^0.1.1",
"next": "13.0.7",

View file

@ -247,6 +247,11 @@
"@typescript-eslint/eslint-plugin" "^5"
"@typescript-eslint/parser" "^5"
"@sup39/rehype-mdx-auto-import@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@sup39/rehype-mdx-auto-import/-/rehype-mdx-auto-import-1.0.0.tgz#d8319748c8791648aa3dcf64f24ae37926cd0c05"
integrity sha512-S18PYZrWbBALXs1LdPhPckmEgVaYKQKTzDOtFA29Az9w974/+dYRcpdQtsH6TZdtwrBRn307/Jy3SpL4fAxRIQ==
"@sup39/rehype-mdx-component-wrapper@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@sup39/rehype-mdx-component-wrapper/-/rehype-mdx-component-wrapper-0.1.0.tgz#a811a5bc4db83ade9ad952fc0387e7f5f0a07e8d"