Using HTML to Markdown
This page converts a small HTML fragment into Markdown. The sample <p>Hello</p> becomes Hello. A heading <h1>Hi</h1> becomes # Hi. The page reads the tags h1, h2, h3, p, strong, em, code, a, ul, ol, and li. A script and a document type are rejected. The message says to remove the document type and any script before converting. The page does not fetch a page. An address written in the fragment is text, not a request.
The headline is Markdown. The text under the headline is the converted fragment, and that text is what you copy. A line counts the characters in the Markdown. The field accepts from 1 to 20000 characters. A blank field, or a longer paste, is rejected before conversion. If the fragment converts to no text, the page says to enter HTML that still has text. The sample Hello is short, and the headline names the format rather than the word Hello.
h2 becomes a line that starts with ## and h3 becomes a line that starts with ###. strong becomes double asterisks around the text. em becomes single asterisks. code becomes backticks. A link is written as Markdown when the address starts with http, https, a slash, or a hash. ul and ol are both written as lines that start with a dash, because each li becomes a dash item. Other tags are dropped and their text is kept. Reset returns the field to <p>Hello</p>.
Walk a slightly larger fragment the same way, one tag at a time, before you trust a long paste. A paragraph that contains strong, em, and code keeps those three marks inside the paragraph text. A heading stays on its own Markdown line, with the hash count matching h1, h2, or h3. A list follows as dash lines, whether the HTML list was ul or ol. A link that qualifies keeps the visible words in brackets and the address in parentheses. A tag outside the supported list contributes words and does not add a mark of its own. The page does not fetch a page to fill in a tag it skipped. If a script or a document type is anywhere in the paste, stop and remove it. The conversion does not begin until that rejection is cleared. Hello and # Hi remain the two samples that prove the paragraph rule and the heading rule before you move on to the longer fragment.
What Hello and Hi Become
<p>Hello</p> becomes Hello. The p tag is the signal to keep the text as a paragraph, and the tags themselves are not copied into the Markdown. <h1>Hi</h1> becomes # Hi. The single hash is the heading mark for h1, then a space, then Hi. The headline on the page is the word Markdown, not the word Hello. The character count is the length of the converted text. For the sample, that text is Hello. The page does not fetch a page to find more HTML. The fragment in the field is the whole input.
A script and a document type are rejected before any Markdown is written. The rejection is one message: remove the document type and any script before converting. Taking the script out and leaving <p>Hello</p> lets the conversion run. The supported tags are h1, h2, h3, p, strong, em, code, a, ul, ol, and li. A tag outside that list does not become its own Markdown mark. The text inside it remains. A div around Hello still contributes Hello. The page does not invent a heading for a tag it does not read as h1, h2, or h3.
How the Fragment Is Read
The paste is trimmed at the ends and checked for length, a document type, and a script. When those checks pass, the fragment is read as HTML and walked from the outside in. Text is kept. A run of spaces in the text becomes one space. h1, h2, and h3 open a Markdown heading with one, two, or three hashes. p keeps the inner text. strong wraps with **. em wraps with *. code wraps with backticks. li becomes a line that starts with a dash, and both ul and ol pass those lines through. The sample paragraph has no extra space, so Hello is the whole result. The page does not fetch a page while it walks the tags.
The opposite conversion is a different page. The Markdown to HTML tool converts a small Markdown subset to HTML. A line # Hi and a following paragraph Hello become an h1 and a paragraph. Raw HTML in that source is escaped. The subset is headings, paragraphs, bold, italic, code, and dash lists. That page does not turn <p>Hello</p> into Hello, and it does not reject a script inside HTML because the source there is Markdown. Use it when you are starting from # Hi. Use this page when you are starting from <p>Hello</p> or <h1>Hi</h1>.
What the Page Does Not Fetch
The page does not fetch a page. <p>Hello</p> is converted from the characters in the field. If the fragment contains an address, the page does not request that address, and it does not replace Hello with whatever that address might return. A link whose address starts with http or https is written as a Markdown link, text in brackets and the address in parentheses. The address is still not opened. A script is rejected rather than fetched or run. A document type is rejected rather than used to choose a parsing mode.
Other tags are dropped and their text is kept. That rule is how an unfamiliar tag can still produce words. It is also why a layout tag does not become a Markdown feature this page does not have. Tables, images, and attributes other than a link address are outside the supported list. The supported tags are h1, h2, h3, p, strong, em, code, a, ul, ol, and li. If the words you need sit in one of those tags, the Markdown uses the matching mark. If they sit in another tag, the words remain and the tag name does not.
Worked Fragments
Paste <p>Hello</p>. Confirm the text is Hello and the headline is Markdown. Paste <h1>Hi</h1>. Confirm # Hi. Paste <h2>Hi</h2> and confirm ## Hi. Paste <h3>Hi</h3> and confirm ### Hi. Paste <p><strong>Hello</strong></p> and confirm **Hello**. Paste <p><em>Hello</em></p> and confirm *Hello*. Paste a list with li elements and confirm each item is a line that starts with a dash, for both ul and ol. Paste a script, or a document type, and confirm the rejection. The page does not fetch a page on any of these tries.
Shortening the tags is a different pass. The HTML Minifier removes extra spaces from an HTML fragment. A p element with Hi on its own line becomes <p>Hi</p>. The headline is Minified HTML. Comments are removed. A pre block stays as typed. A script is rejected. That page does not turn <p>Hello</p> into Hello, and it does not write # Hi. Use it when you want shorter HTML. Use this page when you want Markdown from the supported tags.
Tags and Length
The supported tags are h1, h2, h3, p, strong, em, code, a, ul, ol, and li. h1, h2, and h3 become #, ##, and ###. p, strong, em, and code become paragraph text, double asterisks, single asterisks, and backticks. A link is a Markdown link only when the address starts with http, https, a slash, or a hash. ul and ol both become dash lines, so an ordered list is not written with numbers. A b tag is written with the same double asterisks as strong, and an i tag with the same single asterisks as em. Anything else contributes its text without a new mark.
The paste must be from 1 to 20000 characters. A script and a document type are rejected even when the rest of the fragment would have converted. The page does not fetch a page to get under the length cap or to replace a rejected script. If conversion leaves no text, the page asks for HTML that still has text. An empty element with no words falls into that case. Hello and # Hi both have text, so the samples clear that check.
Mistakes That Keep the Tags
The usual miss is to expect the tags to remain. <p>Hello</p> becomes Hello, not a paragraph tag written in Markdown. Another miss is to expect <h1>Hi</h1> to stay an h1 tag. It becomes # Hi. Another miss is to leave a script in the fragment. A script and a document type are rejected. Another miss is to expect the page to download a URL that appears in an anchor. The page does not fetch a page. Another miss is to expect an ordered list to keep the numbers 1, 2, and 3. Items are dash lines. Another miss is to expect a tag outside the supported list to gain a special mark. The text is kept. The tag name is not turned into a new Markdown feature.
An XML document is indented, not converted to hashes. The XML Formatter places each element of a well-formed document on its own line. <a><b>Hi</b></a> is formatted that way. The headline is Formatted XML. That page does not fetch a file, and it does not accept a document type. It does not turn <p>Hello</p> into Hello or <h1>Hi</h1> into # Hi. Use it when you want indented XML. Use this page when you want Markdown from the supported HTML tags.
Keeping the Markdown
Copy the Markdown and keep the HTML beside it until the marks match the tags. For the samples, <p>Hello</p> pairs with Hello, and <h1>Hi</h1> pairs with # Hi. If you used strong, em, or code, confirm the asterisks or backticks wrap the same words. If you used a link, confirm the address in parentheses is the address you typed, and only when it starts with http, https, a slash, or a hash. If you used a list, confirm dash lines rather than the original li tags. The page does not fetch a page, so the copy is not a download. It is the conversion of the field. Read the copy from the first character to the last before you paste it onward. A missing space after a hash turns # Hi into a different line. A missing pair of asterisks leaves a word that was strong looking like ordinary text. The character count under the headline is a useful cross-check against the length of the text you copied. If the count and the copy disagree, copy again from the result rather than repairing the Markdown by hand and calling it the page's output.
A second run of <p>Hello</p> returns Hello again. Reset puts that sample back in the field. The previous Markdown stays on screen until you convert again. If a script was rejected, remove the script from the paste you keep, then convert the remaining fragment. Do not describe the rejection as Markdown. The rejection means no converted text was produced for that submit.
Converting the Samples Again
Enter <p>Hello</p>. Confirm Hello. Enter <h1>Hi</h1>. Confirm # Hi. Enter <h2>Hi</h2> and <h3>Hi</h3> and confirm the hash counts are two and three. Enter a strong, an em, and a code element and confirm the asterisks and backticks. Enter a ul and an ol and confirm dash lines for both. Enter a script and confirm the rejection. Enter a document type and confirm the same rejection. Submit a blank field and confirm the length message. The page does not fetch a page during these checks. The supported tags stay the same list on every run.
Pretty-printed data is a different layout. The JSON Prettifier formats one JSON value with line breaks and four-space indentation. {"a":1} becomes a formatted object whose key a is set to the number 1. The headline is Formatted JSON. Invalid JSON is rejected with Enter valid JSON. That page does not fetch JSON, and it does not turn <p>Hello</p> into Hello. Use it when the paste is JSON. Use this page when the paste is an HTML fragment made of the supported tags.
What the Markdown Marks Mean
Hello means a paragraph was read and the tags were not kept. # Hi means an h1 was read. ## and ### mean h2 and h3. Double asterisks mean strong. Single asterisks mean em. Backticks mean code. A dash line means an li inside a ul or an ol. A bracketed link means the address started with http, https, a slash, or a hash. The headline Markdown means the conversion finished. The character count is the length of that text. A rejection means a script or a document type was present, the field was empty or too long, or no text remained.
Checking Hello and Hi
Start with <p>Hello</p> and confirm Hello. Then convert <h1>Hi</h1> and confirm # Hi, including the space after the hash. Then try h2, h3, strong, em, code, and a two-item list. Then reject a script and a document type. Then try a tag outside the supported list and confirm the words remain without a new mark. The page does not fetch a page, so none of these checks should wait on a network. If Hello still contains a p tag, the conversion did not run. If Hi has no hash, the heading was not read as h1.
A style sheet is a different compact form. The CSS Minifier removes CSS comments and extra spaces. A rule a { color: red; } becomes a{color:red;}. That page does not check that the CSS is valid, and it does not turn <p>Hello</p> into Hello or <h1>Hi</h1> into # Hi. Use it when you want a shorter rule. Use this page when you want Markdown from the HTML fragment.