html-to-md-cli
v1.0.0
Published
Convert HTML to Markdown from CLI
Readme
html-to-md-cli
CLI tool to convert HTML to Markdown. Uses regex-based parsing — no external DOM libraries.
Install
npm install -g html-to-md-cliUsage
# From file
html2md -f page.html
# From URL
html2md --url https://example.com
# From stdin
cat page.html | html2md --stdin
# Save to file
html2md -f page.html -o output.md
# GitHub Flavored Markdown (tables)
html2md -f page.html --gfmSupported Tags
| HTML | Markdown |
|------|----------|
| <h1>–<h6> | #–###### |
| <p> | Paragraph |
| <a href> | [text](url) |
| <img src alt> |  |
| <strong>, <b> | **bold** |
| <em>, <i> | *italic* |
| <code> | `code` |
| <pre><code> | Fenced code block |
| <ul>, <ol>, <li> | Lists (nested) |
| <blockquote> | > quote |
| <table> | GFM table (with --gfm) |
| <hr> | --- |
| <br> | Line break |
Script and style tags are automatically stripped.
Options
| Flag | Description |
|------|-------------|
| -f, --file <path> | Input HTML file |
| -u, --url <url> | Fetch and convert URL |
| -o, --output <path> | Write to file (default: stdout) |
| --stdin | Read from stdin |
| --gfm | Enable GFM tables |
| -V, --version | Show version |
| -h, --help | Show help |
License
MIT
