Using Triple-Colon Syntax for Referenced Code Snippets
Using Triple-Colon Syntax for Referenced Code Snippets records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.
ReviewedEvidence1 sourceSectionWriting & Style
Quick answer
Use Microsoft Learn’s triple-colon `:::code` directive when authoring supported referenced-code snippets in Learn Markdown.
Key details
Core Issuetriple-colon code reference syntax
RegisterMicrosoft Learn technical documentation
Important caveats
Scope Boundary
This directive belongs to the Microsoft Learn publishing system and should not be presented as standard CommonMark or universal Markdown syntax.
Further guidance
Content
Use Microsoft Learn’s triple-colon `:::code` directive when authoring supported referenced-code snippets in Learn Markdown.
Purpose
Keep technical documentation readable, reusable, and unambiguous for readers while following current Microsoft Learn contributor conventions.
Sources and evidence
Sources are shown with the role they play in this guide. Historical or style-sensitive claims are kept within the evidence boundary described above.
How to include code in docs — Microsoft Learn Contributor Guide↗ (opens in a new tab)Microsoft · Current Microsoft Learn contributor guidance on including code in documentation, including link/code styling, code-block quality checks, screenshots, validation, highlighting, scrollability, bad-code labeling, and in-repository snippet references.
Selecting Line Ranges in Referenced Code Snippets records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.
Using Fenced Code Blocks for Longer Code records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.
Using Interactive Code Snippets in Documentation records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.
Avoiding IDE Screenshots for Code Examples records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.
Displaying an Entire Referenced Code File records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.
Referencing Named Code Snippets by ID records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.
Using Absolute URLs for Non-Documentation Microsoft Properties records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal writing rule.
Using Approved Language Tags in Fenced Code Blocks records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.