@aiquants/html-to-markdown 0.4.0 → 0.5.1
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 +43 -3
- package/dist/core--XIBQvpW.cjs +1 -0
- package/dist/{core-CouDTni-.js → core-DhxxOcPm.js} +342 -7
- 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-DzB_5cTs.js → mcp-server-DOe8W9IZ.js} +2 -2
- package/dist/{mcp-server-Co1kuNGX.cjs → mcp-server-Dn3EHzcf.cjs} +1 -1
- package/dist/{mcp-server-streamable-BNn6Kd9b.cjs → mcp-server-streamable-DUB_ixZe.cjs} +1 -1
- package/dist/{mcp-server-streamable-CcZ7Lsel.js → mcp-server-streamable-pcpU_lDl.js} +3 -3
- 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-server.d.ts +1 -1
- package/dist/src/plugins/index.d.ts +1 -0
- package/dist/src/plugins/rehype-decode-entities.d.ts +14 -0
- package/dist/src/types.d.ts +6 -6
- package/dist/tests/entity-decoding.test.d.ts +5 -0
- package/dist/{version-BSh9aXhF.js → version-BNwQMbri.js} +5 -5
- package/dist/{version-dpS3SSul.cjs → version-BsWiDlbg.cjs} +1 -1
- package/package.json +1 -1
- package/dist/core-D2dlEt1l.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as JSONRPCMessageSchema, i as isInitializeRequest, e as isJSONRPCRequest, D as DEFAULT_NEGOTIATED_PROTOCOL_VERSION, f as SUPPORTED_PROTOCOL_VERSIONS, h as isJSONRPCResponse, j as isJSONRPCError, g as getPackageVersion, S as Server, I as InitializeRequestSchema, L as ListToolsRequestSchema, C as CallToolRequestSchema, p as parseHtmlToMarkdownArgs, b as parseSaveContentArgs, s as saveContentToFile, d as parseUrlToMarkdownFileArgs } from "./version-
|
|
2
|
-
import { a as getAugmentedNamespace, c as commonjsGlobal, b as getDefaultExportFromCjs, h as htmlToMarkdown } from "./core-
|
|
1
|
+
import { J as JSONRPCMessageSchema, i as isInitializeRequest, e as isJSONRPCRequest, D as DEFAULT_NEGOTIATED_PROTOCOL_VERSION, f as SUPPORTED_PROTOCOL_VERSIONS, h as isJSONRPCResponse, j as isJSONRPCError, g as getPackageVersion, S as Server, I as InitializeRequestSchema, L as ListToolsRequestSchema, C as CallToolRequestSchema, p as parseHtmlToMarkdownArgs, b as parseSaveContentArgs, s as saveContentToFile, d as parseUrlToMarkdownFileArgs } from "./version-BNwQMbri.js";
|
|
2
|
+
import { a as getAugmentedNamespace, c as commonjsGlobal, b as getDefaultExportFromCjs, h as htmlToMarkdown } from "./core-DhxxOcPm.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import cors from "cors";
|
|
5
5
|
import express from "express";
|
|
@@ -7551,7 +7551,7 @@ class StreamableHtmlToMarkdownMcpServer {
|
|
|
7551
7551
|
try {
|
|
7552
7552
|
res.setHeader("Content-Type", "application/json");
|
|
7553
7553
|
const request = req.body;
|
|
7554
|
-
if (!request
|
|
7554
|
+
if (!(request && request.method)) {
|
|
7555
7555
|
res.status(400).json({
|
|
7556
7556
|
jsonrpc: "2.0",
|
|
7557
7557
|
error: {
|
package/dist/mcp-streamable.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";require("./mcp-server-streamable-
|
|
2
|
+
"use strict";require("./mcp-server-streamable-DUB_ixZe.cjs").runStreamableMcpServer().catch(e=>{process.exit(1)});
|
package/dist/mcp-streamable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { r as runStreamableMcpServer } from "./mcp-server-streamable-
|
|
2
|
+
import { r as runStreamableMcpServer } from "./mcp-server-streamable-pcpU_lDl.js";
|
|
3
3
|
runStreamableMcpServer().catch((error) => {
|
|
4
4
|
console.error("Failed to start streamable MCP server:", error);
|
|
5
5
|
process.exit(1);
|
package/dist/mcp.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=new(require("happy-dom").Window);Object.assign(global,{document:e.document,window:e,self:e});require("./mcp-server-
|
|
2
|
+
const e=new(require("happy-dom").Window);Object.assign(global,{document:e.document,window:e,self:e});require("./mcp-server-Dn3EHzcf.cjs").runMcpServer().catch(e=>{process.exit(1)});
|
package/dist/mcp.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.assign(global, {
|
|
|
6
6
|
window,
|
|
7
7
|
self: window
|
|
8
8
|
});
|
|
9
|
-
import { r as runMcpServer } from "./mcp-server-
|
|
9
|
+
import { r as runMcpServer } from "./mcp-server-DOe8W9IZ.js";
|
|
10
10
|
runMcpServer().catch((error) => {
|
|
11
11
|
console.error("Failed to start MCP server:", error);
|
|
12
12
|
process.exit(1);
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { htmlToMarkdown } from './core.ts';
|
|
6
6
|
export { getMessage } from './i18n.ts';
|
|
7
|
-
export type { HtmlToMarkdownOptions } from './types.ts';
|
|
8
7
|
export { createMcpServer, runMcpServer } from './mcp-server.ts';
|
|
9
8
|
export { createStreamableMcpServer, runStreamableMcpServer } from './mcp-server-streamable.ts';
|
|
9
|
+
export type { HtmlToMarkdownOptions } from './types.ts';
|
package/dist/src/mcp-server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
2
|
import { HtmlToMarkdownArgs, SaveContentArgs, UrlToMarkdownFileArgs } from './mcp-common.ts';
|
|
3
|
-
export {
|
|
3
|
+
export { createErrorResult, createSuccessResult, type HtmlToMarkdownArgs, MCP_TOOL_SCHEMAS, parseHtmlToMarkdownArgs, parseSaveContentArgs, parseUrlToMarkdownFileArgs, type SaveContentArgs, saveContentToFile, type UrlToMarkdownFileArgs, } from './mcp-common.ts';
|
|
4
4
|
/**
|
|
5
5
|
* MCP Server for HTML to Markdown conversion.
|
|
6
6
|
* HTML から Markdown への変換を行う MCP サーバー
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Rehype プラグインのインデックス
|
|
4
4
|
*/
|
|
5
5
|
export { rehypeAbsoluteLinks } from './rehype-absolute-links.ts';
|
|
6
|
+
export { rehypeDecodeEntities, preprocessHtmlEntities } from './rehype-decode-entities.ts';
|
|
6
7
|
export { rehypeNamedAnchors } from './rehype-named-anchors.ts';
|
|
7
8
|
export { rehypeParagraphWrapper } from './rehype-paragraph-wrapper.ts';
|
|
8
9
|
export { rehypeSanitizeHtml } from './rehype-sanitize-html.ts';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Root } from 'hast';
|
|
2
|
+
/**
|
|
3
|
+
* Decode HTML entities in text nodes and element properties.
|
|
4
|
+
* テキストノードと要素プロパティ内の HTML エンティティをデコードします。
|
|
5
|
+
*/
|
|
6
|
+
export declare const rehypeDecodeEntities: () => (tree: Root) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Pre-process HTML string to decode entities before parsing.
|
|
9
|
+
* パース前にHTML文字列内のエンティティを事前デコードします。
|
|
10
|
+
*
|
|
11
|
+
* @param html - HTML string that may contain entities / エンティティを含む可能性のあるHTML文字列
|
|
12
|
+
* @returns Decoded HTML string / デコードされたHTML文字列
|
|
13
|
+
*/
|
|
14
|
+
export declare const preprocessHtmlEntities: (html: string) => string;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -20,16 +20,16 @@ export interface HtmlToMarkdownOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
htmlContent?: string;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Message keys for i18n.
|
|
25
|
-
* i18n 用のメッセージキー
|
|
26
|
-
*/
|
|
27
|
-
export type MessageKey = "error_url_required" | "usage" | "example" | "cli_start" | "cli_url" | "cli_locale" | "cli_output" | "success_save" | "success_path" | "error_app" | "playwright_launch" | "playwright_goto" | "playwright_get_content" | "playwright_close" | "playwright_error" | "convert_start" | "convert_success" | "url_parse_error";
|
|
28
23
|
/**
|
|
29
24
|
* Supported locales.
|
|
30
25
|
* サポートされているロケール
|
|
31
26
|
*/
|
|
32
|
-
export type SupportedLocale = "
|
|
27
|
+
export type SupportedLocale = "en-US" | "ja-JP";
|
|
28
|
+
/**
|
|
29
|
+
* Message keys for i18n.
|
|
30
|
+
* i18n 用のメッセージキー
|
|
31
|
+
*/
|
|
32
|
+
export type MessageKey = "error_url_required" | "error_url_or_html_required" | "usage" | "example" | "cli_start" | "cli_url" | "cli_html_content" | "cli_locale" | "cli_output" | "success_save" | "success_path" | "error_app" | "playwright_launch" | "playwright_goto" | "playwright_get_content" | "playwright_close" | "playwright_error" | "convert_start" | "convert_success" | "url_parse_error";
|
|
33
33
|
/**
|
|
34
34
|
* The following types are based on the type definitions of `hast-util-to-mdast`.
|
|
35
35
|
* `hast-util-to-mdast` の型定義に基づいた型。
|
|
@@ -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-DhxxOcPm.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") {
|
|
@@ -11350,7 +11350,7 @@ function parseUrlToMarkdownFileArgs(args) {
|
|
|
11350
11350
|
throw new Error("Arguments are required");
|
|
11351
11351
|
}
|
|
11352
11352
|
const { url, html_content, locale = "en-US", save_path, save_directory, filename } = args;
|
|
11353
|
-
if (!url
|
|
11353
|
+
if (!(url || html_content)) {
|
|
11354
11354
|
throw new Error("Either 'url' or 'html_content' is required");
|
|
11355
11355
|
}
|
|
11356
11356
|
if (url && typeof url !== "string") {
|
|
@@ -11362,7 +11362,7 @@ function parseUrlToMarkdownFileArgs(args) {
|
|
|
11362
11362
|
if (locale && !["en-US", "ja-JP"].includes(locale)) {
|
|
11363
11363
|
throw new Error("'locale' must be 'en-US' or 'ja-JP'");
|
|
11364
11364
|
}
|
|
11365
|
-
if (!save_path
|
|
11365
|
+
if (!(save_path || save_directory)) {
|
|
11366
11366
|
throw new Error("Either 'save_path' or 'save_directory' is required");
|
|
11367
11367
|
}
|
|
11368
11368
|
if (save_path && typeof save_path !== "string") {
|