CLI utility for converting HTML pages (e.g. saved from Chrome) to Markdown.
# Homebrew
brew install vsyaco/tap/html2md
# Go
go install github.com/vsyaco/html2md@latestOr download a binary from Releases.
html2md [flags] <file.html>
Flags:
--article Extract main content only (readability)
--domain string Base URL for resolving relative links
-h, --help help for html2md
--no-images Remove images
-o, --output string Output .md file path
--stdout Print to stdout instead of file
-v, --version version for html2md
# Convert to page.md next to the source file
html2md page.html
# Print to stdout
html2md page.html --stdout
# Extract main article content (strips nav, ads, etc.)
html2md page.html --article --stdout
# Write to a specific path
html2md page.html -o ~/notes/page.md
# Remove images and resolve relative links
html2md page.html --no-images --domain https://example.comDefault — removes noisy elements (nav, footer, header, aside, forms, ads/sidebar/cookie/menu class elements) then converts the cleaned HTML to Markdown.
Article (--article) — uses go-readability (port of Mozilla Readability.js) to extract the main article content before converting.
MIT