From c26a0c5e20dfdcc45b43315b50296e90e30995d8 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 07 五月 2025 11:41:53 +0800
Subject: [PATCH] 表格展示

---
 src/components/chat/libs/markdown.ts |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/components/chat/libs/markdown.ts b/src/components/chat/libs/markdown.ts
index 9c1347e..1f9b8f6 100644
--- a/src/components/chat/libs/markdown.ts
+++ b/src/components/chat/libs/markdown.ts
@@ -56,6 +56,16 @@
 
 // 娣诲姞鑷畾涔夋牱寮�
 const style = document.createElement('style');
+// 鑷畾涔夋钀芥覆鏌撹鍒�
+md.renderer.rules.paragraph_open = (tokens, idx) => {
+	return '<p class="inline-block">'; // 娣诲姞 inline-block 绫绘潵鎺у埗鏄剧ず
+};
+
+// 鑷畾涔夎〃鏍兼覆鏌撹鍒�
+md.renderer.rules.table_open = (tokens, idx) => {
+	return '<table class="markdown-table">';
+};
+
 style.textContent = `
 	.code-markdown-it-block {
 		margin: 1em 0;
@@ -141,6 +151,19 @@
 	.copy-icon, .check-icon {
 		fill: currentColor;
 	}
+	.markdown-table {
+		border-collapse: collapse;
+		width: 100%;
+	}
+	.markdown-table thead {
+		background-color: #f2f2f2;
+	}
+	.markdown-table th,
+	.markdown-table td {
+		border: 1px solid #ebebeb;
+		padding: 8px;
+		text-align: center;
+	}
 `;
 document.head.appendChild(style);
 export { md };

--
Gitblit v1.9.3