Markdown Indented Code Blocks

Last updated: 2026-10-14

Indented Code Blocks CommonMark core

A paragraph indented by 4 spaces (or a tab) becomes a code block — Markdown's oldest code syntax, no language tag, no highlighting. Before fences existed, this was the only way.

GroupEdge Cases & Rules
Spec levelCommonMark core
Spec versionCommonMark 0.31.2 + GFM

📝 Syntax

(blank line first)
    content indented 4 spaces

▶ Live Example

Edit Markdown on the left, see the result on the right

💡 Key points

⚠️ Warning Content is fully literal: no Markdown parsing inside — a limit and a demo feature.
💡 Tip Prefer fenced blocks today: language tags and saner behavior inside lists.

❓ FAQ

Q Can I write Markdown inside?
A No, everything is literal — which makes it great for syntax demos.
Q How to indent a block inside a list?
A Indent to the item's text start, not a flat 4 spaces.
Q How wide is a tab?
A Expanded at tab stops: one tab counts as 4 spaces; mixing causes bugs.

📚 See also

Code BlocksCommonMark core List NestingCommonMark core Spaces & TabsCommonMark 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%

🙏 帮我们做得更好

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

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