@@ -9,11 +9,9 @@ import remarkGfm from 'remark-gfm'
99import SyntaxHighlighter from 'react-syntax-highlighter'
1010import { Table , TableBody , TableCell , TableHead , TableHeader , TableRow } from "@/components/ui/table"
1111import { Components } from 'react-markdown'
12- import type { ComponentPropsWithoutRef , ReactNode } from 'react'
1312import { smoothScroll } from '@/util/smoothScroll'
14- import Video from '@/components/mdx/Video'
1513import { CopyButton } from './chat/CopyButton'
16- import { a11yLight , dark , docco , a11yDark , vs } from 'react-syntax-highlighter/dist/cjs/styles/hljs'
14+ import { a11yLight , a11yDark } from 'react-syntax-highlighter/dist/cjs/styles/hljs'
1715import { useTheme } from "next-themes"
1816import { Include } from '@/components/mdx/Include'
1917import { remarkCustomId } from '@/util/remarkCustomId'
@@ -34,18 +32,8 @@ type ExtendedComponents = Components & {
3432 // Block components are added dynamically
3533}
3634
37- interface HeadingProps extends React . HTMLAttributes < HTMLHeadingElement > {
38- level : number ;
39- children : React . ReactNode ;
40- }
41-
42- interface ChildrenProps {
43- children : ReactNode ;
44- }
45-
4635const HEADER_HEIGHT = 80 ;
4736const BREADCRUMB_HEIGHT = 48 ; // 24px height + 24px bottom margin
48- const TOTAL_OFFSET = HEADER_HEIGHT + BREADCRUMB_HEIGHT ;
4937
5038// Context to track if we're inside a list item
5139const ListItemContext = createContext ( false ) ;
@@ -54,7 +42,7 @@ const ListItemContext = createContext(false);
5442const HeadingContext = createContext ( false ) ;
5543
5644const MarkdownContent : React . FC < MarkdownContentProps > = ( { content, className, disableBlockComponents = false } ) => {
57- const { theme } = useTheme ( ) ;
45+ const { resolvedTheme } = useTheme ( ) ;
5846 const [ mounted , setMounted ] = useState ( false ) ;
5947
6048 useEffect ( ( ) => {
@@ -264,14 +252,14 @@ const MarkdownContent: React.FC<MarkdownContentProps> = ({ content, className, d
264252 < SyntaxHighlighter
265253 language = { highlight }
266254 PreTag = "div"
267- style = { theme === 'dark' ? a11yDark : a11yLight }
255+ style = { resolvedTheme === 'dark' ? { ... a11yDark , hljs : { ... a11yDark . hljs , color : '#f8f8f2' } } : a11yLight }
268256 className = "rounded-lg py-2 [&>pre]:!m-0 border border-border [&>pre]:!bg-muted"
269257 customStyle = { {
270258 padding : '1rem' ,
271259 paddingTop : '2rem' ,
272260 paddingBottom : '2rem' ,
273261 fontSize : '14px' ,
274- backgroundColor : 'transparent' , // Use transparent to let CSS handle the background
262+ backgroundColor : 'transparent' ,
275263 } }
276264 { ...props }
277265 > { String ( children ) . replace ( / \n $ / , '' ) } </ SyntaxHighlighter >
0 commit comments