PPTX chart labels with pipes or line breaks produce malformed Markdown tables

未关闭 适合新手
#2,937 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@dongyikuan919 已经在做这个了。

开始于 2026年11月29日。

  • #2938 来自 @dongyikuan919 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
92/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
markdown, python
领域
tooling

调研方向

运行提供的 PPTX 图表复现流程,以检查格式错误的 Markdown 表格。在 PPTX 图表表序列化路径中,将单元格格式与 CSV 转换路径进行比较;后者已经会转义管道符并合并换行。完成意味着系列名称和类别标签仍保留在预期的单元格中,管道符转义为 \|,换行被合并,并且生成的 Markdown 呈现为表格。

由索引模型根据 Issue 内容生成。

描述

What happened

When a PowerPoint chart has a pipe in a series name or a category label, the converter writes it as a Markdown column separator. A line break inside the label also splits the row. The resulting header can have a different number of cells from the delimiter row, so a Markdown renderer may show plain text instead of a table.

Reproduction

Install markitdown[pptx] and run this example.

from io import BytesIO

from markitdown import MarkItDown, StreamInfo
from pptx import Presentation
from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE
from pptx.util import Inches

deck = Presentation()
slide = deck.slides.add_slide(deck.slide_layouts[6])
data = CategoryChartData()
data.categories = ["North | West\nRetail"]
data.add_series("Revenue | Forecast", [10])
slide.shapes.add_chart(XL_CHART_TYPE.COLUMN_CLUSTERED, 0, 0, Inches(6), Inches(4), data)

stream = BytesIO()
deck.save(stream)
stream.seek(0)
print(MarkItDown().convert_stream(stream, stream_info=StreamInfo(extension=".pptx")).markdown)

Actual chart table

| Category | Revenue | Forecast |
|---|---|
| North | West
Retail | 10.0 |

Expected chart table

| Category | Revenue \| Forecast |
|---|---|
| North \| West Retail | 10.0 |

CSV conversion already escapes pipes and collapses line breaks in Markdown table cells. Applying that same formatting to chart cells would keep labels and values in their intended columns.

Reproduced on main at ed178952a6672abdfd35b5f9e76a80b6cefc086e (MarkItDown 0.1.9), with Python 3.12.10 and python-pptx 1.0.2 on macOS.

OpenAI Codex assisted with reproducing and drafting this report.

主要语言
Python
星标
198k
派生
15k
平均合并
2 小时 16 分钟
30 天内合并 PR
9

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/markitdown 的其他 Issue

查看 microsoft/markitdown 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。