piapia123
en

HTML to Markdown

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Turn a block of HTML into Markdown. Headings, paragraphs, bold and italic, links and images, blockquotes, ordered and unordered lists (nested too), fenced code blocks with the language taken from the class, and GFM pipe tables are all covered — content copied from a web page, a rich text editor or a Markdown editor can be pasted straight in. Three things are worth calling out: characters in the body that collide with Markdown syntax are escaped (otherwise a line containing `*` renders as italics, and all the user sees is that the output mysteriously changed shape); the code fence grows to fit any backticks in the content (a body containing triple backticks would otherwise close the block early and dump the rest into the page text); and `javascript:` URLs are not turned into links, only into text — the output is going into your own blog, and a clickable XSS entry point is not something this tool should produce.

Features

  • Headings, paragraphs, bold, italic, strikethrough, inline code, links and images
  • Ordered and unordered lists, nested included, indented to match the marker — which also handles the </li>-less form
  • Fenced code blocks, with the language read from class="language-xxx" or "lang-xxx"
  • GFM pipe tables, padding missing cells and escaping pipes inside them
  • Blockquotes, horizontal rules, and hard line breaks
  • Markdown syntax characters in the body are escaped so they are not parsed as formatting
  • Code fences grow automatically when the content contains backticks
  • javascript: and data: URLs are not turned into clickable links
  • script and style are dropped entirely rather than ending up in the output
  • Unknown tags keep their text and lose their markup, so the output never mixes two syntaxes
  • Fragments exported by rich text editors (UEditor, CKEditor, TinyMCE) with inline styles paste straight in
  • Everything runs locally in the browser; your content is never uploaded

How to use

  1. Paste the HTML
  2. Turn off the blank-line option for a tighter layout
  3. Copy the result into your blog, issue tracker, docs or README

FAQ

Why did an asterisk in my text become \*?
Because Markdown reads `*` as the start of italics. A line containing `a*b*c` would render as `a` plus italic `b` plus `c` — all the user sees is that the output mysteriously changed shape. Escaped to `a\*b\*c` it renders as the characters that were there. The same applies to backticks, underscores, square brackets and angle brackets. `#` and `-` are deliberately left alone: they only have block meaning at the start of a line, and escaping them everywhere would litter the output with backslashes (`C#` becoming `C\#`).
Where does the code block language come from?
From the class on `<pre><code class="language-js">`; both the `language-` and `lang-` prefixes are recognised (the first is what GitHub and highlight.js emit, the second is Prism). Without one, the fence is emitted bare. The fence also lengthens automatically when the content contains triple backticks — otherwise the code block would close early on that line and everything after it would become page text.
Why was a link downgraded to plain text?
Because its address used a scheme such as `javascript:` or `data:`. Those have almost no legitimate place in prose, and the output is going into your own blog or issue tracker — a `[click here](javascript:...)` pasted there is a clickable XSS entry point. This tool only lets through http, https, ftp, mailto, tel and similar, keeping the text for anything else.
Why does my table come out with a header row?
Because a Markdown table has to have one — there is no way to express headerless rows in pipe syntax. So when the source table is all `<td>`, the first row becomes the header. Missing cells are padded, and a pipe inside a cell is escaped to `\|`, since an unescaped one would cut the table in two.
Does this handle what UEditor and similar editors export?
Yes. Editor output usually carries a heap of inline styles (`text-indent`, `font-family`, `text-align`) and layers of nested `<div>` and `<span>`. This tool drops the styling and keeps the text, because those styles have no Markdown equivalent and forcing them into inline HTML would make the output unreadable. That is a deliberate trade: clean text rather than HTML wearing its original styling.
Is my content uploaded?
No. The conversion happens entirely in browser memory; the page makes no requests and works offline.

Related tools