1.3.0 • Published 5 months ago

d2m v1.3.0

Weekly downloads
-
License
MIT*
Repository
-
Last release
5 months ago

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:

  1. Clone the repository:
git clone https://github.com/romansky/dom-to-semantic-markdown.git
cd examples/cli
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. 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

  1. Convert an HTML file and print the result to the console:
npx d2m@latest -i tryme.html
  1. Convert an HTML file and save the result to a Markdown file:
npx d2m@latest -i tryme.html -o output.md
  1. Extract the main content from the HTML file and print the result to the console:
npx d2m@latest -i tryme.html -e
  1. Convert HTML content from a URL and print the result to the console:
npx d2m@latest -u https://example.com
  1. Convert HTML content from a URL and save the result to a Markdown file:
npx d2m@latest -u https://example.com -o output.md
  1. Convert an HTML file with table column tracking:
npx d2m@latest -i tryme.html -t

Using Globally Installed CLI

  1. Convert an HTML file and print the result to the console:
d2m -i tryme.html
  1. Convert an HTML file and save the result to a Markdown file:
d2m -i tryme.html -o output.md
  1. Extract the main content from the HTML file and print the result to the console:
d2m -i tryme.html -e
  1. Convert HTML content from a URL and print the result to the console:
d2m -u https://example.com
  1. Convert HTML content from a URL and save the result to a Markdown file:
d2m -u https://example.com -o output.md
  1. 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.

1.3.0

5 months ago

1.2.16

6 months ago

1.2.7

10 months ago

1.2.6

10 months ago

1.2.5

10 months ago

1.2.12

9 months ago

1.2.13

9 months ago

1.2.10

10 months ago

1.2.11

10 months ago

1.2.14

9 months ago

1.2.4

11 months ago

1.2.2

11 months ago

1.2.0

11 months ago

1.2.1

11 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.0

11 months ago