Documentation.NotebookToMarkdown 2.2.1

dotnet add package Documentation.NotebookToMarkdown --version 2.2.1
                    
NuGet\Install-Package Documentation.NotebookToMarkdown -Version 2.2.1
                    
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="Documentation.NotebookToMarkdown" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Documentation.NotebookToMarkdown" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Documentation.NotebookToMarkdown" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Documentation.NotebookToMarkdown --version 2.2.1
                    
#r "nuget: Documentation.NotebookToMarkdown, 2.2.1"
                    
#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.
#:package Documentation.NotebookToMarkdown@2.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Documentation.NotebookToMarkdown&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Documentation.NotebookToMarkdown&version=2.2.1
                    
Install as a Cake Tool

Documentation.NotebookToMarkdown

NuGet

A .NET docfx plugin — and reusable library — that converts Jupyter Notebook (.ipynb) files into rendered documentation.

Use it as a docfx plugin to publish notebooks as ordinary documentation pages, or use the underlying NotebookConverter directly in any pipeline. The only runtime dependency of the converter is Newtonsoft.Json; the docfx plugin contract (Docfx.Plugins) is provided by the docfx host at runtime.

What it does

  • Markdown cells are emitted verbatim.
  • Code cells are wrapped in fenced code blocks tagged with the notebook's language (from metadata.language_info.name).
  • Execution outputs are rendered as HTML:
    • execute_result (text/plain) → <pre class="jupyter-execute-result"><code>…</code></pre>
    • display_data images (image/png, image/gif, image/jpeg) → inline <img> data URIs
  • Cell attachments (![alt](attachment:name)) are inlined as base64 data: URIs.
  • Raw cells are skipped (matching nbconvert).

If the input cannot be parsed, or is missing required notebook structure, the original input is returned unchanged so callers can fall back gracefully.

Installation

dotnet add package Documentation.NotebookToMarkdown

Target frameworks: net8.0 and net10.0 (current LTS releases).

Use as a docfx plugin

The package is a self-contained docfx plugin payload. It ships a docfx IDocumentProcessor (JupyterDocumentProcessor) that claims .ipynb files and routes them through docfx's Markdown pipeline, and a small docfx template (template/) that renders a "Launch Notebook" button on every page produced from a notebook.

Because everything is embedded in the package, no project or dotnet restore is required - just unzip the .nupkg (it is a plain zip) and copy two folders into a docfx template:

  • plugins/<tfm>/ - the plugin assembly and its runtime dependency Newtonsoft.Json.dll, already bundled together. Pick net8.0 or net10.0 to match the runtime your docfx tool runs on. The docfx host provides Docfx.* and System.Composition.*, so those are intentionally not included.
  • template/ - the partials/affix.tmpl.partial and token.json that render the button.
NotebookTemplate/
  plugins/
    Documentation.NotebookToMarkdown.dll   # from the package's plugins/<tfm>/ folder
    Newtonsoft.Json.dll                     # bundled in the same folder
  partials/
    affix.tmpl.partial                      # from the package's template/ folder
  token.json                                # from the package's template/ folder

A minimal, project-free assembly (e.g. in a build script or Dockerfile) looks like:

# download + unzip the package, then copy the self-contained payload into a docfx template
unzip Documentation.NotebookToMarkdown.<version>.nupkg -d pkg
mkdir -p NotebookTemplate
cp -r pkg/plugins/net10.0   NotebookTemplate/plugins
cp -r pkg/template/partials NotebookTemplate/partials
cp    pkg/template/token.json NotebookTemplate/token.json

Then reference the template in docfx.json (after default so the button partial overrides the default affix):

{
  "build": {
    "content": [ { "files": ["**/*.ipynb"] } ],
    "dest": "_site",
    "template": [ "default", "NotebookTemplate" ]
  }
}

Run docfx build. Each .ipynb is converted and rendered to an .html page, and the build step sets a fromIpynb flag so the bundled template shows the "Launch Notebook" link on those pages.

Use the converter directly

using Documentation.NotebookToMarkdown;

string notebookJson = File.ReadAllText("Hello.ipynb");

var converter = new NotebookConverter();
string markdown = converter.ConvertToMarkdown(notebookJson);

Capturing warnings

Non-fatal issues (for example, a malformed cell) are reported through an optional callback:

var converter = new NotebookConverter(warning => Console.Error.WriteLine(warning));
string markdown = converter.ConvertToMarkdown(notebookJson);

Building and testing

dotnet build
dotnet test

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.1 138 6/19/2026 2.2.1 is deprecated because it is no longer maintained.
2.2.0 109 6/18/2026
2.1.0 106 6/18/2026
2.0.0 111 6/18/2026
1.0.0 419 6/18/2026