HTML to Markdown: What Survives the Conversion and What Quietly Disappears
A test of 20 HTML snippets through Turndown with the settings ClearMark uses, and back through marked: what comes through intact, what is flattened, and how to check your own content.
Converting HTML to Markdown feels like a safe, mechanical step: the tags go, the symbols stay. Then you open the result and a table has turned into four separate lines, or a checked checkbox is gone. This post shows what happened when I put 20 small HTML snippets through the converter ClearMark uses, which of them survived intact, and how to check your own content before you trust the output.
To test your own HTML, paste it into ClearMark, switch to HTML → Markdown and read the result in the Code and Preview tabs. Everything runs in your browser.
What I Tested
ClearMark converts HTML to Markdown with the Turndown library, set to write # headings, fenced code blocks and - bullets, with no plugins. It loads Turndown and marked from a CDN without pinning a version, so results can change when a library updates. I ran each snippet through Turndown 7.2.4 with the same settings, then turned the Markdown back into HTML with marked 18.1.1. Those were the current npm releases when I tested.
| HTML | Markdown result |
|---|---|
| Bold, italic, links, images | Kept |
<h1> and <h2> | Kept as # and ## |
| Nested lists, ordered list starting at 3 | Kept, including the start number |
| Blockquote, horizontal rule, line break | Kept |
Code block with language-js | Kept as a fenced block with the js label |
<pre> without an inner <code> | Code-block formatting lost; plain text |
| Table | Flattened to separate paragraphs: A, B, 1, 2 |
| Checked and unchecked checkboxes | Boxes dropped; the checked state is lost |
| Strikethrough, underline, mark, sup, sub | Markup dropped, text kept ("E=mc2") |
div class and inline style | Dropped, text kept |
details and summary | Joined into one word ("SBody") |
iframe | Removed |
script and style contents | Kept as plain text |
"E=mc2" is perfectly valid Markdown, and it is wrong. The converter did not fail. It produced clean output that no longer says what the page said.
Why Tables and Checkboxes Go
Turndown's core has no rules for tables, task-list checkboxes or strikethrough. A separate plugin, turndown-plugin-gfm 1.0.2, adds them: in my test it produced a proper pipe table, [x] and [ ] checkboxes, and strikethrough. ClearMark does not include that plugin, so those losses apply to it.
The other direction works better. ClearMark renders Markdown with marked in GFM mode, and in my test marked turned a pipe table, a - [x] task list and ~~strikethrough~~ into the matching HTML. So if you need a table in Markdown, write the pipe table by hand and let the Markdown → HTML side render it. Even with the plugin, a table with no header row stayed as raw HTML, and a line break inside a cell split the row.
A Three-Step Round-Trip Check
- Convert. Paste your HTML, choose HTML → Markdown, and look for the elements in the table above: tables, checkboxes, superscripts,
preblocks. - Convert back. Copy the Markdown, switch to Markdown → HTML and open the Preview tab. Anything that looks different was changed on the way.
- Compare the text. Copy the visible text of the original page and of the Preview, and paste both into ClearDiff. Added and removed words show what moved.
If you plan to keep the Markdown as the source from now on, fix the lost items by hand once, then stop converting. For the other direction and the basics, see How to Convert Markdown to HTML (and Back), The Complete Beginner's Guide to Markdown and What Is ClearMark.
The honest summary: converting HTML to Markdown keeps the common formatting, including headings and code languages with ClearMark's settings, and quietly flattens everything Markdown has no plain rule for. In my test, tables, task-list checkboxes, strikethrough, superscripts and bare pre blocks were the losses, so check those first and run a round trip on anything you can't afford to get wrong.
For questions or inquiries contact us at info@cleartexteditor.com