markitdown-python
Skill2 starsChanged 35 days agoMITView on GitHub
Convert files to Markdown using Microsoft's MarkItDown tool. Supports PDF, Word, PowerPoint, Excel, images, audio, HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs.
- Installs packages
In this repository9 other files it gives its agents.
- code-reviewSkill
- grill-meSkill
- handoff-conversationSkill
- himalaya-email-rustSkill
- pptxSkill
- siri-shortcut-editingSkill
- weread-skillsSkill
- yahoo-finance-pythonSkill
- youtube-dlp-pythonSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Before converting any file, follow this check sequence:
- Distinctive: line 179
After conversion, verify that the Markdown output exists and is not empty.
- Distinctive: line 188
If the source filename is unusually long or contains awkward spacing, use a shorter Markdown output filename while keeping it beside the …
- Very specific: line 194
Use -o flag to write directly to a file instead of stdout
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MarkItDown Skill
Convert various file formats to Markdown using microsoft/markitdown.
Pre-Check
Before converting any file, follow this check sequence:
Step 1: Check if markitdown is already in PATH
# Windows
Get-Command markitdown -ErrorAction SilentlyContinue# macOS / Linux
which markitdown || command -v markitdownIf found → skip to Usage.
Step 2: Check if markitdown exists in ~/.venv
# Windows
Test-Path "$env:USERPROFILE\.venv\Scripts\markitdown.exe"# macOS / Linux
test -f ~/.venv/bin/markitdown && echo "found"If found → add to PATH for this session, then proceed to Usage:
# Windows
$env:PATH = "$env:USERPROFILE\.venv\Scripts;$env:PATH"# macOS / Linux
export PATH="$HOME/.venv/bin:$PATH"Step 3: Install (only if Steps 1 and 2 both failed)
# Windows
python -m venv "$env:USERPROFILE\.venv"
& "$env:USERPROFILE\.venv\Scripts\pip" install "markitdown[all]"
$env:PATH = "$env:USERPROFILE\.venv\Scripts;$env:PATH"# macOS / Linux
python3 -m venv ~/.venv
~/.venv/bin/pip install "markitdown[all]"
export PATH="$HOME/.venv/bin:$PATH"Installation Location
MarkItDown is installed in a dedicated venv at ~/.venv:
| Platform | Executable | pip |
| Windows | ~\.venv\Scripts\markitdown.exe | ~\.venv\Scripts\pip.exe |
| macOS / Linux | ~/.venv/bin/markitdown | ~/.venv/bin/pip |
Supported Formats
- PowerPoint (.pptx)
- Word (.docx)
- Excel (.xlsx, .xls)
- Images (EXIF metadata, OCR with plugin)
- Audio (EXIF metadata, speech transcription)
- HTML
- Text-based formats (CSV, JSON, XML)
- ZIP files (iterates over contents)
- YouTube URLs
- EPubs
- Outlook messages (.msg)
Usage
Command-Line (preferred for simple conversions)
# Windows - convert a file to markdown (output to stdout)
markitdown "path\to\file.pdf"
# Save output to a file
markitdown "path\to\file.pdf" -o output.md# macOS / Linux
markitdown path/to/file.pdf
markitdown path/to/file.pdf -o output.md
cat path/to/file.pdf | markitdownAutomated Conversion Script
For repeatable file conversions, use scripts/convert_to_markdown.py. Run it with the current python when that environment can import markitdown; use the dedicated virtual-environment interpreter only when the current environment does not have the dependency. The script converts the input, removes NUL characters from generated text, writes UTF-8 without a BOM, validates that the output is not empty, and prints the output path.
python "$env:USERPROFILE\.agents\skills\markitdown-python\scripts\convert_to_markdown.py" ".\input.msg" -o ".\output.md"python ~/.agents/skills/markitdown-python/scripts/convert_to_markdown.py ./input.msg -o ./output.mdThe relative input and output paths are resolved from the current working directory. When -o is omitted for a local file, the script creates the Markdown file beside the input with the same base name. If python cannot import markitdown, replace python with the interpreter under ~/.venv shown in the installation section.
Python API (for advanced use cases)
# Windows
& "$env:USERPROFILE\.venv\Scripts\python.exe" -c "
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert(r'path\to\file.pdf')
print(result.text_content)
"# macOS / Linux
~/.venv/bin/python -c "
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert('path/to/file.pdf')
print(result.text_content)
"With LLM image descriptions
from markitdown import MarkItDown
from openai import OpenAI
client = OpenAI()
md = MarkItDown(llm_client=client, llm_model='gpt-4o')
result = md.convert('path/to/image.jpg')
print(result.text_content)Azure Document Intelligence
markitdown "path/to/file.pdf" -d -e "<endpoint>"Output Validation
After conversion, verify that the Markdown output exists and is not empty. If the generated text contains NUL characters, remove them and rewrite the Markdown as UTF-8 without a BOM. Apply this only to the generated text output, never to the source file:
$outputPath = 'path\to\output.md'
$text = [System.IO.File]::ReadAllText($outputPath).Replace(([string][char]0), '')
[System.IO.File]::WriteAllText($outputPath, $text, [System.Text.UTF8Encoding]::new($false))
if ((Get-Item -LiteralPath $outputPath).Length -eq 0) { throw 'Markdown output is empty.' }If the source filename is unusually long or contains awkward spacing, use a shorter Markdown output filename while keeping it beside the source file.
Notes
- The ffmpeg warning about pydub can be ignored unless audio transcription is needed
- For audio transcription, install ffmpeg and add to PATH
- Use
-oflag to write directly to a file instead of stdout - For large files, prefer writing to a file rather than capturing stdout
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

