Note
diff --git a/src/components/mdx/index.tsx b/src/components/mdx/index.tsx
index 48fdb8d4..987d86c0 100644
--- a/src/components/mdx/index.tsx
+++ b/src/components/mdx/index.tsx
@@ -1,91 +1,87 @@
import cn from '@/lib/cn'
import { MARKDOWN_REGEX } from '@/utils/docs'
-import { ComponentProps } from 'react'
+import { ComponentProps, ReactNode } from 'react'
export * from './Grid'
export * from './Hint'
-export const h2 = ({ children, id }: { children: React.ReactNode; id: string }) => (
-
- {children}
-
+type Hn = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
+function Heading({ id, Tag, ...props }: { id: string; Tag: Hn } & ComponentProps) {
+ return (
+
+
+
+ )
+}
+export const h2 = ({ id, ...props }: Omit, 'Tag'>) => (
+
)
-export const h3 = ({ children, id }: { children: React.ReactNode; id: string }) => (
-
- {children}
-
+export const h3 = ({ id, ...props }: Omit, 'Tag'>) => (
+
)
-export const h4 = ({ children, id }: { children: React.ReactNode; id: string }) => (
-
- {children}
-
+export const h4 = ({ id, ...props }: Omit, 'Tag'>) => (
+
)
-
-export const ul = ({ children }: { children: React.ReactNode }) => (
-
+export const h5 = ({ id, ...props }: Omit, 'Tag'>) => (
+
)
-export const ol = ({ children }: { children: React.ReactNode }) => (
- {children}
+export const h6 = ({ id, ...props }: Omit, 'Tag'>) => (
+
)
-export const li = ({ children }: { children: React.ReactNode }) => (
+
+export const ul = (props: ComponentProps<'ul'>) =>
+export const ol = (props: ComponentProps<'ol'>) =>
+export const li = (props: ComponentProps<'li'>) => (
- {children}
-
+ {...props}
+ />
)
-export const p = ({ children }: { children: React.ReactNode }) => (
-
- {children}
-
-)
+export const p = (props: ComponentProps<'p'>) =>
-export const blockquote = ({ children }: { children: React.ReactNode }) => (
-
- {children}
+export const blockquote = ({ children }: ComponentProps<'blockquote'>) => (
+
+ {children}
)
-export const table = ({ children }: { children: React.ReactNode }) => (
+export const table = (props: ComponentProps<'table'>) => (
)
-export const a = ({
- href,
- target,
- rel,
- children,
-}: {
- href: string
- target?: string
- rel?: string
- children: React.ReactNode
-}) => {
- const isAnchor = href.startsWith('https://')
+export const thead = (props: ComponentProps<'thead'>) => (
+
+)
+
+export const th = (props: ComponentProps<'th'>) => (
+ |
+)
+
+export const tr = (props: ComponentProps<'tr'>) =>
+
+export const td = (props: ComponentProps<'td'>) => (
+ |
+)
+
+export const a = ({ href, target, rel, ...props }: ComponentProps<'a'>) => {
+ const isAnchor = href?.startsWith('https://')
target = isAnchor ? '_blank' : target
rel = isAnchor ? 'noopener noreferrer' : rel
- href = isAnchor ? href : href.replace(MARKDOWN_REGEX, '')
- return (
-
- {children}
-
- )
+ href = isAnchor ? href : href?.replace(MARKDOWN_REGEX, '')
+
+ return
}
export const img = ({ src, alt, width, height, className, ...rest }: ComponentProps<'img'>) => (
@@ -101,3 +97,15 @@ export const img = ({ src, alt, width, height, className, ...rest }: ComponentPr
{...rest}
/>
)
+
+export const code = (props: ComponentProps<'code'>) => (
+
+)
+
+export const details = (props: ComponentProps<'details'>) =>
+export const summary = (props: ComponentProps<'summary'>) => (
+
+)
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 5697b564..b78b5ada 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -1,3 +1,4 @@
+import defaultTheme from 'tailwindcss/defaultTheme'
import type { Config } from 'tailwindcss'
import { withMaterialColors, Options } from 'tailwind-material-colors'
@@ -5,6 +6,13 @@ const config: Config = {
darkMode: 'class',
content: ['./src/components/**/*.{js,ts,jsx,tsx,mdx}', './src/app/**/*.{js,ts,jsx,tsx,mdx}'],
plugins: [require('@tailwindcss/typography'), require('@tailwindcss/aspect-ratio')],
+ theme: {
+ extend: {
+ fontFamily: {
+ mono: ['"Inconsolata"', ...defaultTheme.fontFamily.mono],
+ },
+ },
+ },
}
//