@aiquants/html-to-markdown 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,13 +22,18 @@ npm install @aiquants/html-to-markdown
22
22
 
23
23
  ### As a Command-Line Tool
24
24
 
25
- You can run the tool directly using `npx` without installation. The converted Markdown will be saved in the `.outputs/raw` directory.
25
+ You can run the tool directly using `npx` without installation. By default, the converted Markdown will be saved in the `.outputs/raw` directory, but you can specify a custom output path using the `--output` option.
26
26
 
27
27
  ```bash
28
- npx @aiquants/html-to-markdown <URL> [--locale <locale>]
28
+ npx @aiquants/html-to-markdown <URL> [--locale <locale>] [--output <path>]
29
29
  ```
30
30
 
31
- **Example:**
31
+ **Options:**
32
+
33
+ - `--locale <locale>`: Set the locale for the browser context and console messages (`en-US` or `ja-JP`). Defaults to `en-US`.
34
+ - `--output <path>`, `-o <path>`: Specify the output file path. If not specified, the file will be saved in the `.outputs/raw` directory with an auto-generated filename.
35
+
36
+ **Examples:**
32
37
 
33
38
  ```bash
34
39
  # Convert a Wikipedia page with the Japanese locale
@@ -36,6 +41,12 @@ npx @aiquants/html-to-markdown https://ja.wikipedia.org/wiki/Node.js --locale ja
36
41
 
37
42
  # Convert an English page (locale defaults to en-US)
38
43
  npx @aiquants/html-to-markdown https://en.wikipedia.org/wiki/Node.js
44
+
45
+ # Save to a specific file
46
+ npx @aiquants/html-to-markdown https://en.wikipedia.org/wiki/Node.js --output ./my-output.md
47
+
48
+ # Use short option for output
49
+ npx @aiquants/html-to-markdown https://ja.wikipedia.org/wiki/Node.js --locale ja-JP -o ./nodejs-ja.md
39
50
  ```
40
51
 
41
52
  ### As a Library
@@ -105,6 +116,7 @@ This project is built upon the following open-source software. We are grateful t
105
116
  | Package | License |
106
117
  | ------------------------ | ---------- |
107
118
  | github-slugger | MIT |
119
+ | happy-dom | MIT |
108
120
  | hast | MIT |
109
121
  | hast-util-to-html | MIT |
110
122
  | playwright | Apache-2.0 |
@@ -9,11 +9,12 @@ import { chromium } from "playwright";
9
9
  const messages = {
10
10
  "ja-JP": {
11
11
  error_url_required: "エラー: 変換対象のURLを引数で指定してください。",
12
- usage: "使用法: node dist/main.js <URL> [--locale <ロケール>]",
13
- example: "例: node dist/main.js https://ja.wikipedia.org/wiki/Node.js --locale ja-JP",
12
+ usage: "使用法: node dist/main.js <URL> [--output <ファイルパス>] [--locale <ロケール>]",
13
+ example: "例: node dist/main.js https://ja.wikipedia.org/wiki/Node.js -o output.md --locale ja-JP",
14
14
  cli_start: "🚀 コマンドラインから処理を開始します...",
15
15
  cli_url: " - URL: {url}",
16
16
  cli_locale: " - Locale: {locale}",
17
+ cli_output: " - Output: {path}",
17
18
  success_save: "✅ Markdownファイルが正常に保存されました。",
18
19
  success_path: " -> {path}",
19
20
  error_app: "❌ アプリケーションの実行中にエラーが発生しました。",
@@ -28,11 +29,12 @@ const messages = {
28
29
  },
29
30
  "en-US": {
30
31
  error_url_required: "Error: Please specify the URL to convert as an argument.",
31
- usage: "Usage: node dist/main.js <URL> [--locale <locale>]",
32
- example: "Example: node dist/main.js https://en.wikipedia.org/wiki/Node.js --locale en-US",
32
+ usage: "Usage: node dist/main.js <URL> [--output <file path>] [--locale <locale>]",
33
+ example: "Example: node dist/main.js https://en.wikipedia.org/wiki/Node.js -o output.md --locale en-US",
33
34
  cli_start: "🚀 Starting process from command line...",
34
35
  cli_url: " - URL: {url}",
35
36
  cli_locale: " - Locale: {locale}",
37
+ cli_output: " - Output: {path}",
36
38
  success_save: "✅ Markdown file saved successfully.",
37
39
  success_path: " -> {path}",
38
40
  error_app: "❌ An error occurred during application execution.",