@xberg-io/opencode-html-to-markdown 0.1.0 → 0.2.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.
@@ -1,3 +1,8 @@
1
+ // AI-RULEZ :: GENERATED FILE — DO NOT EDIT
2
+ // Content-Hash: blake3:61b767fe4fa393813e733e6c20f5889905baac84a4a56c09b503b19cb6025eab
3
+ // Source-Hash: blake3:94b6596172fbbfb9af67d0c25d7ae807c6faec78760a9728a8b59aaf917234df
4
+ // Schema-Version: v1
5
+
1
6
  import { spawn } from "node:child_process";
2
7
  import { tool } from "@opencode-ai/plugin";
3
8
 
@@ -13,10 +18,7 @@ const codeBlockStyle = schema
13
18
  .optional()
14
19
  .describe("Code block fence style. Default: backticks.");
15
20
 
16
- const outputFormat = schema
17
- .enum(["markdown", "djot"])
18
- .optional()
19
- .describe("Output markup format. Default: markdown.");
21
+ const outputFormat = schema.enum(["markdown", "djot"]).optional().describe("Output markup format. Default: markdown.");
20
22
 
21
23
  const preset = schema
22
24
  .enum(["minimal", "standard", "aggressive"])
@@ -70,9 +72,7 @@ function runCli(args, context, stdin) {
70
72
  child.on("close", (exitCode, signal) => {
71
73
  const stdoutText = Buffer.concat(stdout).toString("utf8").trim();
72
74
  const stderrText = Buffer.concat(stderr).toString("utf8").trim();
73
- const output = [stdoutText, stderrText && `stderr:\n${stderrText}`]
74
- .filter(Boolean)
75
- .join("\n\n");
75
+ const output = [stdoutText, stderrText && `stderr:\n${stderrText}`].filter(Boolean).join("\n\n");
76
76
 
77
77
  resolve({
78
78
  title: exitCode === 0 ? "html-to-markdown" : "html-to-markdown failed",
@@ -103,18 +103,11 @@ export const HtmlToMarkdownPlugin = async () => ({
103
103
  "Convert an HTML file or HTML string to Markdown (or Djot) with the html-to-markdown CLI. Provide either `path` or `html`.",
104
104
  args: {
105
105
  path: schema.string().min(1).optional().describe("Path to a local HTML file."),
106
- html: schema
107
- .string()
108
- .min(1)
109
- .optional()
110
- .describe("Inline HTML to convert (used when `path` is omitted)."),
106
+ html: schema.string().min(1).optional().describe("Inline HTML to convert (used when `path` is omitted)."),
111
107
  heading_style: headingStyle,
112
108
  code_block_style: codeBlockStyle,
113
109
  output_format: outputFormat,
114
- preprocess: schema
115
- .boolean()
116
- .optional()
117
- .describe("Strip navigation, ads, and forms before converting."),
110
+ preprocess: schema.boolean().optional().describe("Strip navigation, ads, and forms before converting."),
118
111
  preset,
119
112
  },
120
113
  async execute(args, context) {
@@ -132,23 +125,15 @@ export const HtmlToMarkdownPlugin = async () => ({
132
125
  },
133
126
  }),
134
127
  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.",
128
+ description: "Fetch a URL and convert its HTML to Markdown (or Djot) with the html-to-markdown CLI.",
137
129
  args: {
138
130
  url: schema.string().min(1).describe("URL to fetch and convert."),
139
131
  heading_style: headingStyle,
140
132
  code_block_style: codeBlockStyle,
141
133
  output_format: outputFormat,
142
- preprocess: schema
143
- .boolean()
144
- .optional()
145
- .describe("Strip navigation, ads, and forms before converting."),
134
+ preprocess: schema.boolean().optional().describe("Strip navigation, ads, and forms before converting."),
146
135
  preset,
147
- user_agent: schema
148
- .string()
149
- .min(1)
150
- .optional()
151
- .describe("Custom User-Agent header for the fetch."),
136
+ user_agent: schema.string().min(1).optional().describe("Custom User-Agent header for the fetch."),
152
137
  },
153
138
  async execute(args, context) {
154
139
  const cliArgs = ["--url", args.url];
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Fast, lossless HTML→Markdown conversion with structured metadata, tables, and document-structure extraction — using the local `html-to-markdown` CLI in your agent.
4
4
 
5
- <!-- TODO: screenshot -->
5
+ <!-- ~keep TODO: add screenshot -->
6
6
 
7
7
  ## Install
8
8
 
package/assets/icon.svg CHANGED
@@ -1,7 +1,24 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
2
- <rect width="256" height="256" rx="48" fill="#2E2D36"/>
3
- <path d="M64 56 L152 56 L196 100 L196 196 C196 200.4 192.4 204 188 204 L64 204 C59.6 204 56 200.4 56 196 L56 64 C56 59.6 59.6 56 64 56 Z" fill="#58FBDA"/>
4
- <path d="M152 56 L152 92 C152 96.4 155.6 100 160 100 L196 100 Z" fill="#2E2D36"/>
5
- <path d="M84 168 L84 124 L100 144 L116 124 L116 168" fill="none" stroke="#2E2D36" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
6
- <path d="M150 124 L150 168 M150 168 L134 150 M150 168 L166 150" fill="none" stroke="#2E2D36" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
2
+ <rect width="256" height="256" rx="48" fill="#2E2D36" />
3
+ <path
4
+ d="M64 56 L152 56 L196 100 L196 196 C196 200.4 192.4 204 188 204 L64 204 C59.6 204 56 200.4 56 196 L56 64 C56 59.6 59.6 56 64 56 Z"
5
+ fill="#58FBDA"
6
+ />
7
+ <path d="M152 56 L152 92 C152 96.4 155.6 100 160 100 L196 100 Z" fill="#2E2D36" />
8
+ <path
9
+ d="M84 168 L84 124 L100 144 L116 124 L116 168"
10
+ fill="none"
11
+ stroke="#2E2D36"
12
+ stroke-width="12"
13
+ stroke-linecap="round"
14
+ stroke-linejoin="round"
15
+ />
16
+ <path
17
+ d="M150 124 L150 168 M150 168 L134 150 M150 168 L166 150"
18
+ fill="none"
19
+ stroke="#2E2D36"
20
+ stroke-width="12"
21
+ stroke-linecap="round"
22
+ stroke-linejoin="round"
23
+ />
7
24
  </svg>
package/assets/logo.svg CHANGED
@@ -1,26 +1,56 @@
1
1
  <svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <circle cx="400" cy="400" r="313.839" fill="#58FBDA" stroke="#2E2D36" stroke-width="7.67819"/>
3
- <path d="M469.155 481.996L497.619 509.815L517.95 513.534L529.157 523.7" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
4
- <path d="M428.146 495.931V565.751L454.576 592.876V615.587" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
5
- <path d="M333.878 482.343L310.522 509.468L289.15 512.543L271.199 525.733" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
6
- <path d="M404.521 155.839C498.389 155.839 574.411 231.075 574.411 323.792C574.411 416.509 498.389 491.744 404.521 491.744C310.653 491.744 234.631 416.509 234.631 323.792C234.631 231.075 310.653 155.839 404.521 155.839Z" fill="#79FFE6" stroke="#2E2D36" stroke-width="7.67819"/>
7
- <path d="M401.021 218.481C450.893 218.481 491.275 258.538 491.275 307.892C491.275 357.246 450.893 397.303 401.021 397.303C351.149 397.303 310.767 357.246 310.767 307.892C310.767 258.538 351.149 218.481 401.021 218.481Z" fill="white" stroke="#2E2D36" stroke-width="6.14255"/>
8
- <circle cx="231.379" cy="476.492" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
9
- <circle cx="256.471" cy="535.8" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
10
- <circle cx="300.109" cy="582.413" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
11
- <circle cx="401.071" cy="643.307" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
12
- <circle cx="457.998" cy="631.009" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
13
- <path d="M457.304 487.798V535.601L489.139 569.123" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
14
- <circle cx="499.354" cy="582.413" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
15
- <circle cx="542.695" cy="535.006" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
16
- <circle cx="562.332" cy="476.393" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
17
- <path d="M303.381 465.483L289.993 476.988H248.834" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
18
- <path d="M351.532 489.484V531.188L312.555 569.817" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
19
- <path d="M371.863 494.889V569.123L345.78 596.942V615.24" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
20
- <path d="M401.368 498.311V625.753" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
21
- <path d="M496.925 465.731L505.057 473.566H545.422" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round"/>
22
- <ellipse cx="401.021" cy="307.892" rx="51.671" ry="53.0099" fill="#2E2D36"/>
23
- <ellipse cx="411.286" cy="294.106" rx="18.5956" ry="19.0915" fill="white"/>
24
- <ellipse cx="428.493" cy="322.471" rx="8.43002" ry="8.67796" fill="white"/>
25
- <circle cx="344.143" cy="632.299" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691"/>
2
+ <circle cx="400" cy="400" r="313.839" fill="#58FBDA" stroke="#2E2D36" stroke-width="7.67819" />
3
+ <path
4
+ d="M469.155 481.996L497.619 509.815L517.95 513.534L529.157 523.7"
5
+ stroke="#2E2D36"
6
+ stroke-width="7.67819"
7
+ stroke-linecap="round"
8
+ />
9
+ <path
10
+ d="M428.146 495.931V565.751L454.576 592.876V615.587"
11
+ stroke="#2E2D36"
12
+ stroke-width="7.67819"
13
+ stroke-linecap="round"
14
+ />
15
+ <path
16
+ d="M333.878 482.343L310.522 509.468L289.15 512.543L271.199 525.733"
17
+ stroke="#2E2D36"
18
+ stroke-width="7.67819"
19
+ stroke-linecap="round"
20
+ />
21
+ <path
22
+ d="M404.521 155.839C498.389 155.839 574.411 231.075 574.411 323.792C574.411 416.509 498.389 491.744 404.521 491.744C310.653 491.744 234.631 416.509 234.631 323.792C234.631 231.075 310.653 155.839 404.521 155.839Z"
23
+ fill="#79FFE6"
24
+ stroke="#2E2D36"
25
+ stroke-width="7.67819"
26
+ />
27
+ <path
28
+ d="M401.021 218.481C450.893 218.481 491.275 258.538 491.275 307.892C491.275 357.246 450.893 397.303 401.021 397.303C351.149 397.303 310.767 357.246 310.767 307.892C310.767 258.538 351.149 218.481 401.021 218.481Z"
29
+ fill="white"
30
+ stroke="#2E2D36"
31
+ stroke-width="6.14255"
32
+ />
33
+ <circle cx="231.379" cy="476.492" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
34
+ <circle cx="256.471" cy="535.8" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
35
+ <circle cx="300.109" cy="582.413" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
36
+ <circle cx="401.071" cy="643.307" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
37
+ <circle cx="457.998" cy="631.009" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
38
+ <path d="M457.304 487.798V535.601L489.139 569.123" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round" />
39
+ <circle cx="499.354" cy="582.413" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
40
+ <circle cx="542.695" cy="535.006" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
41
+ <circle cx="562.332" cy="476.393" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
42
+ <path d="M303.381 465.483L289.993 476.988H248.834" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round" />
43
+ <path d="M351.532 489.484V531.188L312.555 569.817" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round" />
44
+ <path
45
+ d="M371.863 494.889V569.123L345.78 596.942V615.24"
46
+ stroke="#2E2D36"
47
+ stroke-width="7.67819"
48
+ stroke-linecap="round"
49
+ />
50
+ <path d="M401.368 498.311V625.753" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round" />
51
+ <path d="M496.925 465.731L505.057 473.566H545.422" stroke="#2E2D36" stroke-width="7.67819" stroke-linecap="round" />
52
+ <ellipse cx="401.021" cy="307.892" rx="51.671" ry="53.0099" fill="#2E2D36" />
53
+ <ellipse cx="411.286" cy="294.106" rx="18.5956" ry="19.0915" fill="white" />
54
+ <ellipse cx="428.493" cy="322.471" rx="8.43002" ry="8.67796" fill="white" />
55
+ <circle cx="344.143" cy="632.299" r="14.8269" fill="white" stroke="#2E2D36" stroke-width="4.60691" />
26
56
  </svg>
package/package.json CHANGED
@@ -1,42 +1,31 @@
1
1
  {
2
2
  "name": "@xberg-io/opencode-html-to-markdown",
3
- "version": "0.1.0",
4
- "description": "OpenCode tools for HTML→Markdown conversion with the html-to-markdown CLI.",
3
+ "version": "0.2.3",
4
+ "description": "Fast, lossless HTML→Markdown conversion with structured metadata, tables, and document-structure extraction.",
5
5
  "keywords": [
6
- "conversion",
7
- "html",
8
6
  "html-to-markdown",
9
7
  "markdown",
10
- "opencode"
8
+ "html",
9
+ "conversion",
10
+ "metadata"
11
11
  ],
12
- "homepage": "https://github.com/xberg-io/plugins/tree/main/plugins/html-to-markdown",
13
- "bugs": {
14
- "url": "https://github.com/xberg-io/plugins/issues"
15
- },
16
- "license": "MIT",
12
+ "homepage": "https://xberg.io",
17
13
  "repository": {
18
14
  "type": "git",
19
- "url": "git+https://github.com/xberg-io/plugins.git",
20
- "directory": "plugins/html-to-markdown"
15
+ "url": "https://github.com/xberg-io/plugins"
21
16
  },
22
- "files": [
23
- ".opencode/",
24
- "assets/",
25
- "README.md"
26
- ],
17
+ "license": "MIT",
27
18
  "type": "module",
28
19
  "main": ".opencode/plugins/html-to-markdown.js",
29
20
  "exports": {
30
21
  ".": "./.opencode/plugins/html-to-markdown.js"
31
22
  },
32
- "publishConfig": {
33
- "access": "public",
34
- "provenance": true
35
- },
23
+ "files": [
24
+ ".opencode/",
25
+ "assets/",
26
+ "README.md"
27
+ ],
36
28
  "dependencies": {
37
29
  "@opencode-ai/plugin": "^1.17.8"
38
- },
39
- "engines": {
40
- "node": ">=22.14.0"
41
30
  }
42
31
  }