PPTX image alt text ending in a backslash breaks the Markdown image
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Markdown画像リンクを作成する前に代替テキストを正規化するPPTX画像変換経路を探してください。その経路が通常の画像リンクとdata URI画像リンクをどのように処理するかを読み、末尾がバックスラッシュの代替テキストのテストを追加してください。両方の画像が画像ノードとして解析され、最初の代替テキストが末尾のバックスラッシュを文字どおり保持すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happens
A PowerPoint picture whose native alt text ends in a backslash is emitted as . CommonMark treats the backslash as escaping the closing bracket, so the picture no longer renders as an image. An ordinary alt label in the next picture renders correctly.
I reproduced this on the PyPI release 0.1.9 and on main at ed178952a6672abdfd35b5f9e76a80b6cefc086e.
Minimal reproduction
With markitdown[pptx], Pillow and markdown-it-py installed:
from io import BytesIO
from markdown_it import MarkdownIt
from markitdown import MarkItDown, StreamInfo
from PIL import Image
from pptx import Presentation
from pptx.util import Inches
deck = Presentation()
slide = deck.slides.add_slide(deck.slide_layouts[6])
for x, alt in enumerate(("Output directory C:\\", "Control image")):
png = BytesIO()
Image.new("RGB", (1, 1), "white").save(png, format="PNG")
png.seek(0)
picture = slide.shapes.add_picture(png, Inches(x), Inches(0))
picture._element._nvXxPr.cNvPr.set("descr", alt)
source = BytesIO()
deck.save(source)
source.seek(0)
result = MarkItDown().convert_stream(source, stream_info=StreamInfo(extension=".pptx"))
images = [
"".join(segment.content for segment in child.children or [])
for token in MarkdownIt().parse(result.markdown)
for child in token.children or []
if child.type == "image"
]
print(images)
Actual: ['Control image']
Expected: Both image nodes, with the first alt text ending in a literal backslash.
The converter normalizes the label before inserting it between the Markdown brackets. Escaping literal backslashes at that point should preserve the intended text for both ordinary and data-URI image links.
Prepared and reproduced with Codex assistance.
- 主要言語
- Python
- スター
- 198k
- フォーク
- 15k
- 平均マージ
- 2時間 16分
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/markitdown のほかの issue
-
IpynbConverter uses a comment inside a Markdown code fence as the notebook title対応中かも @Primaverah が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
microsoft/markitdown#2964 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
PPTX chart labels with pipes or line breaks produce malformed Markdown tables対応中かも @dongyikuan919 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
microsoft/markitdown#2937 ·
メンテナーはふだん 1 日以内に返信
-
DOCX: math pre-processing re-parses every document.xml even without equations (32 s -> 17.5 s on a 12.5 MB document)対応中かも @houyunsun が 26 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 89/100
microsoft/markitdown#2834 ·
メンテナーはふだん 1 日以内に返信
-
URL fetch sends default python-requests User-Agent, Wikipedia returns 403対応中かも @sushan5140 が 31 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/markitdown#2820 ·
メンテナーはふだん 1 日以内に返信
-
Valid Atom feeds with zero entries are rejected as an unknown feed type対応中かも @Ayush701-code-zm が 24 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/markitdown#2781 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/markitdown の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
AIR-Bench Foundation reads the first letter of the word after "answer" as the model's choice対応中かも @beartester34 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelscope/evalscope#2330 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Distribution plot crashes when a numeric feature is constant in the train or test set対応中かも @adembilge が今日担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 10 日以内に返信