From b1841fcfb71d8aaf697705ca4becd6b4fed02762 Mon Sep 17 00:00:00 2001 From: sup39 Date: Thu, 16 Feb 2023 23:55:50 +0900 Subject: [PATCH] add rehype-mdx-auto-import --- next.config.mjs | 7 +++++++ package.json | 1 + yarn.lock | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/next.config.mjs b/next.config.mjs index 2353a7f..cc0d291 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -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', + }, + ], ], }, }); diff --git a/package.json b/package.json index 31c9064..1839635 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index b963902..3203181 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"