@aiquants/html-to-markdown 0.3.0 → 0.5.0
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 +123 -4
- package/dist/{core-CouDTni-.js → core-DJV8t_Qj.js} +8 -4
- package/dist/core-Dq4LfiYy.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/main.cjs +1 -1
- package/dist/main.js +30 -13
- package/dist/mcp-server-CMBUHOmc.cjs +1 -0
- package/dist/{mcp-server-BAmy7d8r.js → mcp-server-DD8CqdNw.js} +59 -2
- package/dist/{mcp-server-streamable-CVDJHcWu.js → mcp-server-streamable-DODolSbj.js} +127 -3
- package/dist/{mcp-server-streamable-mF26pg3E.cjs → mcp-server-streamable-IQlimU2H.cjs} +1 -1
- package/dist/mcp-streamable.cjs +1 -1
- package/dist/mcp-streamable.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/mcp-common.d.ts +57 -0
- package/dist/src/mcp-server-streamable.d.ts +15 -2
- package/dist/src/mcp-server.d.ts +79 -2
- package/dist/src/types.d.ts +6 -6
- package/dist/{version-Cg6D6H9g.cjs → version-BkgGdAYt.cjs} +1 -1
- package/dist/{version-BF9-U8Ef.js → version-CTdrYd1G.js} +81 -7
- package/mcp.json +2 -2
- package/package.json +1 -1
- package/dist/core-D2dlEt1l.cjs +0 -1
- package/dist/mcp-server-CCu0Pcm3.cjs +0 -1
|
@@ -5,7 +5,7 @@ Object.assign(global, {
|
|
|
5
5
|
window,
|
|
6
6
|
self: window
|
|
7
7
|
});
|
|
8
|
-
import { b as getDefaultExportFromCjs } from "./core-
|
|
8
|
+
import { b as getDefaultExportFromCjs } from "./core-DJV8t_Qj.js";
|
|
9
9
|
import { promises } from "fs";
|
|
10
10
|
import { resolve, dirname } from "path";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
@@ -11297,7 +11297,7 @@ function parseHtmlToMarkdownArgs(args) {
|
|
|
11297
11297
|
throw new Error("Arguments are required");
|
|
11298
11298
|
}
|
|
11299
11299
|
const { url, html_content, locale = "en-US" } = args;
|
|
11300
|
-
if (!url
|
|
11300
|
+
if (!(url || html_content)) {
|
|
11301
11301
|
throw new Error("Either 'url' or 'html_content' is required");
|
|
11302
11302
|
}
|
|
11303
11303
|
if (url && typeof url !== "string") {
|
|
@@ -11323,7 +11323,7 @@ function parseSaveContentArgs(args) {
|
|
|
11323
11323
|
if (!content || typeof content !== "string") {
|
|
11324
11324
|
throw new Error("'content' is required and must be a string");
|
|
11325
11325
|
}
|
|
11326
|
-
if (!save_path
|
|
11326
|
+
if (!(save_path || save_directory)) {
|
|
11327
11327
|
throw new Error("Either 'save_path' or 'save_directory' is required");
|
|
11328
11328
|
}
|
|
11329
11329
|
if (save_path && typeof save_path !== "string") {
|
|
@@ -11345,6 +11345,47 @@ function parseSaveContentArgs(args) {
|
|
|
11345
11345
|
filename
|
|
11346
11346
|
};
|
|
11347
11347
|
}
|
|
11348
|
+
function parseUrlToMarkdownFileArgs(args) {
|
|
11349
|
+
if (!args || typeof args !== "object") {
|
|
11350
|
+
throw new Error("Arguments are required");
|
|
11351
|
+
}
|
|
11352
|
+
const { url, html_content, locale = "en-US", save_path, save_directory, filename } = args;
|
|
11353
|
+
if (!(url || html_content)) {
|
|
11354
|
+
throw new Error("Either 'url' or 'html_content' is required");
|
|
11355
|
+
}
|
|
11356
|
+
if (url && typeof url !== "string") {
|
|
11357
|
+
throw new Error("'url' must be a string");
|
|
11358
|
+
}
|
|
11359
|
+
if (html_content && typeof html_content !== "string") {
|
|
11360
|
+
throw new Error("'html_content' must be a string");
|
|
11361
|
+
}
|
|
11362
|
+
if (locale && !["en-US", "ja-JP"].includes(locale)) {
|
|
11363
|
+
throw new Error("'locale' must be 'en-US' or 'ja-JP'");
|
|
11364
|
+
}
|
|
11365
|
+
if (!(save_path || save_directory)) {
|
|
11366
|
+
throw new Error("Either 'save_path' or 'save_directory' is required");
|
|
11367
|
+
}
|
|
11368
|
+
if (save_path && typeof save_path !== "string") {
|
|
11369
|
+
throw new Error("'save_path' must be a string");
|
|
11370
|
+
}
|
|
11371
|
+
if (save_directory && typeof save_directory !== "string") {
|
|
11372
|
+
throw new Error("'save_directory' must be a string");
|
|
11373
|
+
}
|
|
11374
|
+
if (filename && typeof filename !== "string") {
|
|
11375
|
+
throw new Error("'filename' must be a string");
|
|
11376
|
+
}
|
|
11377
|
+
if (save_path && save_directory) {
|
|
11378
|
+
throw new Error("Cannot specify both 'save_path' and 'save_directory'");
|
|
11379
|
+
}
|
|
11380
|
+
return {
|
|
11381
|
+
url,
|
|
11382
|
+
html_content,
|
|
11383
|
+
locale,
|
|
11384
|
+
save_path,
|
|
11385
|
+
save_directory,
|
|
11386
|
+
filename
|
|
11387
|
+
};
|
|
11388
|
+
}
|
|
11348
11389
|
function generateFilename(url) {
|
|
11349
11390
|
return "page";
|
|
11350
11391
|
}
|
|
@@ -11406,6 +11447,38 @@ const MCP_TOOL_SCHEMAS = {
|
|
|
11406
11447
|
},
|
|
11407
11448
|
required: ["content"],
|
|
11408
11449
|
anyOf: [{ required: ["save_path"] }, { required: ["save_directory"] }]
|
|
11450
|
+
},
|
|
11451
|
+
urlToMarkdownFile: {
|
|
11452
|
+
type: "object",
|
|
11453
|
+
properties: {
|
|
11454
|
+
url: {
|
|
11455
|
+
type: "string",
|
|
11456
|
+
description: "URL of the web page to convert and save as Markdown file (e.g., https://example.com). Handles JavaScript-rendered dynamic content effectively."
|
|
11457
|
+
},
|
|
11458
|
+
html_content: {
|
|
11459
|
+
type: "string",
|
|
11460
|
+
description: "HTML string to convert directly and save as Markdown file. Use instead of URL for local files or API response HTML content."
|
|
11461
|
+
},
|
|
11462
|
+
locale: {
|
|
11463
|
+
type: "string",
|
|
11464
|
+
description: "Browser locale setting. Use 'ja-JP' for Japanese sites, 'en-US' for English sites. Affects content rendering and language detection.",
|
|
11465
|
+
enum: ["en-US", "ja-JP"],
|
|
11466
|
+
default: "en-US"
|
|
11467
|
+
},
|
|
11468
|
+
save_path: {
|
|
11469
|
+
type: "string",
|
|
11470
|
+
description: "Complete file path including filename to save the converted Markdown content (e.g., '/home/user/output.md'). Cannot be used with save_directory."
|
|
11471
|
+
},
|
|
11472
|
+
save_directory: {
|
|
11473
|
+
type: "string",
|
|
11474
|
+
description: "Directory path to save the converted Markdown content with auto-generated filename (e.g., '/home/user/downloads'). Cannot be used with save_path."
|
|
11475
|
+
},
|
|
11476
|
+
filename: {
|
|
11477
|
+
type: "string",
|
|
11478
|
+
description: "Base filename to use when save_directory is specified (e.g., 'my-document'). Extension .md will be added automatically."
|
|
11479
|
+
}
|
|
11480
|
+
},
|
|
11481
|
+
anyOf: [{ required: ["url", "save_path"] }, { required: ["url", "save_directory"] }, { required: ["html_content", "save_path"] }, { required: ["html_content", "save_directory"] }]
|
|
11409
11482
|
}
|
|
11410
11483
|
};
|
|
11411
11484
|
function createErrorResult(error) {
|
|
@@ -11454,12 +11527,13 @@ export {
|
|
|
11454
11527
|
createErrorResult as a,
|
|
11455
11528
|
parseSaveContentArgs as b,
|
|
11456
11529
|
createSuccessResult as c,
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11530
|
+
parseUrlToMarkdownFileArgs as d,
|
|
11531
|
+
isJSONRPCRequest as e,
|
|
11532
|
+
SUPPORTED_PROTOCOL_VERSIONS as f,
|
|
11460
11533
|
getPackageVersion as g,
|
|
11461
|
-
|
|
11534
|
+
isJSONRPCResponse as h,
|
|
11462
11535
|
isInitializeRequest as i,
|
|
11536
|
+
isJSONRPCError as j,
|
|
11463
11537
|
parseHtmlToMarkdownArgs as p,
|
|
11464
11538
|
saveContentToFile as s
|
|
11465
11539
|
};
|
package/mcp.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"html-to-markdown": {
|
|
4
4
|
"command": "npx",
|
|
5
5
|
"args": ["@aiquants/html-to-markdown", "aiq-html2md-mcp"],
|
|
6
|
-
"description": "Convert web pages and HTML to Markdown with JavaScript dynamic content support, table structure preservation, and file saving."
|
|
6
|
+
"description": "Convert web pages and HTML to Markdown with JavaScript dynamic content support, table structure preservation, and file saving. Includes integrated URL-to-file conversion tool."
|
|
7
7
|
},
|
|
8
8
|
"html-to-markdown-streamable": {
|
|
9
9
|
"command": "npx",
|
|
10
10
|
"args": ["@aiquants/html-to-markdown", "aiq-html2md-mcp-stream"],
|
|
11
|
-
"description": "HTML to Markdown converter with real-time progress updates and file saving support. Ideal for large pages and time-consuming conversions with JavaScript dynamic content support."
|
|
11
|
+
"description": "HTML to Markdown converter with real-time progress updates and file saving support. Ideal for large pages and time-consuming conversions with JavaScript dynamic content support. Includes streamable URL-to-file conversion tool."
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|