Web to Markdown
Convert URLs and local files to Markdown for analysis, quoting, or processing. Optionally summarize long documents before deeper work.
When to use
Use this skill when you need to:
- pull down a web page as a document-like Markdown representation
- convert binary docs (PDF/DOCX/PPTX) into Markdown for analysis
- quickly produce a short summary of a long document before deeper work
Quick Usage
Convert a URL or file
uvx --from 'markitdown[pdf]' markitdown <url-or-path>
Save to a specific file:
uvx --from 'markitdown[pdf]' markitdown <url-or-path> > /tmp/doc.md
Convert + summarize
Use the wrapper script for summarization with context:
node scripts/to-markdown.mjs <url-or-path> --summary --prompt "Focus on security implications"
node scripts/to-markdown.mjs <url-or-path> --tmp # write to temp file, print path
node scripts/to-markdown.mjs <url-or-path> --out notes.md
The summarizer:
- Converts to Markdown via
markitdown - Saves full Markdown to a temp file (prints path as hint so you can inspect the full content)
- Runs
pi --model claude-haiku-4-5to summarize with your prompt
Always provide context — summaries are only useful when you provide what you want extracted and the audience/purpose. Without a focus prompt, summaries become generic and unhelpful.
Batch processing (shell function)
Add to .bashrc / .zshrc:
web-to-markdown() {
local url output_dir format batch_file output_file
output_dir="." format="markdown"
while [[ $# -gt 0 ]]; do
case $1 in
--batch) batch_file="$2"; shift 2 ;;
--output-dir) output_dir="$2"; shift 2 ;;
--format) format="$2"; shift 2 ;;
--output) output_file="$2"; shift 2 ;;
*) url="$1"; shift ;;
esac
done
_fetch() {
local u=$1 fmt=$2
local content
content=$(uvx --from 'markitdown[pdf]' markitdown "$u" 2>/dev/null) \
|| content=$(curl -sL "$u" | pandoc -f html -t markdown)
[[ -z "$content" ]] && return 1
[[ "$fmt" == "plain" ]] && echo "$content" | pandoc -f markdown -t plain || echo "$content"
}
if [[ -n "${batch_file-}" ]]; then
[[ ! -f "$batch_file" ]] && { echo "ERROR: $batch_file not found" >&2; return 1; }
mkdir -p "$output_dir"
local ok=0 fail=0
while IFS= read -r u || [[ -n "$u" ]]; do
[[ -z "$u" || "$u" =~ ^# ]] && continue
local name ext out
name=$(echo "$u" | sed 's|https\?://||;s|/|-|g' | cut -c1-100)
ext=$([[ "$format" == "plain" ]] && echo txt || echo md)
out="$output_dir/${name}.${ext}"
if _fetch "$u" "$format" > "$out" 2>/dev/null; then
echo "✓ $(basename "$out")" >&2; (( ++ok ))
else
echo "✗ $u" >&2; rm -f "$out"; (( ++fail ))
fi
done < "$batch_file"
echo "Done: $ok ok, $fail failed" >&2
return $(( fail > 0 ? 1 : 0 ))
fi
[[ -z "${url-}" ]] && { echo "Usage: web-to-markdown <URL> [--output FILE] [--format markdown|plain]" >&2; return 1; }
[[ -z "${output_file-}" ]] && {
local name ext
name=$(echo "$url" | sed 's|https\?://||;s|/|-|g' | cut -c1-100)
ext=$([[ "$format" == "plain" ]] && echo txt || echo md)
output_file="${name}.${ext}"
}
_fetch "$url" "$format" > "$output_file" && echo "✓ Saved: $output_file" || { rm -f "$output_file"; return 1; }
}
Examples:
web-to-markdown "https://example.com/article" --output article.md
web-to-markdown --batch urls.txt --output-dir ./docs --format markdown
web-to-markdown "https://example.com" --format plain
Dependencies
markitdown(auto-installed viauvx) — smart content extractioncurl+pandoc— fallback for when markitdown failspi— only needed for--summarymode