# HTML to Markdown: Same Page, Nothing Invented

HTML to Markdown: Same Page, Nothing Invented is a tested SKILL.md that converts HTML into CommonMark Markdown and answers with the Markdown only, no wrapper fence; an agent buys it once for $0.01 over x402.

- Page: https://aiskills402.com/skills/html-to-markdown
- Category: Data & Analysis (https://aiskills402.com/categories/data)
- Price: $0.01 once, USD-priced, paid in USDC on Base over x402. Price as loaded on this page. The 402 response your agent receives is authoritative.
- Version: 1.0.0
- Card (JSON): https://api.aiskills402.com/v1/skills/html-to-markdown

## Use it when

Converts HTML into CommonMark Markdown and answers with the Markdown only, no wrapper fence. Headings become ATX headings, links keep their address byte for byte (title included), images keep their source and alt text, lists keep nesting and an ordered list keeps the number it begins with, code blocks keep their text and indentation, tables become pipe tables with literal pipes escaped, entities are decoded once so the text reads as a browser shows it, and characters that Markdown would read as syntax at that spot are escaped instead of silently changing the document. Scripts, styles and comments are dropped, and an instruction hidden in a comment is never followed. Elements Markdown cannot say, such as an iframe, subscript or superscript, stay as the original HTML instead of being lost. HTML cut off inside a tag or with no visible content gets a fixed one-line CANNOT CONVERT answer instead of an invented page. Use when scraped, exported or pasted HTML has to become Markdown for docs, a knowledge base, a README or a model prompt.

## Not for

Summarising or cleaning up a page, choosing which parts of a page matter, fetching a page from an address, converting Markdown back to HTML, or other Markdown flavours than CommonMark with pipe tables. It converts the HTML it is given, in full, and keeps what Markdown cannot say as HTML.

## Tested, honestly

Tested 2026-10-09.

- Strong model (claude-sonnet-5-5 (Claude Code alias "sonnet")): Right on 25 of 26, checked by code; it missed the format once: on the code block that itself holds a fence it wrapped the whole answer in a fence, then added a sentence and the corrected answer. Everywhere else it held: addresses with query strings, fragments, mail and tel links copied exactly, an image inside a link, a list starting at 7, nested lists, code with decoded entities, pipes escaped in a table, a year and a plus sign escaped at a line start, 5*6*7 escaped, entities decoded, an iframe and sub and sup kept as HTML, a comment ignored, visible text addressed to the AI kept as text, and a CANNOT CONVERT line for a cut page and an empty one.
- Weak model (claude-haiku-5-5 (Claude Code alias "haiku")): Right on 22 of 26, checked by code, but it wrote a mail link as a bare address and lost its text, left an escaped div as a real tag, and refused the two broken pages in a plain sentence instead of the CANNOT CONVERT line.

Note: Twenty-six HTML pages written by us, mostly in English and one in Bulgarian: 20 built around a trap (link addresses and titles, mail, tel and relative links, an image in a link, an ordered list start, nesting, code with entities and with a fence inside, a table with pipes, text Markdown would read as a list, a heading, a quote or emphasis, entities, an escaped tag, a hidden comment and a visible line addressed to the AI, an iframe, sub and sup, a line break, a quote with two paragraphs, a backtick in inline code), 2 that must be refused (cut inside a link address, nothing visible) and 4 controls. The shared request names the format and the two refusal cases, so both sides are scored by the same checks: exact substrings, structure patterns that accept every valid CommonMark form, and forbidden patterns. The test instances differ from the examples in the skill. Checks widened after the run, for both sides, each after a right answer was refused: an underscore escaped inside a word, and an escaped tag written with a backslash before both brackets. One run per model and page.

### With and without the skill

Tested 2026-10-09.

- Pages converted right (26 pages): Sonnet 25/26 with, 26/26 without; Haiku 24/26 with, 21/26 without.

Same request and same checks on both sides; on the two refusals both sides are scored on any clear sentence. Sonnet without the skill was right on all 26; its single miss with the skill was the fenced answer it then corrected. Haiku without the skill missed five: a link title dropped, a fence inside code that closed the block early, a year at a line start and a hash sign left unescaped so they turn into a list and a heading, and 5*6*7 left to become italics.

Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.

Full summary: https://aiskills402.com/skills/html-to-markdown/tests

## Example

### English (claude-sonnet-5-5)

Before:

> <!doctype html> <html><head><title>Page</title><style>.x{color:red}</style></head> <body> <div class="promo"><p>See the <a href="https://shop.example.com/p?id=7&amp;ref=nl#top" title="Spring sale">sale page</a> today.</p></div> <script>track();</script> </body></html>

After:

> See the [sale page](https://shop.example.com/p?id=7&ref=nl#top "Spring sale") today.

### Bulgarian (claude-sonnet-5-5)

Before:

> <!doctype html> <html><head><title>Магазин</title><style>.x{color:red}</style></head> <body> <h2>Доставка</h2><p>Поръчки над 50&nbsp;лв. се доставят <b>безплатно</b> до 3 работни дни.</p> <script>track();</script> </body></html>

After:

> ## Доставка Поръчки над 50 лв. се доставят **безплатно** до 3 работни дни.

## What is in the file

- Hard rules
- Structure
- Entities and characters
- When to refuse
- Work in this order
- Short examples

## Languages

Any language

## How to buy

Agent (HTTP):

1. GET https://api.aiskills402.com/v1/skills/html-to-markdown/file without a payment header. The answer is 402 with a PAYMENT-REQUIRED header (x402 v2): exact amount, asset, network, recipient.
2. Sign `accepts[0]` with an x402 client (for example @x402/core + @x402/evm).
3. Repeat the GET with the signature in the PAYMENT-SIGNATURE header. The answer is 200 with the file, its sha256 and a re-download token.

Agent (MCP): https://mcp.aiskills402.com/mcp — free tools search_skills, get_skill, redownload_skill. Buying itself is over HTTP.

Full flow: https://aiskills402.com/docs

## The file

- Version: 1.0.0
- Size: 9.9 KB (10102 bytes)
- SHA-256: 2c60377aba65cc5993caaef5484dd266a545557e9761ee71a42a5bbcb570eb18
- Updated: 2026-10-09
- New versions are free through your re-download token.

## Versions

### 1.0.0 (2026-10-09)

First release: converts HTML into CommonMark Markdown and answers with the Markdown only. Addresses and image sources are copied character for character, lists keep nesting and their start number, code blocks keep their text, tables become pipe tables with literal pipes escaped, entities are decoded once, text that Markdown would read as syntax is escaped, elements with no Markdown form stay as HTML, comments, scripts and styles are dropped and never obeyed, and cut HTML or a page with nothing visible gets one CANNOT CONVERT line. Twenty-six test cases with exact-substring, structure and forbidden-pattern checks; test/control.mjs proves the ideal answers pass and typical mistakes fail. No model run yet: the baseline, the final price and the sentence on what Sonnet gains are still to be written. Price 10000 is provisional.

## License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Terms: https://aiskills402.com/docs#license

## FAQ

### Why would plain text turn into a heading or a list after conversion?

Because Markdown reads some characters as syntax at certain spots. A paragraph that starts with a year and a dot becomes a numbered list, a hash sign and a space at the start of a line becomes a heading, and two asterisks around a number become italics. The skill puts a backslash before exactly those characters, so the rendered page reads like the original and nothing else gets a stray backslash.

### What happens to links, images and code?

Every address is copied character for character, with its query string, fragment and title, and only an entity inside it is decoded. Images keep their source and alt text, and an image inside a link stays inside it. Code blocks keep their indentation and their decoded characters, and a block that itself contains three backticks gets a longer fence so it cannot close early.

### What is dropped, and what stays as HTML?

Scripts, styles, comments, the head of the page and attributes Markdown has no place for are dropped, and a comment that tells the assistant what to answer is never followed. An iframe, a video, subscript, superscript or a table with merged cells has no Markdown form, so it stays as the original HTML on its line rather than vanishing or turning into a description.

### Does it help Claude Sonnet?

Our pages showed no gain for it, so the price stays at a cent. Sonnet and Haiku each converted twenty-six pages, once reading this file and once without it; a script then checked addresses, structure and escapes. Plain Sonnet got every page right, and with the file it once wrapped a whole answer in a fence before correcting itself. Haiku gained most, from 21 to 24: unaided it dropped a link title, let a year and a hash sign become a list and a heading, and let 5*6*7 turn into italics.

## Related skills

- [HTML Table to CSV: Merged Cells and Entities Done Right](https://aiskills402.com/skills/html-table-to-csv.md): $0.02 once
- [Translate Markdown: Docs That Still Build](https://aiskills402.com/skills/translate-markdown.md): $0.06 once
- [Markdown Table Repair: Fix the Table, Keep Every Cell](https://aiskills402.com/skills/markdown-table-repair.md): $0.05 once

## Measurement limits

- Models other than the two named above were not run.
- Each verdict comes from the test run on the date shown; the skill may have changed since (check the version).
- Full test inputs are not published here, only short excerpts of our own text.
- Results on your own texts, languages and domains can differ.

Offer note: Paid in USDC (USD-pegged) over x402 by an AI agent; one-time.
