MarkdownSnippets.Tool
28.3.0
dotnet tool install --global MarkdownSnippets.Tool --version 28.3.0
dotnet new tool-manifest
dotnet tool install --local MarkdownSnippets.Tool --version 28.3.0
#tool dotnet:?package=MarkdownSnippets.Tool&version=28.3.0
nuke :add-package MarkdownSnippets.Tool --version 28.3.0
MarkdownSnippets
A dotnet tool or MsBuild Task that extract snippets from code files and merges them into markdown documents.
See https://github.com/SimonCropp/MarkdownSnippets for full documentation.
Behavior
- Recursively scan the target directory for code files containing snippets.
- Recursively scan the target directory for markdown (
.mdormdx) files. - Merge the snippets into those markdown files.
Installation
Ensure dotnet CLI is installed.
Install MarkdownSnippets.Tool
dotnet tool install -g MarkdownSnippets.Tool
Usage
mdsnippets C:\Code\TargetDirectory
If no directory is passed the current directory will be used, but only if it exists with a git repository directory tree. If not an error is returned.
Defining Snippets
Any code wrapped in a convention based comment will be picked up. The comment needs to start with begin-snippet: which is followed by the key. The snippet is then terminated by end-snippet.
// begin-snippet: MySnippetName
My Snippet Code
// end-snippet
Named C# regions will also be picked up, with the name of the region used as the key.
#region MySnippetName
My Snippet Code
#endregion
Using Snippets in Markdown
The raw snippet key can be used in any markdown document by subsequent surrounding it with snippet::
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 28.3.0 | 325 | 5/28/2026 |
| 28.2.0 | 8,079 | 4/15/2026 |
| 28.1.0 | 693 | 4/14/2026 |
| 28.0.2 | 4,892 | 3/30/2026 |
| 28.0.1 | 5,270 | 3/5/2026 |
| 28.0.0 | 6,166 | 2/7/2026 |
| 28.0.0-beta.25 | 73 | 1/25/2026 |
| 28.0.0-beta.24 | 70 | 1/24/2026 |
| 28.0.0-beta.23 | 68 | 1/24/2026 |
| 28.0.0-beta.22 | 66 | 1/23/2026 |
| 28.0.0-beta.21 | 64 | 1/23/2026 |
| 28.0.0-beta.20 | 77 | 1/23/2026 |
| 28.0.0-beta.19 | 71 | 1/22/2026 |
| 28.0.0-beta.18 | 80 | 1/22/2026 |
| 28.0.0-beta.17 | 80 | 1/22/2026 |
| 28.0.0-beta.16 | 64 | 1/21/2026 |
| 28.0.0-beta.15 | 75 | 1/21/2026 |
| 28.0.0-beta.13 | 78 | 1/19/2026 |
| 28.0.0-beta.11 | 74 | 1/14/2026 |
| 28.0.0-beta.10 | 257 | 12/18/2025 |