и т.д.) - * и какие кастомные компоненты будут доступны прямо в MDX. - */ -const components: MDXComponents = { - // 🔗 Заменяем стандартные на Next.js - a: ({ children, href = '', ...props }) => { - // внутренние ссылки → через - if (href.startsWith('/')) { - return ( - - {children} - - ); - } +// This file allows you to provide custom React components +// to be used in MDX files. You can import and use any +// React component you want, including inline styles, +// components from other libraries, and more. - // внешние ссылки → target="_blank" - return ( - - {children} - - ); - }, -}; +const components = {} satisfies MDXComponents; -/** - * Эта функция вызывается автоматически при рендере MDX. - * Через неё Next.js App Router объединяет глобальные и локальные MDX-компоненты. - */ -export function useMDXComponents(componentsArgument: MDXComponents): MDXComponents { - return { - ...components, - ...componentsArgument, // позволяет переопределять внутри MDX - }; +export function useMDXComponents(): MDXComponents { + return components; }