@lerypapa/html2markdown
v1.0.1
Published
A tool to download HTML from URLs and convert it to Markdown
Downloads
6
Maintainers
Readme
html2markdown
A Node.js tool to download HTML from URLs and convert it to Markdown format.
Features
- Download HTML content from any URL
- Convert HTML to clean Markdown format
- Automatically removes script tags and their contents
- Customizable output filename
- Can be used as a CLI tool or as a module
Installation
npm install -g @lerypapa/html2markdown
# or
yarn global add @lerypapa/html2markdownUsage
As a CLI tool
Basic usage (auto-generated filename):
html2md https://example.comSpecify output filename:
html2md https://example.com output.mdThe first command will:
- Download the HTML from the URL
- Convert it to Markdown
- Save it to an auto-generated file (e.g.,
example-com-20231024123456.md) - Print the filename where the Markdown was saved
The second command will save the output to the specified file (output.md).
As a Module
Basic usage (auto-generated filename):
const html2markdown = require('@lerypapa/html2markdown');
html2markdown('https://example.com')
.then(markdown => {
console.log('Conversion complete!');
})
.catch(error => {
console.error('Error:', error.message);
});Specify output filename:
html2markdown('https://example.com', 'output.md')
.then(markdown => {
console.log('Conversion complete!');
})
.catch(error => {
console.error('Error:', error.message);
});License
MIT
