diff --git a/components/markdown-content.tsx b/components/markdown-content.tsx
index d0f47d0..6280a81 100644
--- a/components/markdown-content.tsx
+++ b/components/markdown-content.tsx
@@ -72,6 +72,41 @@ function extractHastText(node: Element): string {
.trim();
}
+function CodeRenderer({ children }: { children?: React.ReactNode }) {
+ const insidePre = useContext(InsidePreContext);
+
+ if (insidePre) {
+ return (
+
+ {children}
+
+ );
+ }
+
+ return (
+
+ {children}
+
+ );
+}
+
const components: Components = {
h1: ({ children }) => (
- {children}
-
- );
- }
-
- // Inline code
- return (
-
- {children}
-
- );
- },
+ code: CodeRenderer,
};
export default function MarkdownContent({ content }: { content: string }) {