diff --git a/backend/mindmap.db b/backend/mindmap.db index 29149a0..fe4c924 100644 Binary files a/backend/mindmap.db and b/backend/mindmap.db differ diff --git a/frontend/src/lib/mind-elixir/src/dev.ts b/frontend/src/lib/mind-elixir/src/dev.ts index 4c7b732..8bce31b 100644 --- a/frontend/src/lib/mind-elixir/src/dev.ts +++ b/frontend/src/lib/mind-elixir/src/dev.ts @@ -38,7 +38,7 @@ const options: Options = { if (!text) return '' if (!obj.useMd) return text try { - // Configure marked renderer to add target="_blank" to links + // Configure marked renderer to add target="_blank" to links and table classes const renderer = { link(token: Tokens.Link) { const href = token.href || '' @@ -46,6 +46,13 @@ const options: Options = { const text = token.text || '' return `${text}` }, + table(token: Tokens.Table) { + const header = token.header.map(cell => `${cell.text}`).join('') + const rows = token.rows.map(row => + `${row.map(cell => `${cell.text}`).join('')}` + ).join('') + return `${header}${rows}
` + }, } marked.use({ renderer, gfm: true }) diff --git a/frontend/src/lib/mind-elixir/src/index.less b/frontend/src/lib/mind-elixir/src/index.less index 48f580f..4243e26 100644 --- a/frontend/src/lib/mind-elixir/src/index.less +++ b/frontend/src/lib/mind-elixir/src/index.less @@ -317,4 +317,58 @@ background: #4f90f22d; border: 1px solid #4f90f2; } + + /* Markdown表格样式 */ + .markdown-table { + border-collapse: collapse; + width: 100%; + margin: 4px 0; + font-size: 11px; + border: 1px solid #e0e0e0; + border-radius: 6px; + box-shadow: 0 2px 8px rgba(0,0,0,0.08); + background-color: #fafafa; + overflow: hidden; + white-space: normal !important; /* 覆盖MindElixir的pre-wrap */ + } + + .markdown-table th, + .markdown-table td { + border: 1px solid #e0e0e0; + padding: 8px 12px; + text-align: left; + vertical-align: top; + position: relative; + white-space: normal !important; /* 覆盖MindElixir的pre-wrap */ + } + + .markdown-table th { + background-color: #f5f5f5; + font-weight: 600; + color: #333; + text-align: center; + border-bottom: 1px solid #d0d0d0; + } + + .markdown-table td { + background-color: #fff; + } + + .markdown-table tr:nth-child(even) td { + background-color: #f8f8f8; + } + + .markdown-table tr:hover td { + background-color: #f0f8ff; + } + + /* 移除多余的边框,保持简洁 */ + .markdown-table th:not(:last-child), + .markdown-table td:not(:last-child) { + border-right: 1px solid #e0e0e0; + } + + .markdown-table tr:not(:last-child) td { + border-bottom: 1px solid #e0e0e0; + } } diff --git a/mind-elixir-core-master/src/dev.ts b/mind-elixir-core-master/src/dev.ts index 4c7b732..8bce31b 100644 --- a/mind-elixir-core-master/src/dev.ts +++ b/mind-elixir-core-master/src/dev.ts @@ -38,7 +38,7 @@ const options: Options = { if (!text) return '' if (!obj.useMd) return text try { - // Configure marked renderer to add target="_blank" to links + // Configure marked renderer to add target="_blank" to links and table classes const renderer = { link(token: Tokens.Link) { const href = token.href || '' @@ -46,6 +46,13 @@ const options: Options = { const text = token.text || '' return `${text}` }, + table(token: Tokens.Table) { + const header = token.header.map(cell => `${cell.text}`).join('') + const rows = token.rows.map(row => + `${row.map(cell => `${cell.text}`).join('')}` + ).join('') + return `${header}${rows}
` + }, } marked.use({ renderer, gfm: true }) diff --git a/mind-elixir-core-master/src/index.less b/mind-elixir-core-master/src/index.less index 48f580f..4243e26 100644 --- a/mind-elixir-core-master/src/index.less +++ b/mind-elixir-core-master/src/index.less @@ -317,4 +317,58 @@ background: #4f90f22d; border: 1px solid #4f90f2; } + + /* Markdown表格样式 */ + .markdown-table { + border-collapse: collapse; + width: 100%; + margin: 4px 0; + font-size: 11px; + border: 1px solid #e0e0e0; + border-radius: 6px; + box-shadow: 0 2px 8px rgba(0,0,0,0.08); + background-color: #fafafa; + overflow: hidden; + white-space: normal !important; /* 覆盖MindElixir的pre-wrap */ + } + + .markdown-table th, + .markdown-table td { + border: 1px solid #e0e0e0; + padding: 8px 12px; + text-align: left; + vertical-align: top; + position: relative; + white-space: normal !important; /* 覆盖MindElixir的pre-wrap */ + } + + .markdown-table th { + background-color: #f5f5f5; + font-weight: 600; + color: #333; + text-align: center; + border-bottom: 1px solid #d0d0d0; + } + + .markdown-table td { + background-color: #fff; + } + + .markdown-table tr:nth-child(even) td { + background-color: #f8f8f8; + } + + .markdown-table tr:hover td { + background-color: #f0f8ff; + } + + /* 移除多余的边框,保持简洁 */ + .markdown-table th:not(:last-child), + .markdown-table td:not(:last-child) { + border-right: 1px solid #e0e0e0; + } + + .markdown-table tr:not(:last-child) td { + border-bottom: 1px solid #e0e0e0; + } }