diff --git a/mdx-components.tsx b/mdx-components.tsx
index 79e75a0..984294a 100644
--- a/mdx-components.tsx
+++ b/mdx-components.tsx
@@ -44,16 +44,25 @@ export function getMDXComponents(components: MDXComponents): MDXComponents {
)
},
- code: ({ children, ...props }) => (
-
- {children}
-
- ),
- pre: ({ children, ...props }) => (
-
+ code: ({ children, className, ...props }: { children: React.ReactNode; className?: string }) => {
+ const match = /language-(\w+)/.exec(className || '');
+ const language = match ? match[1] : '';
+ const isInline = !className?.includes('language-');
+
+ if (isInline) {
+ return (
+
+ {children}
+
+ );
+ }
+ return ;
+ },
+ pre: ({ children, ...props }: { children: React.ReactNode; [key: string]: any }) => (
+
{children}
),