Repository navigation
Convert the last hand-written C# example to a MarkdownSnippets snippet - #4133
Merged
martincostello merged 1 commit intoAug 27, 2026
Merged
Conversation
docs/migrating-to-v10.md carried the only C# fence in the repo that was not generated from compiled source. It becomes a snippet from a new DocumentationSnippets type, so the example compiles with the library.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4133 +/- ##
=======================================
Coverage 95.21% 95.21%
=======================================
Files 111 111
Lines 4115 4118 +3
Branches 843 844 +1
=======================================
+ Hits 3918 3921 +3
Misses 197 197
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
martincostello
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3413.
The conversion turned out to be nearly finished already. I inventoried every fence in every Markdown file in the repo, split by language and by whether it sits inside a
<!-- snippet: -->region:docs/configure-and-customize-swaggergen.mddocs/configure-and-customize-annotations.mddocs/configure-and-customize-swaggerui.mdREADME.mddocs/configure-and-customize-redoc.mddocs/configure-and-customize-swagger.mddocs/configure-and-customize-cli.mddocs/migrating-to-v10.mdSo the complete list of unconverted C# examples is one item: the
ISchemaFilter.Applyexample indocs/migrating-to-v10.md.package-readme.md,CONTRIBUTING.mdandSECURITY.mdhave no fences, andAGENTS.mdonly has shell ones. The remaining non-C# fences areterminal,yaml,json,xmland onediffshowing a public API signature change, none of which are compilable code.That one example now comes from a new
MigrationSchemaFiltertype inDocumentationSnippets, so it compiles against the library like every other example.One detail worth knowing, since no other snippet in the repo does this: the fence lives inside a bullet of the Migration Overview list. MarkdownSnippets preserves the indentation of the
<!-- snippet: -->marker line, so an indented marker emits the anchor, the fence and the<sup>footer all indented to match and the bullet still renders as a single list item. If you would rather not depend on that, the alternative is restructuring the bullet so the example sits at column zero after the list, which is what every other snippet does. I left the code content identical, apart from the block's pre-existing mixed indentation and a trailing space on the closing brace, which the extraction normalises.dotnet mdsnippetsruns clean and is idempotent,markdownlint-cli2against the repo's.markdownlint.jsonreports 0 issues, andDocumentationSnippetsbuilds on net8.0, net9.0 and net10.0 with 0 warnings and 0 errors.Separately, on #4127: the C# fences I added there can become guarded snippets by putting the preprocessor directives outside the begin and end markers, so the rendered page shows clean code while net8.0 skips the .NET 9 example. The two examples both declare a type named
Priority, so they need separate files with distinct namespaces to keep the rendered text identical. Happy to do that in a follow-up if you want it done there too.