From 10ae7a78029481c92e34a5a77fd5de65c600bba6 Mon Sep 17 00:00:00 2001 From: Mohammad Kermani Date: Sat, 10 May 2025 09:09:32 +0000 Subject: [PATCH] fix: update CodeBlock component to improve conditional rendering --- components/code-block.tsx | 10 ++++------ components/markdown.tsx | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/components/code-block.tsx b/components/code-block.tsx index c0780e5..336a1ca 100644 --- a/components/code-block.tsx +++ b/components/code-block.tsx @@ -1,20 +1,18 @@ 'use client'; interface CodeBlockProps { - node: any; - inline: boolean; - className: string; - children: any; + node?: any; + className?: string; + children?: any; } export function CodeBlock({ node, - inline, className, children, ...props }: CodeBlockProps) { - if (!inline) { + if (node?.children[0]?.value?.endsWith('\n')) { return (
 = {
-  // @ts-expect-error
   code: CodeBlock,
   pre: ({ children }) => <>{children},
   ol: ({ node, children, ...props }) => {