{"slug":"html-to-markdown","name":"HTML to Markdown: Same Page, Nothing Invented","version":"1.0.0","updated_at":"2026-10-09T04:36:34.661Z","use_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.","languages":["any"],"tags":["markdown","html","convert","commonmark","scraping","docs"],"category":"data","category_url":"https://aiskills402.com/categories/data","keywords":["scraped, exported or pasted HTML","knowledge base","model prompt"],"faq":[{"q":"Why would plain text turn into a heading or a list after conversion?","a":"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."},{"q":"What happens to links, images and code?","a":"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."},{"q":"What is dropped, and what stays as HTML?","a":"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."},{"q":"Does it help Claude Sonnet?","a":"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."}],"examples":[{"lang":"en","model":"claude-sonnet-5-5","input_excerpt":"<!doctype html>\n<html><head><title>Page</title><style>.x{color:red}</style></head>\n<body>\n<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>\n<script>track();</script>\n</body></html>","output_excerpt":"See the [sale page](https://shop.example.com/p?id=7&ref=nl#top \"Spring sale\") today."},{"lang":"bg","model":"claude-sonnet-5-5","input_excerpt":"<!doctype html>\n<html><head><title>Магазин</title><style>.x{color:red}</style></head>\n<body>\n<h2>Доставка</h2><p>Поръчки над 50&nbsp;лв. се доставят <b>безплатно</b> до 3 работни дни.</p>\n<script>track();</script>\n</body></html>","output_excerpt":"## Доставка\n\nПоръчки над 50 лв. се доставят **безплатно** до 3 работни дни."}],"page_url":"https://aiskills402.com/skills/html-to-markdown","markdown_url":"https://aiskills402.com/skills/html-to-markdown.md","image_url":"https://cdn.aiskills402.com/og/skills/html-to-markdown/22387718.png","related_url":"https://api.aiskills402.com/v1/skills/html-to-markdown/related","purchases_count":null,"tested":{"date":"2026-10-09","strong":{"model":"claude-sonnet-5-5 (Claude Code alias \"sonnet\")","verdict":"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\")","verdict":"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.","baseline":{"date":"2026-10-09","rows":[{"label":"Pages converted right (26 pages)","better":"higher","strong":{"with":{"n":25,"of":26},"without":{"n":26,"of":26}},"weak":{"with":{"n":24,"of":26},"without":{"n":21,"of":26}}}],"note":"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."},"report_url":null},"price_usd":"0.01","price_micro":10000,"size_bytes":10102,"sha256":"2c60377aba65cc5993caaef5484dd266a545557e9761ee71a42a5bbcb570eb18","outline":["Hard rules","Structure","Entities and characters","When to refuse","Work in this order","Short examples"],"license":{"summary":"Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing","holder":"Georgi Kalchev, aiskills402.com","url":"https://aiskills402.com/docs#license"},"buy_url":"https://api.aiskills402.com/v1/skills/html-to-markdown/file","redownload_url_template":"https://api.aiskills402.com/v1/purchases/{token}","mcp_tool":null,"payment":{"protocol":"x402","scheme":"exact","asset":"USDC","selling":true,"network":"base","network_caip2":"eip155:8453","pay_to":"0x8e37022edcf0f21cf3c9f93fee9d4d32519f36f4","facilitator":"cdp"},"seo_title":"HTML to Markdown Without Lost Links or Code","seo_description":"Convert HTML to CommonMark: addresses copied exactly, lists, code and tables kept, entities decoded once, syntax escaped, cut HTML refused. $0.01 once.","versions":[{"version":"1.0.0","date":"2026-10-09","changelog":"# Changelog\n\n## 1.0.0 — 2026-10-09\n\nFirst 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.\n\n## 1.0.1 — 2026-10-09 (finalised after the model test)\n\n- Measured on 26 pages: Sonnet 26 -> 25, Haiku 21 -> 24 (without -> with the skill, same checks). Before the run two phrases of the skill were reworded (seven words shared with the GFM specification) and the test instances were changed to differ from the skill examples.\n- Checks widened for both sides after right answers were refused: an underscore escaped inside a word; an escaped tag with a backslash before both brackets.\n- Price: $0.01 (no Sonnet gain; Haiku +3).\n"}]}