案例:Dogfood——MarkItDown 轉 MarkItDown 自己

用轉換工具分析轉換工具:README / pyproject.toml / Dockerfile / GitHub 頁 / PyPI 頁
markitdown 0.1.7 · 對齊 fd239d5 · 全部本站實跑

為什麼 dogfood?

「用你自己的工具處理你自己的 repo」是最誠實的測試。以下全部輸出都收在 worked/dogfood/

1. README.md(透過 raw URL,餵對齊 commit)

輸入已是 Markdown,輸出幾乎原封不動(16 KB)。這也展示 convert_uri 直接抓網址的能力:

markitdown "https://raw.githubusercontent.com/microsoft/markitdown/fd239d5d2be43d9b68329730206b9312c7d5a388/README.md" -o readme.md

輸出 16,115 bytes,內容與上游 README 一致(標題、徽章、表格都保留)。

2. pyproject.toml(本機源碼)

TOML 是純文字 → PlainTextConverter,原文原樣保留(這正好讓你看清 extras 的真實定義):

[project]
name = "markitdown"
description = 'Utility tool for converting various files to Markdown'
requires-python = ">=3.10"
license = "MIT"

[project.optional-dependencies]
all = [ "python-pptx", "mammoth~=1.11.0", "pandas", ..., "SpeechRecognition", "youtube-transcript-api~=1.0.0", ... ]
pdf = ["pdfminer.six>=20251230", "pdfplumber>=0.11.9"]
docx = ["mammoth~=1.11.0", "lxml"]
audio-transcription = ["pydub", "SpeechRecognition"]
youtube-transcription = ["youtube-transcript-api"]
markitdown D:\temp\opencode\markitdown\packages\markitdown\pyproject.toml -o pyproject.md

3. Dockerfile

純文字,原樣保留。

markitdown D:\temp\opencode\markitdown\Dockerfile -o dockerfile.md

輸出 717 bytes。

4. GitHub 專案頁(HTML)——含雜訊的誠實示範

直接把 https://github.com/microsoft/markitdown 丟進去。GitHub 頁有超多導覽列, 而 GitHub 頁「沒有專用 converter」→ 走通用 HtmlConverter,於是一大堆導覽連結也被轉進來(26 KB)。

[Skip to content](#start-of-content)

## Navigation Menu

[Sign in](/login?...)

* Platform
  + AI CODE CREATION
    - [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
  + DEVELOPER WORKFLOWS
    - [ActionsAutomate any workflow](https://github.com/features/actions)
  ...
教學點:這正是「為什麼某些網站有專用 converter」的理由—— Wikipedia、YouTube、RSS 都有專門 converter 來「只取正文」;對沒有專用 converter 的一般網頁, 輸出的雜訊多寡取決於該頁面的導覽結構。

5. PyPI 套件頁(HTML)

同樣是通用 HTML 轉換,導覽/警示區塊也進來了(16 KB)。

[Skip to main content](#content)
Switch to mobile version

Warning
Some features may not work without JavaScript. Please try enabling it if you encounter problems.

[![PyPI](/static/images/logo-small.0e0855d0.svg)](/)

Search PyPI ...

6. 源碼本身(_markitdown.py)

Python 源碼 → PlainText,原樣保留(32 KB)。等於「用 MarkItDown 備份自己的源碼」。

markitdown D:\temp\opencode\markitdown\packages\markitdown\src\markitdown\_markitdown.py -o core-source.md

本站結論