# HTML to Markdown

Turn a saved web page into Markdown: the main content, without menus, scripts and styling.

Reads the HTML as text and writes its content as Markdown: headings, paragraphs, lists, tables, code blocks with their language, quotes, links and pictures. Nothing in the page is run or loaded.

- Endpoint: `POST https://setget.net/v1/tools/html-to-markdown` with JSON `{"input": {...}}` (add `"wait": 30` to hold the reply until the job finishes)
- MCP: `run_tool` with `slug` = `html-to-markdown`
- Page: https://setget.net/tools/html-to-markdown

## Files in, files out

This is a file tool. Its file inputs take file references, not file contents and not web addresses.

- Get a reference by uploading: `curl -T FILE https://setget.net/drop/` prints a line `ref  <id>/f1`. Or `POST https://setget.net/v1/drops` with `{"files":[{"name","size"}]}`, PUT the bytes to the returned `upload.url` with the listed headers, and use the file's `ref`. Over MCP use the `drop` tool. A file under about 700 KB can also be sent in place as a `data:<type>;base64,<content>` URI.
- Uploads are at most 100 MB per file, are readable by anyone with the link, and expire (one hour by default). Programs are refused.
- The tool runs as a job. The reply is `{"tool", "ms", "result", "files", "job"}`: `result` is JSON, and every result file comes back in `files` as `{"name", "size", "content_type", "kind", "url", "ref"}`. Download it from `url`, or pass `ref` as the input of another file tool.
- A job still running when the wait ends answers 202 with `job`. Follow it with `GET https://setget.net/v1/jobs/<id>?wait=30`, or stream progress from `GET https://setget.net/v1/jobs/<id>/events` (over MCP: the `job` tool). A person can watch it at `job.url`.

## Inputs

- `file` (required, file, a file reference such as `DROP_ID/f1`, accepts text, binary): The HTML file to convert.
- `base_url` (optional, string): Address of the page, used only to write relative links in full. Nothing is fetched. Leave empty to keep links as they are.
- `images` (optional, string, one of `keep`, `alt`, `drop`, default `"keep"`): What to do with pictures: keep writes ![description](address), alt keeps only the description, drop leaves them out.
- `main_only` (optional, boolean, default `true`): Take only the main content of the page when it is marked, and leave out menus, sidebars and footers. Set to false to convert the whole page.

## Example 1: A saved page as Markdown

Upload first. Each placeholder below stands for the reference of one upload: `DROP_ID/f1` = [sample.html](https://setget.net/static/samples/sample.html).

```json
{"input":{"file":"DROP_ID/f1"},"wait":30}
```

## Example 2: Links written in full, pictures left out

Upload first. Each placeholder below stands for the reference of one upload: `DROP_ID/f1` = [sample.html](https://setget.net/static/samples/sample.html).

```json
{"input":{"file":"DROP_ID/f1","base_url":"https://example.com/docs/","images":"drop"},"wait":30}
```

**How does it find the main content?** It takes the <main> element, an element with the main role, or the only <article>. Otherwise it takes the whole body. Menus, sidebars, footers, forms, scripts and hidden elements are left out either way.

**Can I give it a web address?** No. It converts a file you upload and never opens an address. Save the page from your browser first.

**What happens to links and pictures?** Links become [text](address). Pictures become ![description](address) and are not downloaded. Pictures stored inside the page itself are left out. Links that run script are reduced to their text.

**What about tables?** Tables of data become Markdown tables. Tables that only arrange the page are unfolded into ordinary text.

**The result is empty. Why?** The page builds its content with scripts, which are not run. Save it from your browser after it has loaded, or set main_only to false.

**Where is the Markdown?** In a file named after your upload, ending in .md. The result also holds the Markdown itself in "markdown" when it is up to 200,000 characters; "truncated" is true when only the start fits there.

**Does it fetch anything from the internet?** No. Links and picture addresses found in the file are copied as text. Nothing they point to is opened or downloaded.
