d2m v1.3.0
DOM to Markdown CLI
A command-line tool to convert HTML DOM to Semantic Markdown.
Installation
To use the CLI tool with npx
or install it globally, follow these instructions:
Using npx
You can use the tool directly with npx
without needing to install it globally:
npx d2m@latest -i tryme.html -o output.md
Global Installation
To install the CLI tool globally, use the following commands:
- Clone the repository:
git clone https://github.com/romansky/dom-to-semantic-markdown.git
cd examples/cli
- Install dependencies:
npm install
- Build the project:
npm run build
- Link the package globally:
npm link
After linking the package globally, you can use the d2m
command anywhere on your system.
Usage
The d2m
command converts HTML files or URL content to Markdown. Here are the available options:
-i, --input <file>
: Input HTML file-o, --output <file>
: Output Markdown file (if not specified, the result will be printed to the console)-e, --extract-main
: Extract main content (optional)-u, --url <url>
: URL to fetch HTML content from-t, --track-table-columns
: Enable table column tracking for improved LLM data correlation-meta, --include-meta-data <"basic" | "extended">
: Include metadata extracted from the HTML head
Examples
Using npx
- Convert an HTML file and print the result to the console:
npx d2m@latest -i tryme.html
- Convert an HTML file and save the result to a Markdown file:
npx d2m@latest -i tryme.html -o output.md
- Extract the main content from the HTML file and print the result to the console:
npx d2m@latest -i tryme.html -e
- Convert HTML content from a URL and print the result to the console:
npx d2m@latest -u https://example.com
- Convert HTML content from a URL and save the result to a Markdown file:
npx d2m@latest -u https://example.com -o output.md
- Convert an HTML file with table column tracking:
npx d2m@latest -i tryme.html -t
Using Globally Installed CLI
- Convert an HTML file and print the result to the console:
d2m -i tryme.html
- Convert an HTML file and save the result to a Markdown file:
d2m -i tryme.html -o output.md
- Extract the main content from the HTML file and print the result to the console:
d2m -i tryme.html -e
- Convert HTML content from a URL and print the result to the console:
d2m -u https://example.com
- Convert HTML content from a URL and save the result to a Markdown file:
d2m -u https://example.com -o output.md
- Convert HTML content from a URL, extract metadata and print the result to the console:
d2m -u https://example.com -meta basic
License
This project is licensed under the MIT License. See the LICENSE file for details.
5 months ago
6 months ago
10 months ago
10 months ago
10 months ago
9 months ago
9 months ago
10 months ago
10 months ago
9 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago