Using Relative Paths in Code Snippet References 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 supported relative paths when a Microsoft Learn snippet reference points to a source file relative to the article or repository location.
Key details
Core Issuerelative paths in snippet references
RegisterMicrosoft Learn technical documentation
Important caveats
Scope Boundary
This page is limited to Microsoft Learn snippet-reference path syntax and does not prescribe file-path style for unrelated prose or command examples.
Further guidance
Content
Use supported relative paths when a Microsoft Learn snippet reference points to a source file relative to the article or repository location.
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.
Using Relative Paths in Learn Include Directives records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal writing rule.
Preferring In-Repository Snippet References 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 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.
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.
Using Relative Paths for Microsoft Learn Conceptual Images records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal writing rule.
Automating Code Validation 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 Horizontal Scrollbars in 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.
Highlighting Key Lines in 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.