@aiquants/html-to-markdown 0.2.5 → 0.2.6
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/dist/{core-CFnkfU5N.js → core-CouDTni-.js} +6 -6
- package/dist/index.js +3 -3
- package/dist/main.js +1 -1
- package/dist/{mcp-server-CueTvF4M.js → mcp-server-B8hz3lXI.js} +3 -3
- package/dist/{mcp-server-streamable-BC-Qlr-9.js → mcp-server-streamable-3B3B1fuS.js} +9 -9
- package/dist/mcp-streamable.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{version-BXLLJx3Z.js → version-PCzxchJe.js} +1 -1
- package/package.json +1 -1
|
@@ -61,12 +61,12 @@ const getMessage = (locale, key2, replacements) => {
|
|
|
61
61
|
const getHtmlWithPlaywright = async (url, locale) => {
|
|
62
62
|
let browser;
|
|
63
63
|
try {
|
|
64
|
-
console.
|
|
64
|
+
console.info(getMessage(locale, "playwright_launch"));
|
|
65
65
|
browser = await chromium.launch();
|
|
66
66
|
const page = await browser.newPage({ locale });
|
|
67
|
-
console.
|
|
67
|
+
console.info(getMessage(locale, "playwright_goto", { url, locale }));
|
|
68
68
|
await page.goto(url, { waitUntil: "networkidle" });
|
|
69
|
-
console.
|
|
69
|
+
console.info(getMessage(locale, "playwright_get_content"));
|
|
70
70
|
const html2 = await page.content();
|
|
71
71
|
return html2;
|
|
72
72
|
} catch (error) {
|
|
@@ -75,7 +75,7 @@ const getHtmlWithPlaywright = async (url, locale) => {
|
|
|
75
75
|
} finally {
|
|
76
76
|
if (browser) {
|
|
77
77
|
await browser.close();
|
|
78
|
-
console.
|
|
78
|
+
console.info(getMessage(locale, "playwright_close"));
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
};
|
|
@@ -20681,7 +20681,7 @@ const handleTableCell = (_state, node2, _parent) => {
|
|
|
20681
20681
|
return { type: "tableCell", children: [{ type: "html", value }] };
|
|
20682
20682
|
};
|
|
20683
20683
|
const convertHtmlToMarkdown = async (html2, baseUrl, locale) => {
|
|
20684
|
-
console.
|
|
20684
|
+
console.info(getMessage(locale, "convert_start"));
|
|
20685
20685
|
const slugger2 = new BananaSlug();
|
|
20686
20686
|
const file = await unified().use(rehypeParse, { fragment: true }).use(rehypeRaw).use(rehypeSanitizeHtml).use(rehypeWikipediaFootnotes).use(rehypeNamedAnchors).use(rehypeSlug).use(rehypeParagraphWrapper).use(rehypeAbsoluteLinks, { baseUrl }).use(rehypeRemark, {
|
|
20687
20687
|
handlers: {
|
|
@@ -20783,7 +20783,7 @@ const convertHtmlToMarkdown = async (html2, baseUrl, locale) => {
|
|
|
20783
20783
|
}).process(html2);
|
|
20784
20784
|
const unescapedMarkdown = String(file).replace(/\\\[\^(.+?)\\?\](?!\s*:)/g, "[^$1]").replace(/\]\(\\#/g, "](#");
|
|
20785
20785
|
const correctedMarkdown = unescapedMarkdown.replace(/(\s*)- - /g, "$1- ").replace(/(\s*)\* \* /g, "$1* ");
|
|
20786
|
-
console.
|
|
20786
|
+
console.info(getMessage(locale, "convert_success"));
|
|
20787
20787
|
return correctedMarkdown;
|
|
20788
20788
|
};
|
|
20789
20789
|
const htmlToMarkdown = async (urlOrHtml, options = {}) => {
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.assign(global, {
|
|
|
5
5
|
window,
|
|
6
6
|
self: window
|
|
7
7
|
});
|
|
8
|
-
import { g, h } from "./core-
|
|
9
|
-
import { c, r } from "./mcp-server-
|
|
10
|
-
import { c as c2, r as r2 } from "./mcp-server-streamable-
|
|
8
|
+
import { g, h } from "./core-CouDTni-.js";
|
|
9
|
+
import { c, r } from "./mcp-server-B8hz3lXI.js";
|
|
10
|
+
import { c as c2, r as r2 } from "./mcp-server-streamable-3B3B1fuS.js";
|
|
11
11
|
export {
|
|
12
12
|
c as createMcpServer,
|
|
13
13
|
c2 as createStreamableMcpServer,
|
package/dist/main.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.assign(global, {
|
|
|
6
6
|
window,
|
|
7
7
|
self: window
|
|
8
8
|
});
|
|
9
|
-
import { g as getMessage, h as htmlToMarkdown } from "./core-
|
|
9
|
+
import { g as getMessage, h as htmlToMarkdown } from "./core-CouDTni-.js";
|
|
10
10
|
const runCli = async () => {
|
|
11
11
|
const yargsParser = (await import("yargs-parser")).default;
|
|
12
12
|
const fs = await import("node:fs");
|
|
@@ -5,11 +5,11 @@ Object.assign(global, {
|
|
|
5
5
|
window,
|
|
6
6
|
self: window
|
|
7
7
|
});
|
|
8
|
-
import { J as JSONRPCMessageSchema, g as getPackageVersion, S as Server, L as ListToolsRequestSchema, C as CallToolRequestSchema } from "./version-
|
|
8
|
+
import { J as JSONRPCMessageSchema, g as getPackageVersion, S as Server, L as ListToolsRequestSchema, C as CallToolRequestSchema } from "./version-PCzxchJe.js";
|
|
9
9
|
import process from "node:process";
|
|
10
10
|
import { promises } from "fs";
|
|
11
11
|
import { join, resolve, dirname } from "path";
|
|
12
|
-
import { h as htmlToMarkdown } from "./core-
|
|
12
|
+
import { h as htmlToMarkdown } from "./core-CouDTni-.js";
|
|
13
13
|
class ReadBuffer {
|
|
14
14
|
append(chunk) {
|
|
15
15
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
@@ -348,7 +348,7 @@ ${savedPaths.map((path) => `- ${path}`).join("\n")}`;
|
|
|
348
348
|
async start() {
|
|
349
349
|
const transport = new StdioServerTransport();
|
|
350
350
|
await this.server.connect(transport);
|
|
351
|
-
console.
|
|
351
|
+
console.info("HTML to Markdown MCP server started");
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
const createMcpServer = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as JSONRPCMessageSchema, i as isInitializeRequest, a as isJSONRPCRequest, D as DEFAULT_NEGOTIATED_PROTOCOL_VERSION, b as SUPPORTED_PROTOCOL_VERSIONS, c as isJSONRPCResponse, d as isJSONRPCError, g as getPackageVersion, S as Server, I as InitializeRequestSchema, L as ListToolsRequestSchema, C as CallToolRequestSchema } 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, a as isJSONRPCRequest, D as DEFAULT_NEGOTIATED_PROTOCOL_VERSION, b as SUPPORTED_PROTOCOL_VERSIONS, c as isJSONRPCResponse, d as isJSONRPCError, g as getPackageVersion, S as Server, I as InitializeRequestSchema, L as ListToolsRequestSchema, C as CallToolRequestSchema } from "./version-PCzxchJe.js";
|
|
2
|
+
import { a as getAugmentedNamespace, c as commonjsGlobal, b as getDefaultExportFromCjs, h as htmlToMarkdown } from "./core-CouDTni-.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import cors from "cors";
|
|
5
5
|
import express from "express";
|
|
@@ -7466,7 +7466,7 @@ ${savedPaths.map((path) => `- ${path}`).join("\n")}`;
|
|
|
7466
7466
|
app.use(express.json());
|
|
7467
7467
|
await this.server.connect(this.transport);
|
|
7468
7468
|
app.post("/mcp", async (req, res) => {
|
|
7469
|
-
console.
|
|
7469
|
+
console.info("Received MCP request:", req.body);
|
|
7470
7470
|
try {
|
|
7471
7471
|
res.setHeader("Content-Type", "application/json");
|
|
7472
7472
|
const request = req.body;
|
|
@@ -7573,7 +7573,7 @@ ${savedPaths.map((path) => `- ${path}`).join("\n")}`;
|
|
|
7573
7573
|
}
|
|
7574
7574
|
});
|
|
7575
7575
|
app.get("/mcp", async (_req, res) => {
|
|
7576
|
-
console.
|
|
7576
|
+
console.info("Received GET MCP request");
|
|
7577
7577
|
res.writeHead(405).end(
|
|
7578
7578
|
JSON.stringify({
|
|
7579
7579
|
jsonrpc: "2.0",
|
|
@@ -7586,7 +7586,7 @@ ${savedPaths.map((path) => `- ${path}`).join("\n")}`;
|
|
|
7586
7586
|
);
|
|
7587
7587
|
});
|
|
7588
7588
|
app.delete("/mcp", async (_req, res) => {
|
|
7589
|
-
console.
|
|
7589
|
+
console.info("Received DELETE MCP request");
|
|
7590
7590
|
res.writeHead(405).end(
|
|
7591
7591
|
JSON.stringify({
|
|
7592
7592
|
jsonrpc: "2.0",
|
|
@@ -7599,19 +7599,19 @@ ${savedPaths.map((path) => `- ${path}`).join("\n")}`;
|
|
|
7599
7599
|
);
|
|
7600
7600
|
});
|
|
7601
7601
|
const server = app.listen(port, host, () => {
|
|
7602
|
-
console.
|
|
7602
|
+
console.info(`HTML to Markdown Streamable MCP server started on http://${host}:${port}/mcp`);
|
|
7603
7603
|
});
|
|
7604
7604
|
process.on("SIGINT", async () => {
|
|
7605
|
-
console.
|
|
7605
|
+
console.info("Shutting down server...");
|
|
7606
7606
|
try {
|
|
7607
|
-
console.
|
|
7607
|
+
console.info("Closing transport");
|
|
7608
7608
|
await this.transport.close();
|
|
7609
7609
|
} catch (error) {
|
|
7610
7610
|
console.error("Error closing transport:", error);
|
|
7611
7611
|
}
|
|
7612
7612
|
await this.server.close();
|
|
7613
7613
|
server.close(() => {
|
|
7614
|
-
console.
|
|
7614
|
+
console.info("Server shutdown complete");
|
|
7615
7615
|
process.exit(0);
|
|
7616
7616
|
});
|
|
7617
7617
|
});
|
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-3B3B1fuS.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.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-B8hz3lXI.js";
|
|
10
10
|
runMcpServer().catch((error) => {
|
|
11
11
|
console.error("Failed to start MCP server:", error);
|
|
12
12
|
process.exit(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-CouDTni-.js";
|
|
9
9
|
import { readFileSync } from "node:fs";
|
|
10
10
|
import { dirname, resolve } from "node:path";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|