diff --git a/src/components/Note/DiscussionContent/index.tsx b/src/components/Note/DiscussionContent/index.tsx index 541049d..32b8e4c 100644 --- a/src/components/Note/DiscussionContent/index.tsx +++ b/src/components/Note/DiscussionContent/index.tsx @@ -1,5 +1,7 @@ import { Event } from 'nostr-tools' -import ParsedContent from '../../UniversalContent/ParsedContent' +import { useMemo } from 'react' +import { parseNostrContent, renderNostrContent } from '@/lib/nostr-parser.tsx' +import { cn } from '@/lib/utils' export default function DiscussionContent({ event, @@ -8,15 +10,9 @@ export default function DiscussionContent({ event: Event className?: string }) { - return ( - - ) + const parsedContent = useMemo(() => { + return parseNostrContent(event.content, event) + }, [event.content, event]) + + return renderNostrContent(parsedContent, cn('prose prose-sm prose-zinc max-w-none break-words dark:prose-invert w-full', className)) } diff --git a/src/components/Note/SimpleContent/index.tsx b/src/components/Note/SimpleContent/index.tsx index 63ed338..d6a567e 100644 --- a/src/components/Note/SimpleContent/index.tsx +++ b/src/components/Note/SimpleContent/index.tsx @@ -1,5 +1,7 @@ import { Event } from 'nostr-tools' -import { useEventFieldParser } from '@/hooks/useContentParser' +import { useMemo } from 'react' +import { parseNostrContent, renderNostrContent } from '@/lib/nostr-parser.tsx' +import { cn } from '@/lib/utils' export default function SimpleContent({ event, @@ -8,28 +10,9 @@ export default function SimpleContent({ event: Event className?: string }) { - // Use the comprehensive content parser but without ToC - const { parsedContent, isLoading, error } = useEventFieldParser(event, 'content', { - enableMath: true, - enableSyntaxHighlighting: true - }) + const parsedContent = useMemo(() => { + return parseNostrContent(event.content, event) + }, [event.content, event]) - if (isLoading) { - return
Loading...
- } - - if (error) { - return
Error loading content
- } - - if (!parsedContent) { - return
No content available
- } - - return ( -
- {/* Render content without ToC and Article Info */} -
-
- ) + return renderNostrContent(parsedContent, cn('prose prose-sm prose-zinc max-w-none break-words dark:prose-invert w-full', className)) } diff --git a/src/components/NoteOptions/RawEventDialog.tsx b/src/components/NoteOptions/RawEventDialog.tsx index 05c73e6..07f7d8a 100644 --- a/src/components/NoteOptions/RawEventDialog.tsx +++ b/src/components/NoteOptions/RawEventDialog.tsx @@ -19,13 +19,13 @@ export default function RawEventDialog({ }) { return ( - + Raw Event View the raw event data -
+          
             {JSON.stringify(event, null, 2)}
           
diff --git a/src/components/ReplyNote/index.tsx b/src/components/ReplyNote/index.tsx index 8ea32d8..8d90ebc 100644 --- a/src/components/ReplyNote/index.tsx +++ b/src/components/ReplyNote/index.tsx @@ -11,7 +11,7 @@ import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import ClientTag from '../ClientTag' import Collapsible from '../Collapsible' -import EnhancedContent from '../UniversalContent/EnhancedContent' +import { parseNostrContent, renderNostrContent } from '@/lib/nostr-parser.tsx' import { FormattedTimestamp } from '../FormattedTimestamp' import Nip05 from '../Nip05' import NoteOptions from '../NoteOptions' @@ -103,7 +103,10 @@ export default function ReplyNote({ /> )} {show ? ( - + (() => { + const parsedContent = parseNostrContent(event.content, event) + return renderNostrContent(parsedContent, 'mt-2 prose prose-sm prose-zinc max-w-none break-words dark:prose-invert w-full') + })() ) : (