diff --git a/src/PageManager.tsx b/src/PageManager.tsx
index 21ee1ff9..490d0439 100644
--- a/src/PageManager.tsx
+++ b/src/PageManager.tsx
@@ -921,7 +921,7 @@ function MainContentArea({
+ + {cleaned} + +
+ ) + } + return+ {renderInlineTokens(marked.Lexer.lexInline(line) as any[], `${key}-line-inline-${lineIdx}`)} +
+ ) + } + + const bech32Id = nostrMatch[1] + if (bech32Id.startsWith('npub') || bech32Id.startsWith('nprofile')) { + return ( + ++ {renderInlineTokens(marked.Lexer.lexInline(line) as any[], `${key}-line-fallback-inline-${lineIdx}`)} +
+ ) + }) + + return+ + {cleaned} + +
+ ) + } + return(avoids invalid DOM nesting for media players). + const paragraphTokens = token.tokens ?? marked.Lexer.lexInline(token.text ?? '') + if (Array.isArray(paragraphTokens) && paragraphTokens.length === 1 && paragraphTokens[0]?.type === 'image') { + const imageToken = paragraphTokens[0] + const src = String(imageToken.href ?? '') + const cleaned = cleanUrl(src) + if (cleaned) { + if (isVideo(cleaned) || isAudio(cleaned)) { + const poster = videoPosterMap?.get(cleaned) + return ( +
{inlineNodes}
+ } + + const renderBlockTokens = (tokens: any[], keyPrefix: string): React.ReactNode[] => { + const nodes: React.ReactNode[] = [] + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i] + const key = `${keyPrefix}-${i}` + switch (token.type) { + case 'space': + break + case 'paragraph': + nodes.push(renderParagraph(token, key)) + break + case 'heading': { + const level = Number(token.depth || 1) + const headingClass = + level === 1 + ? 'text-3xl' + : level === 2 + ? 'text-2xl' + : level === 3 + ? 'text-xl' + : level === 4 + ? 'text-lg' + : 'text-base' + nodes.push( + React.createElement( + `h${Math.min(Math.max(level, 1), 6)}`, + { key: `${key}-h`, className: `font-bold break-words block mt-4 mb-2 ${headingClass}` }, + renderInlineTokens(token.tokens ?? marked.Lexer.lexInline(token.text ?? ''), `${key}-h-inline`) + ) + ) + break + } + case 'hr': + nodes.push(+ {renderBlockTokens(token.tokens ?? [], `${key}-bq-inner`)} ++ ) + } + break + } + case 'list': { + const ListTag = token.ordered ? 'ol' : 'ul' + const listClass = token.ordered ? 'list-decimal list-outside my-2 ml-6' : 'list-disc list-inside my-2 space-y-1' + nodes.push( + React.createElement( + ListTag, + { key: `${key}-list`, className: listClass }, + (token.items ?? []).map((item: any, itemIdx: number) => ( +
| + {renderInlineTokens(cell.tokens ?? marked.Lexer.lexInline(cell.text ?? ''), `${key}-th-inline-${cIdx}`)} + | + ))} +
|---|
| + {renderInlineTokens( + cell.tokens ?? marked.Lexer.lexInline(cell.text ?? ''), + `${key}-td-inline-${rIdx}-${cIdx}` + )} + | + ))} +
+ {renderInlineTokens(marked.Lexer.lexInline(token.text) as any[], `${key}-fallback-inline`)} +
+ ) + } + } + } + } + return nodes + } + + const nodes = renderBlockTokens(blockTokens, 'marked-root') + return { nodes, hashtagsInContent, footnotes, citations } +} + /** * Parse inline markdown formatting (bold, italic, strikethrough, inline code, footnote references) * Returns an array of React nodes @@ -2751,7 +3299,143 @@ function parseMarkdownContent( * - Inline code: ``code`` (double backtick) or `code` (single backtick) * - Footnote references: [^1] (handled at block level, but parsed here for inline context) */ -function parseInlineMarkdown(text: string, keyPrefix: string, _footnotes: Map
+ {event.content}
+
+ )
+ }
+ if (ASCIIDOC_CONTENT_KINDS.has(event.kind)) {
+ return (
+ {event.content}
- ) : null} + {event.content?.trim() ? renderEventContent({ hideMetadata: true }) : null} > ) } else if (event.kind === ExtendedKind.WIKI_ARTICLE) { content = showFull ? ( -