@zack/html-to-markdown

Convert raw HTML into Markdown and plain text, with optional main-content extraction.

Z
@zack
Publication time unavailable7 installs · all versions

Get started

Install, run, or load this Tool.

Run directly with the CLI or call from an SDK

01Install

Resolve this exact Tool version and its prepared dependencies.

agentpm install @zack/html-to-markdown@0.1.1

02Run Tool

Send JSON to its declared input contract and receive JSON output.

agentpm run @zack/html-to-markdown@0.1.1 --input-file input.json

Supply input.json matching this Tool’s input schema.

ORLoad via SDK

Call the installed Tool through an SDK.

import { load } from '@agentpm/sdk';
const t = await load('@zack/html-to-markdown@0.1.1');
CLI version & updates

CLI 0.1.36+ reads and preserves standard declarations. New publications require an explicit supported standard; use the latest CLI for current authoring checks. Historical releases remain installable as published. This floor does not establish selected-release installation support or Harness readiness.

Check agentpm --version, then follow the CLI installation and update guide. See the publication compatibility requirements.

Interface

The contract a caller must satisfy, from the authored JSON Schema.

Input

htmlstringrequired

Raw HTML to convert into Markdown and plain text.

base_urlstringoptional

Optional base URL for resolving relative links in the HTML.

format:
"uri"
preserve_linksbooleanoptional

If true, keep hyperlinks as Markdown links instead of stripping URLs.

default:
true
preserve_imagesbooleanoptional

If true, keep images as Markdown image tags where possible.

default:
false
main_content_onlybooleanoptional

If true, try to extract the main article/content (readability-style) and drop nav/boilerplate.

default:
false

No other input fields are accepted.

Complete input schema
{
  "type": "object",
  "required": [
    "html"
  ],
  "properties": {
    "html": {
      "type": "string",
      "description": "Raw HTML to convert into Markdown and plain text."
    },
    "base_url": {
      "type": "string",
      "format": "uri",
      "description": "Optional base URL for resolving relative links in the HTML."
    },
    "preserve_links": {
      "type": "boolean",
      "default": true,
      "description": "If true, keep hyperlinks as Markdown links instead of stripping URLs."
    },
    "preserve_images": {
      "type": "boolean",
      "default": false,
      "description": "If true, keep images as Markdown image tags where possible."
    },
    "main_content_only": {
      "type": "boolean",
      "default": false,
      "description": "If true, try to extract the main article/content (readability-style) and drop nav/boilerplate."
    }
  },
  "additionalProperties": false
}

Output

Variant 1

oktrue
textstring

Plain-text representation of the input HTML.

markdownstring

Markdown representation of the input HTML.

metadataobject

Optional metadata about the conversion process (e.g. character counts, heuristics used).

additionalProperties:
true
Inspect metadata structure

Optional metadata about the conversion process (e.g. character counts, heuristics used).

content_length_textintegeroptional

Length of the text string in characters.

main_content_extractedbooleanoptional

True if main-content extraction was applied.

content_length_markdownintegeroptional

Length of the markdown string in characters.

Variant 2

okfalse
errorobject
additionalProperties:
true
Inspect error structure
codestringoptional

Stable machine-readable error code (e.g. INPUT_INVALID, PARSE_FAILED).

detailsobjectoptional

Optional structured context (e.g. truncated input, parse error info).

additionalProperties:
true
messagestringrequired

Human-readable error message.

Complete output schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "ok",
        "markdown",
        "text"
      ],
      "properties": {
        "ok": {
          "const": true
        },
        "text": {
          "type": "string",
          "description": "Plain-text representation of the input HTML."
        },
        "markdown": {
          "type": "string",
          "description": "Markdown representation of the input HTML."
        },
        "metadata": {
          "type": "object",
          "properties": {
            "content_length_text": {
              "type": "integer",
              "description": "Length of the text string in characters."
            },
            "main_content_extracted": {
              "type": "boolean",
              "description": "True if main-content extraction was applied."
            },
            "content_length_markdown": {
              "type": "integer",
              "description": "Length of the markdown string in characters."
            }
          },
          "description": "Optional metadata about the conversion process (e.g. character counts, heuristics used).",
          "additionalProperties": true
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "message"
          ],
          "properties": {
            "code": {
              "type": "string",
              "description": "Stable machine-readable error code (e.g. INPUT_INVALID, PARSE_FAILED)."
            },
            "details": {
              "type": "object",
              "description": "Optional structured context (e.g. truncated input, parse error info).",
              "additionalProperties": true
            },
            "message": {
              "type": "string",
              "description": "Human-readable error message."
            }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": false
    }
  ]
}

Runtime & execution

What AgentPM provisions and runs on your machine.

Runtime
node 20
Entrypoint
node dist/index.js
Timeout
60 s
Packaged files
2

Environment

HTML2MD_DEFAULT_BASE_URLOptional
Optional default base URL used to resolve relative links when base_url is not provided in inputs.

Declared by the author and read from your environment at run time. AgentPM neither supplies nor proxies credentials. Local runtime readiness is not evaluated here.

Reported by the Registry, for this version. A Registry-performed check is a Registry-reported result, not independent verification.

APDS conformance
Legacy inference; conformance not established
Integrity & provenance
4 recorded signals
  • Not applicable: Logical release digestRegistry recomputed metadata binding; archive bytes are not re-downloaded. Historical single archives have no logical release digest.Source: canonical release document and stored manifest/resolution/artifact inventory. Observed .
  • Author signature verified by RegistryRegistry namespace signer history; Ed25519 and exact statement binding. This is a Registry-performed check, not independent local verification by the reader or a safety guarantee.Source: stored provenance and Stage 1 verification contracts. Observed .
  • Registry attestation verified by RegistryRoot-signed Registry key set; exact origin, validity, key history and Ed25519 statement binding. This is a Registry-performed check, not independent local verification by the reader or a safety guarantee.Source: stored provenance and Stage 1 verification contracts. Observed .
  • Not evaluated: Dependency byte integrity not evaluatedUse a local verified installation to check the exact graph's downloaded bytes.Source: Registry metadata only. Observed .
Target support
1 artifact · legacy · provisioning not evaluated
License
MIT · declared by the author

Source

Legacy manifest: no explicit APDS declaration. Compatibility may be inferred; this is not verified conformance.

Full agent.json · v0.1.1
{
  "kind": "tool",
  "name": "html-to-markdown",
  "files": [
    "dist/",
    "node_modules/"
  ],
  "inputs": {
    "type": "object",
    "required": [
      "html"
    ],
    "properties": {
      "html": {
        "type": "string",
        "description": "Raw HTML to convert into Markdown and plain text."
      },
      "base_url": {
        "type": "string",
        "format": "uri",
        "description": "Optional base URL for resolving relative links in the HTML."
      },
      "preserve_links": {
        "type": "boolean",
        "default": true,
        "description": "If true, keep hyperlinks as Markdown links instead of stripping URLs."
      },
      "preserve_images": {
        "type": "boolean",
        "default": false,
        "description": "If true, keep images as Markdown image tags where possible."
      },
      "main_content_only": {
        "type": "boolean",
        "default": false,
        "description": "If true, try to extract the main article/content (readability-style) and drop nav/boilerplate."
      }
    },
    "additionalProperties": false
  },
  "$schema": "https://raw.githubusercontent.com/agentpm-dev/cli/refs/heads/main/schemas/agentpm.manifest.schema.json",
  "license": {
    "file": "LICENSE",
    "spdx": "MIT"
  },
  "outputs": {
    "oneOf": [
      {
        "type": "object",
        "required": [
          "ok",
          "markdown",
          "text"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "text": {
            "type": "string",
            "description": "Plain-text representation of the input HTML."
          },
          "markdown": {
            "type": "string",
            "description": "Markdown representation of the input HTML."
          },
          "metadata": {
            "type": "object",
            "properties": {
              "content_length_text": {
                "type": "integer",
                "description": "Length of the text string in characters."
              },
              "main_content_extracted": {
                "type": "boolean",
                "description": "True if main-content extraction was applied."
              },
              "content_length_markdown": {
                "type": "integer",
                "description": "Length of the markdown string in characters."
              }
            },
            "description": "Optional metadata about the conversion process (e.g. character counts, heuristics used).",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error": {
            "type": "object",
            "required": [
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine-readable error code (e.g. INPUT_INVALID, PARSE_FAILED)."
              },
              "details": {
                "type": "object",
                "description": "Optional structured context (e.g. truncated input, parse error info).",
                "additionalProperties": true
              },
              "message": {
                "type": "string",
                "description": "Human-readable error message."
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      }
    ]
  },
  "runtime": {
    "type": "node",
    "version": "20"
  },
  "version": "0.1.1",
  "entrypoint": {
    "args": [
      "dist/index.js"
    ],
    "command": "node",
    "timeout_ms": 60000
  },
  "description": "Convert raw HTML into Markdown and plain text, with optional main-content extraction.",
  "environment": {
    "vars": {
      "HTML2MD_DEFAULT_BASE_URL": {
        "required": false,
        "description": "Optional default base URL used to resolve relative links when base_url is not provided in inputs."
      }
    }
  }
}