// src/renderer/components/meeting/MarkdownRenderer.tsx // Phase 14.5: react-markdown + remark-gfm 래퍼 — d3roPalette 기반 스타일 import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' import { Box } from '@mui/material' import { d3roPalette, d3roFontMono, d3roTypo, d3roRadius } from '@d3ro/ui/theme' import type { Components } from 'react-markdown' interface MarkdownRendererProps { content: string } /** * 링크는 앱 창 안에서 이동하지 않는다 — 메인 창이 원격 페이지로 바뀌면 preload API가 그 페이지에 노출된다. * 클릭은 main의 openExternal(허용 scheme만)로 넘겨 OS 브라우저에서 연다. */ function openLinkExternally(event: React.MouseEvent, href: string | undefined): void { event.preventDefault() if (!href) return void window.electronAPI.system.openExternal({ url: href }) } const components: Components = { a: ({ children, href }) => ( ) => openLinkExternally(event, href)} sx={{ color: d3roPalette.accent.main, textDecoration: 'underline', cursor: 'pointer' }} > {children} ), h1: ({ children }) => ( {children} ), h2: ({ children }) => ( {children} ), h3: ({ children }) => ( {children} ), p: ({ children }) => ( {children} ), code: ({ children, className }) => { const isBlock = className?.startsWith('language-') ?? false if (isBlock) { return ( {children} ) } return ( {children} ) }, table: ({ children }) => ( {children} ), li: ({ children }) => ( {children} ), ul: ({ children }) => ( {children} ), ol: ({ children }) => ( {children} ), blockquote: ({ children }) => ( {children} ), } export function MarkdownRenderer({ content }: MarkdownRendererProps): React.ReactElement { return ( {content} ) }