Skip to content

feat(node): options object on every function and extractDocument - #35

Merged
chaliy merged 11 commits into
mainfrom
claude/project-thread-mwewa8
Oct 27, 2026
Merged

chaliy merged 11 commits into
mainfrom
claude/project-thread-mwewa8

Conversation

@chaliy

@chaliy chaliy commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

Node (@everruns/markkit) catches up with Python and the new WASM package:

  • Every function (extractHtml, extractHtmlSync, extractUrl, extractBytes) takes an optional trailing options object. Existing calls are unchanged.
  • MarkkitOptions uses the same camelCase builder fields as @everruns/markkit-wasm: maxInputSize, preserveLinks, preserveImages, includeSelectors, excludeSelectors (added to defaults), archive/sheet limits, includeHiddenSheets. It also adds URL policy: maxProcessingSecs, allowPrivateNetworks, allowedHosts, maxRedirects. Bindings could not reach a private-network URL before; now they can opt in.
  • New extractDocument / extractDocumentSync → { markdown, title, format, warnings, stats, metadata }.
  • 64-bit limits arrive as JS numbers; non-integer or negative values throw invalid options.
  • node --test binding tests run in js.yml after the native build.
  • knowledge/runtimes/node-package.md: API and a Python/Node/WASM parity table; README updated.

Why

Roadmap: Node options parity (memory note: Node lacked extract_html_sync_with_options; bindings had no opt-in for private-network fetch).

Before / After

Before: extractHtmlSync(html) only used defaults; no way to set selectors or URL policy from Node; no metadata.

After:

$ node --test crates/markkit-js/__test__/*.test.cjs
# tests 7
# pass 7
# fail 0

including extractUrl(local) rejecting URL blocked by default, succeeding with { allowPrivateNetworks: true }, and rejecting again with allowedHosts: ["example.com"].

Risk

  • Low: additive, optional trailing argument.
  • Unknown option keys are ignored (napi objects don't report them), unlike WASM which throws. Documented.
  • feat(limits): unified Limits with timeout, output, node and depth caps #27 (unified Limits) keeps the builder setters this uses; its bindings follow-up can add new limits (timeout, maxOutputSize, ...) to this same options object.

Checklist

  • Tests added or updated (options on every entry point, size limit, invalid numbers, metadata, URL policy against a local server)
  • Backward compatibility considered

Generated by Claude Code

chaliy added 11 commits October 26, 2026 23:32
Opt-in `tool` feature adds markkit::tool: MarkkitToolBuilder -> MarkkitTool
-> single-use ToolExecution, mirroring bashkit's tool module. One call
converts a url, html or base64 document to Markdown; args validated before
execution, base64 bounded before decode, URL via the SSRF guard, output
capped by max_output_chars. Adds Markkit::extract_url_document.
wasm-bindgen build of markkit (html, docx, spreadsheet, tool) for
wasm32-unknown-unknown: single-threaded, no COOP/COEP, no URL fetching.
Markkit class with validated camelCase options plus MarkkitTool. Node
tests, CI job gating Check, and an OIDC npm publisher.
Node functions take an optional trailing MarkkitOptions object with every
builder field plus URL policy (allowPrivateNetworks, allowedHosts,
maxRedirects, maxProcessingSecs); same camelCase shape as the WASM package.
Adds extractDocument/extractDocumentSync with title, format, warnings and
stats, and node --test binding tests in js.yml.
@chaliy chaliy self-assigned this Oct 27, 2026
@chaliy
chaliy merged commit d31f85c into main Oct 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant