Writing & StyleStyle guide

Referencing Named Code Snippets by ID

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.

Quick answer

Use a supported named snippet identifier when the source file defines a stable snippet region that Microsoft Learn can reference by ID.

Key details

Core Issuenamed snippet identifiers
RegisterMicrosoft Learn technical documentation

Important caveats

Scope Boundary

Named IDs are a Microsoft Learn authoring mechanism; the source file must actually define the matching snippet region and language-specific marker syntax.

Further guidance

Content

Use a supported named snippet identifier when the source file defines a stable snippet region that Microsoft Learn can reference by ID.

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.

  1. 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.

Related guides

Writing & Style

Referencing Code From Another Repository

Referencing Code From Another Repository records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Writing & Style

Selecting Line Ranges in Referenced Code Snippets

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.

Writing & Style

Using Interactive Code Snippets in Documentation

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.

Writing & Style

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.

Explore the topic