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.

GroupBasic: Inline
Spec levelCommonMark core
Spec versionCommonMark 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.

📚 See also

Raw HTML FilteringGFM extension HTML EntitiesCommonMark core
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏