@xberg-io/opencode-html-to-markdown 0.2.3 → 3.10.2

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.
@@ -1,29 +1,31 @@
1
1
  // AI-RULEZ :: GENERATED FILE — DO NOT EDIT
2
- // Content-Hash: blake3:61b767fe4fa393813e733e6c20f5889905baac84a4a56c09b503b19cb6025eab
3
- // Source-Hash: blake3:94b6596172fbbfb9af67d0c25d7ae807c6faec78760a9728a8b59aaf917234df
2
+ // Content-Hash: blake3:a6fa2bc34f3c3e8e95bd74acc79163d573b3c7d544c54ad82b5ca81e21f0f39c
3
+ // Source-Hash: blake3:b209c2af8fd67421af9088a1919804214a732db57b62fdce0a3e18e3bcee6543
4
4
  // Schema-Version: v1
5
5
 
6
- import { spawn } from "node:child_process";
7
- import { tool } from "@opencode-ai/plugin";
6
+ import {tool} from "@opencode-ai/plugin";
7
+ import {spawn} from "node:child_process";
8
8
 
9
9
  const schema = tool.schema;
10
10
 
11
- const headingStyle = schema
12
- .enum(["atx", "underlined", "atx-closed"])
13
- .optional()
14
- .describe("Markdown heading style. Default: atx.");
11
+ const headingStyle = schema.enum([ "atx", "underlined", "atx-closed" ])
12
+ .optional()
13
+ .describe("Markdown heading style. Default: atx.");
15
14
 
16
- const codeBlockStyle = schema
17
- .enum(["backticks", "indented", "tildes"])
18
- .optional()
19
- .describe("Code block fence style. Default: backticks.");
15
+ const codeBlockStyle =
16
+ schema.enum([ "backticks", "indented", "tildes" ])
17
+ .optional()
18
+ .describe("Code block fence style. Default: backticks.");
20
19
 
21
- const outputFormat = schema.enum(["markdown", "djot"]).optional().describe("Output markup format. Default: markdown.");
20
+ const outputFormat = schema.enum([ "markdown", "djot" ])
21
+ .optional()
22
+ .describe("Output markup format. Default: markdown.");
22
23
 
23
- const preset = schema
24
- .enum(["minimal", "standard", "aggressive"])
25
- .optional()
26
- .describe("Preprocessing aggressiveness. Requires `preprocess`. Default: standard.");
24
+ const preset =
25
+ schema.enum([ "minimal", "standard", "aggressive" ])
26
+ .optional()
27
+ .describe(
28
+ "Preprocessing aggressiveness. Requires `preprocess`. Default: standard.");
27
29
 
28
30
  function hasValue(value) {
29
31
  return value !== undefined && value !== null && value !== "";
@@ -46,10 +48,10 @@ function runCli(args, context, stdin) {
46
48
 
47
49
  return new Promise((resolve, reject) => {
48
50
  const child = spawn("html-to-markdown", args, {
49
- cwd: directory,
50
- env: process.env,
51
- signal: context?.abort,
52
- stdio: [stdin === undefined ? "ignore" : "pipe", "pipe", "pipe"],
51
+ cwd : directory,
52
+ env : process.env,
53
+ signal : context?.abort,
54
+ stdio : [ stdin === undefined ? "ignore" : "pipe", "pipe", "pipe" ],
53
55
  });
54
56
 
55
57
  const stdout = [];
@@ -60,10 +62,10 @@ function runCli(args, context, stdin) {
60
62
  child.on("error", (error) => {
61
63
  if (error.code === "ENOENT") {
62
64
  resolve({
63
- title: "html-to-markdown CLI not found",
64
- output:
65
- "Install the html-to-markdown CLI with `brew install xberg-io/tap/html-to-markdown`, or run it via `npx html-to-markdown` / `uvx --from html-to-markdown html-to-markdown`.",
66
- metadata: { exitCode: 127, command: "html-to-markdown" },
65
+ title : "html-to-markdown CLI not found",
66
+ output :
67
+ "Install the html-to-markdown CLI with `brew install xberg-io/tap/html-to-markdown`, or run it via `npx -y @xberg-io/html-to-markdown-cli` / `uvx --from html-to-markdown-cli html-to-markdown`.",
68
+ metadata : {exitCode : 127, command : "html-to-markdown"},
67
69
  });
68
70
  return;
69
71
  }
@@ -72,12 +74,14 @@ function runCli(args, context, stdin) {
72
74
  child.on("close", (exitCode, signal) => {
73
75
  const stdoutText = Buffer.concat(stdout).toString("utf8").trim();
74
76
  const stderrText = Buffer.concat(stderr).toString("utf8").trim();
75
- const output = [stdoutText, stderrText && `stderr:\n${stderrText}`].filter(Boolean).join("\n\n");
77
+ const output = [
78
+ stdoutText, stderrText && `stderr:\n${stderrText}`
79
+ ].filter(Boolean).join("\n\n");
76
80
 
77
81
  resolve({
78
- title: exitCode === 0 ? "html-to-markdown" : "html-to-markdown failed",
79
- output: output || "(no output)",
80
- metadata: { exitCode, signal, command: "html-to-markdown" },
82
+ title : exitCode === 0 ? "html-to-markdown" : "html-to-markdown failed",
83
+ output : output || "(no output)",
84
+ metadata : {exitCode, signal, command : "html-to-markdown"},
81
85
  });
82
86
  });
83
87
 
@@ -97,17 +101,20 @@ function styleArgs(args, params) {
97
101
  }
98
102
 
99
103
  export const HtmlToMarkdownPlugin = async () => ({
100
- tool: {
101
- html_to_markdown_convert: tool({
102
- description:
103
- "Convert an HTML file or HTML string to Markdown (or Djot) with the html-to-markdown CLI. Provide either `path` or `html`.",
104
- args: {
105
- path: schema.string().min(1).optional().describe("Path to a local HTML file."),
106
- html: schema.string().min(1).optional().describe("Inline HTML to convert (used when `path` is omitted)."),
107
- heading_style: headingStyle,
108
- code_block_style: codeBlockStyle,
109
- output_format: outputFormat,
110
- preprocess: schema.boolean().optional().describe("Strip navigation, ads, and forms before converting."),
104
+ tool : {
105
+ html_to_markdown_convert : tool({
106
+ description :
107
+ "Convert an HTML file or HTML string to Markdown (or Djot) with the html-to-markdown CLI. Provide either `path` or `html`.",
108
+ args : {
109
+ path : schema.string().min(1).optional().describe(
110
+ "Path to a local HTML file."),
111
+ html : schema.string().min(1).optional().describe(
112
+ "Inline HTML to convert (used when `path` is omitted)."),
113
+ heading_style : headingStyle,
114
+ code_block_style : codeBlockStyle,
115
+ output_format : outputFormat,
116
+ preprocess : schema.boolean().optional().describe(
117
+ "Strip navigation, ads, and forms before converting."),
111
118
  preset,
112
119
  },
113
120
  async execute(args, context) {
@@ -124,46 +131,44 @@ export const HtmlToMarkdownPlugin = async () => ({
124
131
  throw new Error("Provide either `path` or `html`.");
125
132
  },
126
133
  }),
127
- html_to_markdown_fetch_url: tool({
128
- description: "Fetch a URL and convert its HTML to Markdown (or Djot) with the html-to-markdown CLI.",
129
- args: {
130
- url: schema.string().min(1).describe("URL to fetch and convert."),
131
- heading_style: headingStyle,
132
- code_block_style: codeBlockStyle,
133
- output_format: outputFormat,
134
- preprocess: schema.boolean().optional().describe("Strip navigation, ads, and forms before converting."),
134
+ html_to_markdown_fetch_url : tool({
135
+ description :
136
+ "Fetch a URL and convert its HTML to Markdown (or Djot) with the html-to-markdown CLI.",
137
+ args : {
138
+ url : schema.string().min(1).describe("URL to fetch and convert."),
139
+ heading_style : headingStyle,
140
+ code_block_style : codeBlockStyle,
141
+ output_format : outputFormat,
142
+ preprocess : schema.boolean().optional().describe(
143
+ "Strip navigation, ads, and forms before converting."),
135
144
  preset,
136
- user_agent: schema.string().min(1).optional().describe("Custom User-Agent header for the fetch."),
145
+ user_agent : schema.string().min(1).optional().describe(
146
+ "Custom User-Agent header for the fetch."),
137
147
  },
138
148
  async execute(args, context) {
139
- const cliArgs = ["--url", args.url];
149
+ const cliArgs = [ "--url", args.url ];
140
150
  pushOption(cliArgs, "--user-agent", args.user_agent);
141
151
  styleArgs(cliArgs, args);
142
152
  return runCli(cliArgs, context);
143
153
  },
144
154
  }),
145
- html_to_markdown_extract: tool({
146
- description:
147
- "Extract structured metadata, tables, and (optionally) document structure from HTML as JSON. Returns the full ConversionResult. Provide `path`, `html`, or `url`.",
148
- args: {
149
- path: schema.string().min(1).optional().describe("Path to a local HTML file."),
150
- html: schema
151
- .string()
152
- .min(1)
153
- .optional()
154
- .describe("Inline HTML to analyze (used when `path` and `url` are omitted)."),
155
- url: schema.string().min(1).optional().describe("URL to fetch and analyze."),
156
- include_structure: schema
157
- .boolean()
158
- .optional()
159
- .describe("Include the document structure tree in the JSON output."),
160
- no_content: schema
161
- .boolean()
162
- .optional()
163
- .describe("Suppress the Markdown content field — return metadata/tables/images only."),
155
+ html_to_markdown_extract : tool({
156
+ description :
157
+ "Extract structured metadata, tables, and (optionally) document structure from HTML as JSON. Returns the full ConversionResult. Provide `path`, `html`, or `url`.",
158
+ args : {
159
+ path : schema.string().min(1).optional().describe(
160
+ "Path to a local HTML file."),
161
+ html : schema.string().min(1).optional().describe(
162
+ "Inline HTML to analyze (used when `path` and `url` are omitted)."),
163
+ url : schema.string().min(1).optional().describe(
164
+ "URL to fetch and analyze."),
165
+ include_structure : schema.boolean().optional().describe(
166
+ "Include the document structure tree in the JSON output."),
167
+ no_content : schema.boolean().optional().describe(
168
+ "Suppress the Markdown content field — return metadata/tables/images only."),
164
169
  },
165
170
  async execute(args, context) {
166
- const cliArgs = ["--json"];
171
+ const cliArgs = [ "--json" ];
167
172
  pushFlag(cliArgs, "--include-structure", args.include_structure);
168
173
  pushFlag(cliArgs, "--no-content", args.no_content);
169
174
 
package/README.md CHANGED
@@ -13,8 +13,8 @@ Pending review for official Claude marketplace.
13
13
  Self-host:
14
14
 
15
15
  ```text
16
- /plugin marketplace add xberg-io/plugins
17
- /plugin install html-to-markdown@xberg
16
+ /plugin marketplace add xberg-io/html-to-markdown
17
+ /plugin install html-to-markdown@html-to-markdown
18
18
  ```
19
19
 
20
20
  ### Binary requirement
@@ -162,7 +162,7 @@ html-to-markdown input.html --output-format djot --heading-style underlined
162
162
 
163
163
  ## Versioning
164
164
 
165
- The plugin version tracks the marketplace `VERSION` file. See [CHANGELOG.md](../../CHANGELOG.md) for release notes.
165
+ The plugin version tracks the html-to-markdown core release (`Cargo.toml`). See [CHANGELOG.md](../CHANGELOG.md) for release notes.
166
166
 
167
167
  ## License
168
168
 
@@ -170,6 +170,5 @@ MIT. The skill content references the upstream [html-to-markdown](https://github
170
170
 
171
171
  ## See also
172
172
 
173
- - **Marketplace**: [xberg-io/plugins](https://github.com/xberg-io/plugins)
173
+ - **Marketplace**: this repo — `/plugin marketplace add xberg-io/html-to-markdown`
174
174
  - **Upstream**: [xberg-io/html-to-markdown](https://github.com/xberg-io/html-to-markdown)
175
- - **Sibling plugins**: [xberg](../xberg/README.md), [crawlberg](../crawlberg/README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xberg-io/opencode-html-to-markdown",
3
- "version": "0.2.3",
3
+ "version": "3.10.2",
4
4
  "description": "Fast, lossless HTML→Markdown conversion with structured metadata, tables, and document-structure extraction.",
5
5
  "keywords": [
6
6
  "html-to-markdown",
@@ -12,7 +12,7 @@
12
12
  "homepage": "https://xberg.io",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/xberg-io/plugins"
15
+ "url": "https://github.com/xberg-io/html-to-markdown"
16
16
  },
17
17
  "license": "MIT",
18
18
  "type": "module",