markitdown
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMarkItDown
MarkItDown
Convert a document, image, audio file, or YouTube URL to Markdown using Microsoft's CLI. The skill validates the input, composes the right flags, optionally saves the result under , and reports a one-line summary with the fully-expanded absolute path (no tilde, no magic).
markitdown~/.claude/output/<project>/markitdown/<slug>/The deterministic work — install check, validation, slug derivation, save path, command composition — happens in . The skill parses , hands them to the script, and turns the script's lines into a human report.
scripts/markitdown.sh$ARGUMENTSRESULT:使用微软的 CLI将文档、图片、音频文件或YouTube URL转换为Markdown格式。该工具会验证输入内容、组合正确的参数,可选择将结果保存至路径下,并生成包含完整绝对路径的单行摘要(无波浪号、无特殊路径)。
markitdown~/.claude/output/<project>/markitdown/<slug>/确定性工作——安装检查、验证、slug生成、保存路径、命令组合——均在中完成。该工具会解析,将其传递给脚本,并将脚本的行转换为易读的报告。
scripts/markitdown.sh$ARGUMENTSRESULT:Install
安装
bash
pip install 'markitdown[all]'For a smaller install, pick only what you need:
| Group | Adds |
|---|---|
| PDF parsing |
| Word documents |
| PowerPoint |
| Excel |
| Outlook |
| MP3/WAV via local Whisper |
| YouTube transcripts |
| Azure Document Intelligence backend |
For Azure Document Intelligence, also export before invoking with .
MARKITDOWN_DOCINTEL_ENDPOINT=https://<resource>.cognitiveservices.azure.com/-dbash
pip install 'markitdown[all]'若要精简安装,可仅选择所需组件:
| 分组 | 新增功能 |
|---|---|
| PDF解析 |
| Word文档处理 |
| PowerPoint处理 |
| Excel处理 |
| Outlook |
| 通过本地Whisper实现MP3/WAV音频转录 |
| YouTube字幕提取 |
| Azure Document Intelligence后端支持 |
使用Azure Document Intelligence时,需先导出环境变量,再使用参数调用。
MARKITDOWN_DOCINTEL_ENDPOINT=https://<resource>.cognitiveservices.azure.com/-dParameters
参数
| Flag | Default | Effect |
|---|---|---|
| off | Save Markdown to |
| off | Force no-save (override an ambient save mode) |
| off | Use Azure Document Intelligence (needs |
| off | Enable installed third-party |
| off | Keep data URIs (base64 images) inline in the output |
| — | List installed plugins and exit |
Output saved under , where is the kebab-cased basename of the git toplevel (else cwd) and is a kebab of the input basename (≤5 words). Pipeline-friendly — typical downstream: decomposes the extracted content into workstreams; implements from it; any skill accepting can consume.
~/.claude/output/{project}/markitdown/{slug}/{project}{slug}/forge -s -f <path>/apex -f <path>-f| 参数 | 默认值 | 作用 |
|---|---|---|
| 关闭 | 将Markdown保存至 |
| 关闭 | 强制不保存(覆盖全局保存模式) |
| 关闭 | 使用Azure Document Intelligence(需配置 |
| 关闭 | 启用已安装的第三方 |
| 关闭 | 在输出中保留数据URI(base64图片) |
| — | 列出已安装的插件并退出 |
输出文件保存于,其中是git顶层目录的短横线命名形式(若不存在则为当前工作目录),是输入文件basename的短横线命名形式(最多5个词)。支持流水线操作——典型下游操作:将提取的内容分解为工作流;基于内容执行操作;任何支持参数的工具均可调用该输出。
~/.claude/output/{project}/markitdown/{slug}/{project}{slug}/forge -s -f <path>/apex -f <path>-fWorkflow
工作流程
-
Empty→ propose the most recent non-Markdown target from session context (file or URL) and confirm. Ask only when none is detectable.
$ARGUMENTS -
Run the helper:bash
bash ${CLAUDE_SKILL_DIR}/scripts/markitdown.sh $ARGUMENTS -
The script emitslines — keys:
RESULT: key=value,bytes,slug, plussavedwhen saving (order is not guaranteed; parse by key) — followed either by the converted Markdown (no-save mode, after apathseparator) or nothing (save mode — the file is on disk).--- -
Parse thelines and produce the report below.
RESULT: -
If the script exits with(exit 127) → print the install command from
ERR: markitdown not installedand stop. Never auto-install on the user's behalf.## Install -
If the script exits with another(file not found, missing endpoint, unknown flag) → relay the message verbatim and stop.
ERR:
-
为空 → 从会话上下文推荐最近的非Markdown目标(文件或URL)并确认。仅当无法检测到目标时才询问用户。
$ARGUMENTS -
运行辅助脚本:bash
bash ${CLAUDE_SKILL_DIR}/scripts/markitdown.sh $ARGUMENTS -
脚本会输出行——键包括
RESULT: key=value、bytes、slug,保存时还会包含saved(顺序不固定;需按键解析)——之后要么输出转换后的Markdown(不保存模式,以path分隔),要么无输出(保存模式——文件已存储在磁盘上)。--- -
解析行并生成下方报告。
RESULT: -
若脚本退出时提示(退出码127)→ 打印
ERR: markitdown not installed部分的安装命令并停止。切勿自动为用户安装。## 安装 -
若脚本退出时提示其他(文件未找到、缺少端点、未知参数)→ 直接转发错误信息并停止。
ERR:
Output
输出
markitdown: <input> → <bytes> bytes of Markdown
saved: <path> # only when -sWhen saving, just report. When not saving, also stream the converted Markdown back to the user; if it exceeds ~80 lines, show the first 80 and tell the user to re-run with to capture the full output.
-smarkitdown: <input> → <bytes> 字节的Markdown内容
saved: <path> # 仅在使用-s参数时显示保存时,仅生成报告。不保存时,同时将转换后的Markdown返回给用户;若内容超过约80行,则显示前80行并告知用户需使用参数重新运行以获取完整输出。
-sExamples
示例
bash
/markitdown ~/Downloads/report.pdf # convert, print to terminal
/markitdown -s ~/Downloads/report.pdf # convert + save under ~/.claude/output/<project>/markitdown/report/
/markitdown -s -p deck.pptx # use third-party plugins (e.g. markitdown-ocr)
/markitdown -d invoice.pdf # Azure Document Intelligence
/markitdown -k brand.html # keep base64 images inline
/markitdown https://youtu.be/dQw4w9WgXcQ # YouTube transcript
/markitdown -l # list installed plugins, then exitbash
/markitdown ~/Downloads/report.pdf # 转换并打印到终端
/markitdown -s ~/Downloads/report.pdf # 转换并保存至~/.claude/output/<project>/markitdown/report/
/markitdown -s -p deck.pptx # 使用第三方插件(如markitdown-ocr)
/markitdown -d invoice.pdf # 使用Azure Document Intelligence
/markitdown -k brand.html # 在输出中保留base64图片
/markitdown https://youtu.be/dQw4w9WgXcQ # 提取YouTube字幕
/markitdown -l # 列出已安装的插件,然后退出Notes
注意事项
- YouTube URLs are detected by the prefix and passed straight to
https?://. The slug is derived from the URL's last path segment, so saved paths look likemarkitdown.~/.claude/output/<project>/markitdown/dqw4w9wgxcq/dQw4w9WgXcQ.md - Audio transcription uses local Whisper via the extra. It's CPU-bound — warn the user before kicking off a long podcast.
[audio-transcription] - Image OCR without the plugin only reads embedded EXIF text. For pixel-level OCR,
markitdown-ocrand passpip install markitdown-ocr.-p - No silent overwrites — itself overwrites with
markitdown, but the slug-namespaced save path makes collisions predictable, not surprising.-o
- YouTube URL通过前缀识别,并直接传递给
https?://。slug由URL的最后一段路径生成,因此保存路径类似markitdown。~/.claude/output/<project>/markitdown/dqw4w9wgxcq/dQw4w9WgXcQ.md - 音频转录通过扩展包使用本地Whisper实现。该操作受CPU性能限制——处理长播客前需提醒用户。
[audio-transcription] - 无插件时的图片OCR仅读取嵌入的EXIF文本。如需像素级OCR识别,请执行
markitdown-ocr并传递pip install markitdown-ocr参数。-p - 无静默覆盖——本身可通过
markitdown参数覆盖文件,但基于slug命名的保存路径可让冲突可预测,而非意外发生。-o
Why the wrapper
为何需要封装
markitdown-s/-S/-f-x-m-d-emarkitdown-s/-S/-f-x-m-d-e