Writing & StyleStyle guide

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.

Quick answer

When Microsoft Learn content references code from another repository, use the supported cross-repository reference syntax and maintain the referenced code so the documentation does not silently drift.

Key details

Core Issuecross-repository code snippet references
RegisterMicrosoft Learn technical documentation

Important caveats

Scope Boundary

This page covers Microsoft Learn cross-repository snippet mechanics and maintenance expectations; it does not replace the broader preference for in-repository snippet sources when those are available.

Further guidance

Content

When Microsoft Learn content references code from another repository, use the supported cross-repository reference syntax and maintain the referenced code so the documentation does not silently drift.

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

Explore the topic