Docfx.ResultSnippets 2.0.0

dotnet add package Docfx.ResultSnippets --version 2.0.0                
NuGet\Install-Package Docfx.ResultSnippets -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Docfx.ResultSnippets" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Docfx.ResultSnippets --version 2.0.0                
#r "nuget: Docfx.ResultSnippets, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Docfx.ResultSnippets as a Cake Addin
#addin nuget:?package=Docfx.ResultSnippets&version=2.0.0

// Install Docfx.ResultSnippets as a Cake Tool
#tool nuget:?package=Docfx.ResultSnippets&version=2.0.0                

Docfx.ResultSnippets Docfx Result Snippets

Nuget

Features

using Docfx.ResultSnippets;

...

// some return value
const string result = "Some result to save";
// now it can be saved as an example
result.SaveResults();
// we can also add a part to the name
"Some other result".SaveResults(partName: "part2");

Which generates a Markdown file that can be added via the include file like so,

[!INCLUDE[SomeExample](some/path/to/code/__examples__/ClassName.MethodName.{Optional-PartName}.md)]

Getting Started

To use this library, simply include Docfx.ResultSnippets.dll in your project or grab it from NuGet, and add this to the top of each .cs file that needs it:

using Docfx.ResultSnippets;

Why?

Docfx has amazing tools for including code snippets in your documentation but not the results from executing that code.

For some code examples the formatted result of executing that code is as important as the code itself.

For example code that returns an IEnumerable, the most natural way to show the result would be a table. This library provides the tools to make it happen and more.

This code,

// some complex data which will convert to a table
var data = Enumerable
    .Range(1, 3)
    .Select(
        i =>
            new
            {
                Name = $"Name {i}",
                Id = i,
                Nested = new { ChildId = i + 1 }
            }
    );
var tableResult = data.AsTableResult();

Results in this,

Name Id Nested
Name 1 1 {"ChildId":2}
Name 2 2 {"ChildId":3}
Name 3 3 {"ChildId":4}

The aim of this library is to support Markdown friendly code results so the readers of your documentation can get a complete picture of what the code will produce. Think of it as serverside rendering of code results, like a pre executed Jupyter notebook.

For more details/information have a look the documentation, test project or create an issue.

Attributions

Icons created by juicy_fish

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Docfx.ResultSnippets:

Package Downloads
SparkTest.NET

Support for testing Spark dotnet applications

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 261 1/15/2024
1.1.0 388 6/7/2023
1.0.1 656 6/2/2023
1.0.0 137 6/1/2023