RonSijm.MarkdownSnippets 1.0.0

Prefix Reserved
dotnet tool install --global RonSijm.MarkdownSnippets --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local RonSijm.MarkdownSnippets --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=RonSijm.MarkdownSnippets&version=1.0.0
                    
nuke :add-package RonSijm.MarkdownSnippets --version 1.0.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 (.md or mdx) files.
  • Merge the snippets into those markdown files.

Installation

Ensure dotnet CLI is installed.

Install RonSijm.MarkdownSnippets

dotnet tool install -g RonSijm.MarkdownSnippets

Usage

mdsnip 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.0 123 8/29/2026