You pasted your Markdown, copied the HTML, and the page came out wrong. A whole section sits inside a box it was never meant to be in, or a tidy list arrives as one long paragraph with hyphens still in it. Nothing in the output looks like an error message, because there is none: the converter did exactly what it was given.
Two mistake families cause almost all of this damage. The first is raw HTML mixed into the Markdown with a tag left open. The second is list formatting that looks fine in the source and renders as something else. This guide walks through both with the free Markdown to HTML Converter on Ovatly, and the one habit that catches them before the code ships: reading the sanitized preview.
Contents
- Quick answer
- Why an unclosed tag survives conversion
- The list mistakes that render wrong
- How to convert and check, step by step
- Worked example: one open tag, one swallowed list
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
The converter renders your Markdown with the marked parser, then sanitizes the result with DOMPurify. Raw HTML in your source passes through as HTML, so an unclosed <div> or <section> stays unclosed in the output, and sanitization will not repair it: it removes unsafe constructs such as <script> tags, event-handler attributes and javascript: URLs, nothing more. Lists break for spacing reasons, most often a missing blank line before the first item. Fix both problems in the source, then check the sanitized preview in the Markdown to HTML Converter before you copy anything.
Why an unclosed tag survives conversion
Markdown converters do not treat raw HTML as an error. When marked meets a block of HTML in your source, it passes that HTML into the output largely as written, because mixing HTML into Markdown is a deliberate, supported thing to do. The parser is not checking whether your tags balance.
Sanitization is not a repair step either. DOMPurify has one job: safety. It strips <script> tags, event-handler attributes such as onclick, and javascript: URLs, and it removes HTML comments. Raw HTML that DOMPurify considers safe is kept. A <div> that never closes is not unsafe, so it sails through both steps untouched.
The damage shows up later, in the browser, and far from the cause. An unclosed <div> quietly wraps everything after it, so the rest of the page inherits its styling. An unclosed <a> can turn the following text into part of the link. An unclosed table cell gets closed by the browser wherever it guesses best, which may not be where you meant. Because the symptom sits sections away from the cause, these bugs are painful in code and obvious in a rendered preview.
The list mistakes that render wrong
Lists fail differently: the Markdown itself is misread. Rendering follows marked's CommonMark-style rules, and those rules are stricter about spacing than most people expect.
The classic is the missing blank line. Write a paragraph, press enter once, and start listing items, and the items are read as more of the paragraph. The output is a <p> with hyphens in it, not a <ul>. A numbered list has a related trap: a list that interrupts a paragraph only counts as a list when it starts at 1, so items numbered from 3 downwards stay paragraph text.
Markers matter too. Switching from - to * or + halfway down starts a new list under CommonMark-style rules, which can split one list into two with a gap. Nesting depends on indentation lining up under the parent item's text; mix tabs and spaces, or indent each level differently, and child items flatten to the top level. Finally, blank lines between items make a loose list, where every item is wrapped in its own paragraph and the spacing grows. None of these are converter bugs; each is the rules reading exactly what the spacing says.
How to convert and check, step by step
- Open the Markdown to HTML Converter and paste your Markdown into the input.
- Read the sanitized preview before you look at the code. Scroll it all: look for a section wearing another section's styling, and for any list that arrives as a paragraph.
- Fix problems in the source, not the output. Close the open tag, add the blank line, make the markers and indentation consistent.
- Convert again and confirm the preview now matches what you pictured.
- Copy the sanitized HTML, or download it as an .html file, and paste it into your page.
Worked example: one open tag, one swallowed list
Start with a conversion that works, the one from the tool itself. This input:
# Title
Some **bold** text.
produces an <h1> reading Title and a paragraph with <strong> around the word bold:
<h1>Title</h1>
<p>Some <strong>bold</strong> text.</p>
Now the broken version. A note is wrapped in a <div> that never closes, and the list starts on the very next line after a paragraph:
<div class="note">
Pack for the trip:
- Passport
- Charger
- Tickets
Two things go wrong at once. The items have no blank line before them, so they render as paragraph text with hyphens, not as a list. And because the <div> is still open, everything after it sits inside that note box. The fix is two small edits: close the tag after the list, and add the blank line. The output is then a real <ul> with three <li> items, sitting inside a <div> that ends where it should.
Limitations and honest tradeoffs
Be clear about what this tool is not. It renders Markdown and sanitizes the result; it does not validate HTML, does not repair broken markup, and does not warn you about either mistake family. The checking step is yours, and the preview is where it happens.
Sanitization has visible side effects worth knowing. HTML comments in your source are removed, so notes you left yourself in comments will not survive conversion. Raw HTML is kept only where DOMPurify considers it safe, so exotic or risky constructs may vanish without a message. A few GitHub-flavored features, such as tables and strikethrough, are supported on top of the CommonMark-style rules. And this converter is a code tool: for writing and editing Markdown as a document, the Markdown Editor in Developer tools is the separate surface built for that job.
Common mistakes
- Assuming sanitization means validation. DOMPurify removes unsafe code. It says nothing about whether your markup is correct.
- Fixing the output instead of the source. The next conversion overwrites your patch. Close the tag and fix the spacing in the Markdown.
- Skipping the preview. Both families are hard to see in raw HTML and obvious in the preview. The preview is the check.
- Changing list markers mid-list. A new marker starts a new list. Pick one marker per list and keep it.
- Trusting indentation by eye. Tabs and spaces can look identical on screen and nest completely differently. Use one, consistently.
FAQs
Does the converter fix unclosed tags in my HTML? No. The converter renders Markdown with the marked parser and then sanitizes the result with DOMPurify. Sanitization strips unsafe constructs such as script tags, event-handler attributes and javascript: URLs, but it does not close open tags or repair broken markup. Close the tags in your source and check the sanitized preview before copying.
Why did my list turn into a plain paragraph? The usual cause is a missing blank line between the paragraph and the first list item. Under CommonMark-style rules the list needs that separation, otherwise the items are read as a continuation of the paragraph. Add the blank line and convert again.
Why do my nested list items sit at the wrong level? Nested items depend on consistent indentation: the child items must line up under the parent item's text. Mixed tabs and spaces, or indentation that changes down the list, flatten the nesting. Pick one style, usually two or four spaces, and use it all the way through.
What does sanitization actually remove? DOMPurify removes script tags, event-handler attributes such as onclick, and javascript: URLs, and HTML comments are removed during sanitization too. Raw HTML that DOMPurify considers safe is kept. Dangerous constructs are stripped, but harmless broken markup is left exactly as written.
Is my Markdown uploaded to a server? No. The conversion runs locally in your browser with the marked parser and DOMPurify. Your text never leaves your device, and you can disconnect from the internet after the page loads and still convert.
Conclusion
Almost every broken conversion traces back to the same two causes: a raw HTML tag left open, which neither the parser nor the sanitizer will close for you, and list spacing that the CommonMark-style rules read differently from how you meant it. Fix both in the source, and let the sanitized preview in the Markdown to HTML Converter be the gate nothing passes without a look. Once your conversions come out clean, our guide on turning Markdown notes into a simple web page takes the same converter through the full publishing workflow, fragment, shell and all. For more guides in this series, see our Website and Webmaster Tools guides.
References
- CommonMark spec, on the parsing rules for lists and raw HTML blocks: https://spec.commonmark.org/
- marked documentation, on how the parser renders Markdown to HTML: https://marked.js.org/
- DOMPurify, on what the sanitizer removes and keeps: https://github.com/cure53/DOMPurify