Skip to content

Verify: markdown table header row issue already fixed#72

Merged
zerx-lab merged 1 commit intomainfrom
copilot/fix-table-header-loss
Nov 25, 2025
Merged

Verify: markdown table header row issue already fixed#72
zerx-lab merged 1 commit intomainfrom
copilot/fix-table-header-loss

Conversation

Copy link
Contributor

Copilot AI commented Nov 25, 2025

Issue #33 reported that markdown table to docx conversion was losing header rows. Investigation shows the issue does not reproduce in the current codebase.

Verification

Ran table_and_tasklist_demo.go and extracted XML from generated DOCX. All table headers are present:

Table Row 0 (Header) Status
1 功能特性, 状态, 优先级, 备注
2 左对齐, 居中对齐, 右对齐, 默认对齐
3 序号, 模块名称, 实现状态, 功能描述, 测试覆盖率
4 分类, 功能点, Markdown语法, Word输出, 状态

Current Implementation

renderTable in pkg/markdown/renderer.go correctly handles both node types:

// First pass: collect TableHeader nodes
for child := node.FirstChild(); child != nil; child = child.NextSibling() {
    if row, ok := child.(*extast.TableHeader); ok {
        // ... collects header cells
    }
}

// Second pass: collect TableRow nodes  
for child := node.FirstChild(); child != nil; child = child.NextSibling() {
    if row, ok := child.(*extast.TableRow); ok {
        // ... collects body cells
    }
}

Conclusion

Per instruction "先复现后修复,没问题则不进行修改" — no code changes needed. The screenshot in the issue likely reflects an older version that has since been fixed.

Original prompt

This section details on the original issue you should resolve

<issue_title>markdown表格转docx后丢失标题行了</issue_title>
<issue_description>使用examples\markdown_demo\table_and_tasklist_demo.go

## 4. 表格功能

### 4.1 基础表格

| 功能特性 | 状态 | 优先级 | 备注 |
|----------|------|--------|------|
| 标题转换 | ✅ 完成 || 支持1-6级标题 |
| 文本格式 | ✅ 完成 || 粗体、斜体、代码 |
| 表格转换 | ✅ 完成 || 支持对齐方式 |
| 任务列表 | ✅ 完成 || GFM扩展功能 |
| 图片处理 | 🔄 开发中 || 基础支持 |

### 4.2 对齐方式表格

| 左对齐 | 居中对齐 | 右对齐 | 默认对齐 |
|:-------|:--------:|-------:|----------|
| 内容1 | 居中内容 | 右对齐内容 | 默认内容 |
| 较长的内容文本 | 短内容 | 数字123 | 普通文本 |
| Left | Center | Right | Normal |

转换后的docx表格没有标题行

Image</issue_description>

<agent_instructions>先复现后修复,没问题则不进行修改
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix loss of header row when converting markdown table to docx Verify: markdown table header row issue already fixed Nov 25, 2025
Copilot AI requested a review from zerx-lab November 25, 2025 04:54
@zerx-lab zerx-lab marked this pull request as ready for review November 25, 2025 04:58
Copilot AI review requested due to automatic review settings November 25, 2025 04:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@zerx-lab zerx-lab merged commit 21b3a1e into main Nov 25, 2025
1 check passed
@zerx-lab zerx-lab deleted the copilot/fix-table-header-loss branch November 25, 2025 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

markdown表格转docx后丢失标题行了

3 participants