From 2af31fa5c8877a363e7614fe6ded066c46611a31 Mon Sep 17 00:00:00 2001 From: Krishna Ayyalasomayajula Date: Mon, 1 Jun 2026 22:42:02 -0500 Subject: [PATCH] fix: enhance inline code styling in mdx-components - Distinguish inline vs block code in component - Inline code: bg-ink/[0.06] light / bg-white/[0.08] dark, no language classes - Block code: pass className through unchanged (no double-styling) -
 component: remove bg-surface/rounded-xl/overflow-x-auto/p-4
- 
 now relies on globals.css for block code styling
---
 mdx-components.tsx | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

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}
       
),