PPTX image alt text ending in a backslash breaks the Markdown image

オープン 初心者向け
#2,943 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@dongyikuan919 がすでに取り組んでいます。

2026年12月1日 から。

  • #2944 @dongyikuan919 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

Markdown画像リンクを作成する前に代替テキストを正規化するPPTX画像変換経路を探してください。その経路が通常の画像リンクとdata URI画像リンクをどのように処理するかを読み、末尾がバックスラッシュの代替テキストのテストを追加してください。両方の画像が画像ノードとして解析され、最初の代替テキストが末尾のバックスラッシュを文字どおり保持すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

What happens

A PowerPoint picture whose native alt text ends in a backslash is emitted as ![Output directory C:\](Picture1.jpg). 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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/markitdown のほかの issue

microsoft/markitdown の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。