'use client'; import Markdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import { linkedDocument, type DocumentId } from '@/lib/documents'; export type TemplateDocumentProps = { text: string; onOpenDocument: (id: DocumentId) => void }; export default function TemplateDocument({ text, onOpenDocument }: TemplateDocumentProps) { return
{ const related = linkedDocument(href || ''); if (related) return ; if (!href || !/^https?:\/\//i.test(href)) return {children}; return {children}; }, img: ({ alt }) => {alt ? `图片:${alt}` : '图片请查看原文档'}, pre: ({ children }) =>
{children}
, table: ({ children }) =>
{children}
, }}>{text}
; }