harn read
harn read [options] [html-file]Turns an HTML page into clean, readable markdown — Readability strips the chrome (nav, ads, boilerplate) and Turndown converts what’s left. Reads from a file argument or from stdin when the argument is -, which is what makes it the tail end of a scrape pipeline. Pair it with harn fetch or harn browse:
harn fetch https://example.com | harn read -Options
Section titled “Options”| Flag | Description |
|---|---|
-o, --output <file> |
Write markdown to a file instead of stdout. |
--url <url> |
Base URL, used to resolve relative links in the source HTML. |
--selector <css> |
Extract from this CSS selector instead of Readability. The fallback for when automatic extraction misses the main content. |
--raw |
Output cleaned HTML instead of markdown (for debugging extraction). |
--max-chars <n> |
Truncate output to N characters (0 disables). Default 100000. |
Examples
Section titled “Examples”# Convert a saved HTML file to markdownharn read /path/to/page.html
# Canonical scrape-to-markdown pipeline (stdin via '-')harn fetch https://example.com | harn read -
# Fetch raw HTML with a real browser, then extractharn browse https://example.com --html | harn read -
# Supply a base URL so relative links resolveharn fetch https://example.com/article | harn read - --url https://example.com
# Bypass Readability when it misses the main contentharn read /path/to/page.html --selector 'main.article'
# Inspect the cleaned HTML instead of markdownharn read /path/to/page.html --rawReadability works best on article-shaped pages. When a page’s real content lives outside what Readability picks (an app shell, a dashboard, a narrow content pane), pass --selector to target it directly, or use --raw to see what the cleaner kept before converting.