Writing & StyleStyle guide

Displaying an Entire Referenced Code File

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.

Quick answer

When a Microsoft Learn article needs the entire referenced source file, use a supported `:::code` reference without an ID or line range so the whole file is rendered.

Key details

Core Issuefull-file snippet references
RegisterMicrosoft Learn technical documentation

Important caveats

Scope Boundary

This is a Microsoft Learn snippet-reference option for cases where the full file is appropriate; it does not override the broader guidance to keep examples focused and readable.

Further guidance

Content

When a Microsoft Learn article needs the entire referenced source file, use a supported `:::code` reference without an ID or line range so the whole file is rendered.

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

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