A Deno CLI tool that converts any webpage to clean Markdown format using Playwright and Mozilla Readability.
- Uses Playwright to render JavaScript-heavy websites
- Extracts main article content using Mozilla Readability
- Converts HTML to clean Markdown format
- Preserves article metadata (title, byline, excerpt)
- Outputs to file or stdout
- Deno 2.0 or later
deno install -A --global -n url-to-md https://raw.githubusercontent.com/zph/url-to-md/refs/heads/main/url-to-md.ts
Before using the tool, install the required browser:
npx playwright install chromiumchmod +x url-to-md.tsdeno install -A -n url-to-md url-to-md.tsAfter installation, you can use url-to-md from anywhere.
# With shebang (after chmod +x)
./url-to-md.ts <url>
# Or with deno command
deno run -A url-to-md.ts <url>url-to-md https://example.comurl-to-md https://example.com -o article.md./url-to-md.ts https://example.com -o article.md-o, --output <file>- Output file (default: stdout)-h, --help- Show help message
- Launches a headless Chromium browser using Playwright
- Navigates to the specified URL and waits for the page to fully load
- Extracts the rendered HTML content
- Uses Mozilla Readability to extract the main article content
- Converts the HTML to Markdown using Turndown
- Adds metadata (title, byline, excerpt, source URL)
- Outputs the result
The tool uses -A (all permissions) which includes:
--allow-net- To fetch webpages--allow-write- To write output files--allow-read- To read configuration--allow-env- For Playwright to access environment variables--allow-run- For Playwright to launch the browser--allow-ffi- For Playwright's native bindings--allow-sys- For Playwright to detect system information
Convert a blog post to Markdown:
url-to-md https://blog.example.com/my-post -o post.mdConvert a news article:
url-to-md https://news.example.com/article/123 -o article.mdPipe output to another tool:
url-to-md https://example.com | grep "keyword"MIT