Overview
The Web2MD CLI lets you convert any URL to clean Markdown directly from your terminal. Pipe output to LLMs, batch-process URL lists, or ingest content into your Obsidian vault — all without opening a browser.The CLI requires Node.js 18+. Run
node -v to check your version.Installation
No installation needed — just run withnpx:
Modes
Web2MD CLI operates in three modes depending on your configuration:Local
Default mode. No API key required. Fetches pages and converts locally. Works for most public websites.
Server
With API key. Set
WEB2MD_API_KEY to unlock Reddit, Fandom/Wikia, and other restricted sites that require server-side handling.Bridge
With
--bridge flag. Uses your Chrome extension to fetch JS-rendered or login-protected pages that static fetching cannot reach.Flags
Commands
Besides converting URLs, the CLI has two subcommands for authentication and Library sync:login
https://web2md.org and shows a code to approve. Once approved, your API key is saved to ~/.web2md/config.json — no need to export WEB2MD_API_KEY in every shell. The MCP server reads from the same file, so logging in once here also authenticates MCP tool calls.
Prefer to paste a key directly instead of the browser flow?
w2m_...) on stdin and saves it the same way. Get a key from the dashboard.
sync
WEB2MD_API_KEY set).
Sync is incremental by default: it tracks a cursor in
<dir>/.web2md-sync.json and only pulls new items on subsequent runs. Point Obsidian (or any Markdown-reading tool) at the target directory to browse your Library as notes.
Environment variables
Usage examples
Basic conversion
Pipe to an LLM
Save to file
--meta flag prepends YAML frontmatter with title, source URL, word count, token count, reading time, and date.
Batch from file
Create a fileurls.txt:
.md file in the ./research directory.
Filenames contain a short URL hash, so pages with identical titles do not
overwrite one another. Re-run an interrupted batch with --resume.
By default, any failed URL makes the command return a non-zero exit code. Use
--allow-partial only when partial results should count as success.
Obsidian vault ingestion
~/Documents/MyVault/raw/ and updates ~/Documents/MyVault/INDEX.md with links to all converted pages.
Reddit with API key
Bridge mode
Use the Chrome extension to handle JS-rendered or login-protected pages:Bridge mode requires the Web2MD Chrome extension to be installed and Chrome to be running. The CLI communicates with the extension via Chrome’s native messaging protocol.
JSON output
jq:
--json returns one valid JSON array containing a result
or error record for each URL:
Optimized sites
Web2MD includes built-in adapters for these sites, producing cleaner output than generic conversion:Sites with optimized support
Sites with optimized support
- Wikipedia — clean article extraction, infobox handling
- arXiv — paper abstracts and metadata
- Hacker News — threads with comments
- GitHub — Issues and Pull Requests
- Stack Overflow — questions and answers
- dev.to — blog posts
- Medium — articles (bypasses paywall preview)
- Substack — newsletter posts
- OpenAI Docs — documentation pages
- Mintlify-based docs — documentation sites built on Mintlify
- Reddit — posts and comments (requires API key)
Common workflows
Feed documentation to an AI agent
Feed documentation to an AI agent
./context for grounded answers.Build a research corpus
Build a research corpus
Strip formatting for LLM input
Strip formatting for LLM input