Markdown Inline HTML
Last updated: 2026-10-14
Inline HTML CommonMark core
Markdown accepts raw HTML, both inline and block. Renderers either pass it through (this site's markdown-it with html:true) or filter it. HTML is the escape hatch when Markdown runs out of expressiveness.
| Group | Basic: Inline |
|---|---|
| Spec level | CommonMark core |
| Spec version | CommonMark 0.31.2 + GFM |
📝 Syntax
<span style="color:crimson">red text</span>
▶ Live Example
Edit Markdown on the left, see the result on the right
💡 Key points
⚠️ Warning Any renderer of user input needs a sanitizer like DOMPurify; <script> and onerror are XSS vectors.
ℹ️ Note Markdown inside an HTML block is not parsed — the most common gotcha.
❓ FAQ
Q Are all HTML tags allowed?
A Depends on the renderer; safe setups drop script, iframe, style and event attributes.
Q Can I use Markdown inside HTML?
A Not inside block-level HTML; inline tags like <span> still parse Markdown.
Q What is this site's strategy?
A markdown-it html:true passthrough plus a DOMPurify whitelist in the editor.