:// PLAINPORT
MCP · html_to_markdown

Convert HTML to Markdown

Converts supplied HTML into readable Markdown without fetching a URL. Use this when the agent already has HTML. Provide base_url only to resolve relative links; use fetch_markdown when Plainport should retrieve the page. Limit: 200k input characters, 150k output characters.

When to use it

Converts supplied HTML into readable Markdown without fetching a URL. Use this when the agent already has HTML. Provide base_url only to resolve relative links; use fetch_markdown when Plainport should retrieve the page.

Input schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "html": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200000
    },
    "base_url": {
      "type": "string",
      "maxLength": 2048
    },
    "max_chars": {
      "default": 100000,
      "type": "integer",
      "minimum": 1000,
      "maximum": 150000
    }
  },
  "required": [
    "html",
    "max_chars"
  ],
  "additionalProperties": false
}

Output schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "const": true
    },
    "data": {
      "type": "object",
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "markdown": {
          "type": "string"
        },
        "truncated": {
          "type": "boolean"
        },
        "input_chars": {
          "type": "integer"
        },
        "max_chars": {
          "type": "integer"
        }
      },
      "required": [
        "title",
        "markdown",
        "truncated",
        "input_chars",
        "max_chars"
      ]
    },
    "meta": {
      "type": "object",
      "properties": {
        "request_id": {
          "type": "string"
        },
        "duration_ms": {
          "type": "integer"
        },
        "limits": {
          "type": "object"
        }
      },
      "required": [
        "request_id",
        "duration_ms"
      ]
    }
  },
  "required": [
    "ok",
    "data",
    "meta"
  ],
  "additionalProperties": false
}

REST example

curl -X POST https://plainport.exportitnow.workers.dev/api/v1/html-to-markdown \
  -H "content-type: application/json" \
  -d '{"html":"<main><h1>Hello</h1><p>World</p></main>"}'

Example result

{
  "ok": true,
  "data": {
    "title": "Hello",
    "markdown": "# Hello\n\nWorld",
    "truncated": false
  },
  "meta": {
    "request_id": "018f…",
    "duration_ms": 12
  }
}

Limit

200k input characters, 150k output characters