Markdown to Inline-Styled HTML Converter
Convert Markdown to HTML with GitHub-style inline CSS. Get email-ready, portable HTML with all styles embedded in style attributes.
About
Email clients strip <style> blocks and ignore external stylesheets. If you paste GitHub-flavored Markdown HTML into an email, newsletter, or embed, you get raw unstyled text. This tool parses Markdown into an AST, then serializes each node with the exact inline style attribute matching GitHub's rendering engine. The output is a self-contained HTML fragment that renders identically in Gmail, Outlook, and any context that strips <head> content. It handles GFM extensions: tables, task lists, fenced code blocks with syntax tokens, strikethrough, and nested lists.
The parser operates entirely client-side with zero dependencies. It does not call any remote API. Limitations: no LaTeX math rendering, no Mermaid diagrams, no emoji shortcodes (use native Unicode emoji). Deeply nested blockquotes beyond 5 levels may produce suboptimal indentation. For production email campaigns, test the output in Litmus or Email on Acid, as some clients (Outlook 2007-2019) have additional CSS restrictions beyond inline style support.
Formulas
This tool does not use mathematical formulas. It applies a deterministic text-transformation pipeline. The conversion logic follows this flow:
Where styleMap is a dictionary mapping each element type to its inline CSS string. For example:
The tokenizer processes the input line-by-line for block-level elements (headings, lists, code fences, blockquotes, tables, horizontal rules), then applies inline pattern matching within each text node for emphasis (**bold**, *italic*), code spans, links, and images. Nested structures (lists within lists, bold within italic) are resolved by recursive inline parsing. Each token carries its depth and context, which determines the final style attribute value.
Reference Data
| Markdown Syntax | HTML Element | Key Inline Styles Applied | Email Client Support |
|---|---|---|---|
| # Heading 1 | <h1> | font-size: 2em; border-bottom: 1px solid #d1d9e0; padding-bottom: 0.3em | All clients |
| ## Heading 2 | <h2> | font-size: 1.5em; border-bottom: 1px solid #d1d9e0; padding-bottom: 0.3em | All clients |
| **bold** | <strong> | font-weight: 600 | All clients |
| *italic* | <em> | font-style: italic | All clients |
| ~~strike~~ | <del> | text-decoration: line-through | Most clients |
| `code` | <code> | background: rgba(175,184,193,0.2); padding: 0.2em 0.4em; border-radius: 6px; font-size: 85% | All clients |
| ```lang | <pre><code> | background: #f6f8fa; padding: 16px; border-radius: 6px; overflow: auto; font-size: 85% | Most clients (no scroll in Outlook) |
| > quote | <blockquote> | border-left: 0.25em solid #d1d9e0; padding: 0 1em; color: #656d76 | All clients |
| - item | <ul><li> | list-style-type: disc; padding-left: 2em; margin: 0.25em 0 | All clients |
| 1. item | <ol><li> | list-style-type: decimal; padding-left: 2em; margin: 0.25em 0 | All clients |
| - [x] task | <li> + checkbox | list-style: none; with Unicode ☑/☐ prefix | Most clients |
| [text](url) | <a> | color: #0969da; text-decoration: underline | All clients |
|  | <img> | max-width: 100%; height: auto | Most clients (blocked by default in some) |
| | table | | <table> | border-collapse: collapse; border: 1px solid #d1d9e0; padding: 6px 13px | All clients |
| --- | <hr> | border: 0; border-top: 1px solid #d1d9e0; margin: 24px 0 | All clients |
| Paragraph | <p> | margin: 0 0 16px 0; line-height: 1.5 | All clients |
| Line break (2 spaces + enter) | <br> | (none needed) | All clients |