markdown: nested code fences

67 · Thiago Perrotta · Aug. 16, 2026, 11:38 p.m.
Summary
This blog post discusses an issue with nesting code fences in markdown and how the CommonMark specification dictates the behavior of these fences. The author illustrates the problem with examples of code blocks and shares a solution involving using a longer outer fence to prevent the first closing fence from prematurely ending the block. Detailed examination of rendering results showcases the necessity for careful count of backticks.