Skip to main content

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 with npx:
Or install globally for faster startup:

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

Environment variables

Add these to your shell profile (~/.zshrc or ~/.bashrc) so they persist across sessions:

Usage examples

Basic conversion

Prints Markdown to stdout.

Pipe to an LLM

Save to file

The --meta flag prepends YAML frontmatter with title, source URL, word count, token count, reading time, and date.

Batch from file

Create a file urls.txt:
Then run:
Each URL is saved as a separate .md file in the ./research directory.

Obsidian vault ingestion

This saves each page to ~/Documents/MyVault/raw/ and updates ~/Documents/MyVault/INDEX.md with links to all converted pages.

Reddit with API key

Reddit requires a valid API key. Without one, Reddit URLs will fail due to Reddit’s bot restrictions.

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

Returns structured output:
Useful for programmatic consumption or piping to jq:

Optimized sites

Web2MD includes built-in adapters for these sites, producing cleaner output than generic conversion:
  • 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

Point your AI agent’s context directory at ./context for grounded answers.
Creates an indexed, searchable research vault in Obsidian.
Removes images and links to reduce token usage when piping to LLMs.