PPTX: same-row shapes are read top-first instead of left-to-right
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start at PptxConverter.convert() and reproduce the ordering with the provided synthetic slide and tests/test_files/test.pptx, slide 2. Compare the current and proposed row-band ordering, preserving None/top-zero handling. Done means shapes are emitted in the expected row-major order without any shape being dropped or duplicated, and the existing test suite passes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Shapes that share a visual row (a two-column body, a right-aligned value next to a label, a caption beside a figure) come out in the wrong order: the right-hand shape is emitted before the left-hand one whenever its box starts a little higher.
Repro
from pptx import Presentation
from pptx.util import Inches
from markitdown import MarkItDown
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6]) # blank
def box(left, top, text):
tb = slide.shapes.add_textbox(Inches(left), Inches(top), Inches(4), Inches(3))
tb.text_frame.text = text
box(0.5, 1.5, "LEFT column body")
box(5.0, 1.4, "RIGHT column body") # right box starts 0.1" higher
prs.save("repro.pptx")
print(MarkItDown().convert("repro.pptx").markdown)
Expected: LEFT column body then RIGHT column body. Actual: RIGHT column body then LEFT column body.
PptxConverter.convert() sorts shapes by (x.top, x.left), so it orders by top first and has no notion of "same row". This also reproduces on the bundled tests/test_files/test.pptx (slide 2, a two-column text + image body).
The fix (and the one decision I'd like your steer on)
Group shapes that overlap vertically into row bands, read the bands top-to-bottom and the shapes left-to-right within a band. A full-height sidebar beside a grid is lifted onto its side so the grid stays row-major, and a full-width title/caption sharing a chart's or table's frame is read on the correct side of it. No shape is added or dropped; only the order changes.
Measured against a known reading order on synthetic slides with seeded jitter (mean Spearman rank correlation, higher is better; benchmark script: https://gist.github.com/aImErYbArRaUlT/6b9ee69160719ae7bc77b9480a185cce):
| layout | current (top, left) |
fix |
|---|---|---|
| two-column body | 0.88 | 1.00 |
| same-row label / value | 0.90 | 1.00 |
| grid | 0.88 | 1.00 |
| grid beside a full-height sidebar | 0.38 - 0.95 | 1.00 |
| full-width title over a row | 0.58 | 1.00 |
| newspaper / column-major (out of scope) | 0.48 | 0.67 |
It preserves the None / top-zero handling from #2408: a missing top still sorts first, and a real top of 0 is not treated as missing.
The change is default-on. I made it default-on because on this benchmark it is monotone: it never scores below the current order on any layout, including the out-of-scope newspaper case, so there is no layout it makes worse. The linked PR implements it default-on; if you would rather gate it behind a kwarg until it has some mileage, say so and I will switch it.
Real-deck check
I also rendered the 40 slides where the new order differs from the current one (across docling, Unstructured and Apache POI decks), boxed and numbered each shape, and scored the two orders blind - one scorer, not knowing which image was which - before unsealing the key. Of 22 slides that have a single correct order, the fix read right on 19 and the current sort on 3; the fix beat the current sort 18 to 2. The other 18 are dense diagram / risk-matrix slides with no single correct order, where neither is better.
That blind pass surfaced two slides where a first cut read worse than the current sort: a full-width title banded with the row below it (a Diageo "benefits" slide) and a full-width caption nested in a table's frame (a "this is kinda backwards" slide). Both are fixed. An intermediate bands-only version had actually reversed that nested caption (Spearman -1.00 on a synthetic version of it), which is why the final rule reads a full-width row on the correct side of the frame rather than purely left-to-right.
Known limitations
- It does not reconstruct column-major "newspaper" order (reading straight down one tall column before starting the next); it improves but does not solve that case.
- It does not claim to linearize arbitrary 2D diagrams where no single correct order exists; there the content is preserved and the order is heuristic, never worse than today.
- Separate, pre-existing quirk worth a follow-up: a table's
GraphicFramecan report a stale bounding box, which may mis-band it. Out of scope here; happy to file it on its own.
Validated on the benchmark above, a corpus of 66 real decks / 740 slides (no shape ever dropped or duplicated), and the blind render pass. The PR is written and tested.
- Ngôn ngữ chính
- Python
- Star
- 194k
- Fork
- 14.5k
- Merge trung bình
- 22 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/markitdown
-
URL fetch sends default python-requests User-Agent, Wikipedia returns 403Có thể đã có người làm @sushan5140 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/markitdown#2820 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Valid Atom feeds with zero entries are rejected as an unknown feed typeCó thể đã có người làm @pujitha24 đã nhận 8 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/markitdown#2781 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DOCX: footnote references and back-links point to anchors that don't exist in the MarkdownCó thể đã có người làm @sun04222 đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/markitdown#2743 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DOCX math: a delimiter with several arguments keeps only the last oneCó thể đã có người làm @drakeo338 đã nhận 34 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
microsoft/markitdown#2573 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DOCX: Heading 7-9 styles lose heading structure entirely (render as plain paragraphs)Có thể đã có người làm @stanleys12 đã nhận 39 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/markitdown#2530 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/markitdown
Issue tương tự
-
bug severity:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
curriculum documentation quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
githubnext/gh-aw-workshop#5367 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
OAuth documentation for GET /api/v2/users/me/ appears inconsistent with required global read scopeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Create Noise Latents ignores randomize_seed and produces the same noise every runCó thể đã có người làm @griptapeops đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
griptape-ai/griptape-nodes-library-diffusers#127 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Jenkins capacity report: metrics history is lost when archiving a month failsCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
adoptium/infrastructure#4568 ·
Maintainer thường phản hồi trong vòng 1 ngày