Markdown won because it reads like plain text and writes like markup — no angle brackets to typo, no closing tags to forget, and it diffs cleanly in version control. Converting it to HTML is trivial; converting it to correct, safe, consistent HTML is where workflows break down. This guide covers the conversion rules, the pitfalls, and a pipeline you can run every publish.
What maps to what
| Markdown | HTML | Notes |
|---|---|---|
# H1 … ###### H6 | <h1>…<h6> | One H1 per page for SEO sanity |
**bold** / *italic* | <strong> / <em> | Semantic, not the old <b>/<i> |
[text](url) | <a href> | Relative links stay relative in static builds |
- item / 1. item | <ul> / <ol> | Nested items indent with 2–4 spaces |
> quote | <blockquote> | Nested quotes stack the marker |
Fenced ``` blocks | <pre><code> | Add a language class for highlighting |
| Pipe tables | <table> | Alignment via :--- markers |
--- | <hr> | Also setext heading underline under text |
 | <img> | alt text is an accessibility requirement, not a suggestion |
The pitfalls
- Line breaks vanish. Standard Markdown joins consecutive lines into one paragraph — end lines with two spaces or a backslash, or use blank lines.
- Raw HTML passes through. Useful for embeds, dangerous for user input: untrusted Markdown must be sanitized (allowlist tags/attributes) or you ship XSS.
- Code fences inside HTML blocks — indentation-based HTML parsing and fenced code interact badly in some engines. Keep fences at column zero.
- Tables need pipes everywhere. A missing trailing pipe breaks the row silently in some parsers.
- Smart punctuation differs by engine —
--may become an en dash on one platform and literal on another. Test the render, don't assume.
A repeatable pipeline
- Write in any editor with a live preview — keep Markdown in git, always.
- Convert — run the document through the Markdown to HTML converter; check the preview, copy the semantic output.
- Sanitize if the Markdown came from anyone but you — allowlist <p> <a> <em> <strong> <ul> <ol> <li> <blockquote> <code> <pre> <table> headings.
- Review the diff — paste old and new HTML into the Diff Checker to catch unintended changes (dropped attributes, mangled entities) before deploy.
- Validate once — W3C validator or
tidy -errorscatches unclosed tags that browsers forgive silently.
When to stay in Markdown
Docs, changelogs, READMEs, CMS content and anything reviewed in pull requests — Markdown diffs are readable; minified HTML diffs are noise. Ship HTML only where the consumer needs markup (embeds, emails with tables, structured data injection).
Frequently asked questions
Which dialect should I standardize on? CommonMark + GFM tables and task lists covers ~95% of real usage and is supported by every serious engine.
How do I handle footnotes or mermaid diagrams? GFM footnotes where supported; diagrams render via client-side libraries — both are extensions, so pick engines that agree on them across your toolchain.
Is converted HTML SEO-neutral? Yes, provided the structure is semantic (real headings, lists, alt text). Search engines read the DOM — they don't care which editor produced it.