HTML to Markdown
html_to_markdownConverts web pages, raw HTML strings, or Apify dataset HTML into clean Markdown for LLMs and RAG, extracting main content and preserving tables and absolute links.
Instructions
Returns one item per input page or HTML string with URL, title, markdown, wordCount, charCount, truncated, status and error. Converts web pages (fetched by URL, no crawling), raw HTML strings or HTML stored in an Apify dataset into clean Markdown for LLMs and RAG, with main-content extraction, GitHub-flavored tables and absolute links. Give at least one of: urls or htmlStrings or datasetId. Runs the Apify Actor ucchiii/html-to-markdown on YOUR Apify account (APIFY_TOKEN); you pay that Actor's pay-per-event price, see https://apify.com/ucchiii/html-to-markdown.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "html_to_markdown"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| urls | No | Full page URLs starting with http:// or https://. Only these pages are fetched (no crawling); pages over 5 MB and internal or private addresses are refused. Up to 10,000 inputs per run in total. | |
| baseUrl | No | Optional http(s) URL used to turn relative links and images in the raw HTML strings into absolute ones, and written to the front matter. | |
| maxChars | No | Cut each Markdown document at this length, at a paragraph boundary where possible (the row gets truncated: true). 0 means no limit. | |
| datasetId | No | Optional. Dataset ID (a finished run's 'defaultDatasetId', e.g. 'WkzbQMuFYuamGv3YF') whose items hold HTML in the field below. If an item has a 'url' it is used as the base URL for links. | |
| htmlField | No | Name of the field in each dataset item that holds the HTML string. | html |
| imageMode | No | Drop images (best for LLM text) or keep them as Markdown image links. Inline data: images are always dropped. | drop |
| userAgent | No | Optional custom User-Agent header for page requests. Default identifies this Actor. | |
| keepTables | No | Convert HTML tables to GitHub-flavored Markdown tables. If off, each table row becomes a plain line of text. | |
| concurrency | No | How many pages are fetched in parallel. Allowed range 1 to 10 (default 5). At most 2 connections per host are used at a time, with at least 0.2 s between requests to the same host. | |
| frontMatter | No | Start each document with a YAML front-matter block holding the title and the URL. | |
| htmlStrings | No | Raw HTML documents to convert, one string per document (up to 5 MB each). Use this when you already have the HTML, for example from your own scraper. | |
| mainContent | No | Remove nav, header, footer, aside and similar page chrome, and keep only the main or article element when the page has one. Scripts and styles are always removed. | |
| timeoutSecs | No | Timeout for each page request, in seconds. Allowed range 1 to 120 (default 20). | |
| absoluteLinks | No | Resolve relative links and image URLs against the page URL (or the base URL for raw HTML). javascript: links are always removed. |