From ac3f2e17cbc1d787d70a1ccfbc05c627c99630c0 Mon Sep 17 00:00:00 2001 From: hongjli <3117313295@qq.com> Date: 星期三, 30 四月 2025 15:44:11 +0800 Subject: [PATCH] 解析md格式表格 --- src/app/chat/page.tsx | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/src/app/chat/page.tsx b/src/app/chat/page.tsx index be029e7..f448cc6 100644 --- a/src/app/chat/page.tsx +++ b/src/app/chat/page.tsx @@ -1234,7 +1234,27 @@ {children} </code> ); - } + }, + // 娣诲姞琛ㄦ牸鏍峰紡缁勪欢 + table: ({ node, ...props }) => ( + <div className="overflow-x-auto my-4 rounded-lg border border-gray-100 shadow-sm"> + <table className="min-w-full divide-y divide-gray-100" {...props} /> + </div> + ), + thead: ({ node, ...props }) => ( + <thead className="bg-gray-50/70" {...props} /> + ), + th: ({ node, children, ...props }) => ( + <th className="px-4 py-3 text-sm font-semibold text-gray-700 border-b border-gray-100 text-center" {...props}> + {children} + </th> + ), + td: ({ node, ...props }) => ( + <td className="px-4 py-3 text-sm text-gray-600 border-t border-gray-100 text-center" {...props} /> + ), + tr: ({ node, ...props }) => ( + <tr className="hover:bg-gray-50/70 transition-colors duration-150" {...props} /> + ) }} > {mainContent} -- Gitblit v1.9.3