Documentation.NotebookToMarkdown
2.0.0
See the version list below for details.
dotnet add package Documentation.NotebookToMarkdown --version 2.0.0
NuGet\Install-Package Documentation.NotebookToMarkdown -Version 2.0.0
<PackageReference Include="Documentation.NotebookToMarkdown" Version="2.0.0" />
<PackageVersion Include="Documentation.NotebookToMarkdown" Version="2.0.0" />
<PackageReference Include="Documentation.NotebookToMarkdown" />
paket add Documentation.NotebookToMarkdown --version 2.0.0
#r "nuget: Documentation.NotebookToMarkdown, 2.0.0"
#:package Documentation.NotebookToMarkdown@2.0.0
#addin nuget:?package=Documentation.NotebookToMarkdown&version=2.0.0
#tool nuget:?package=Documentation.NotebookToMarkdown&version=2.0.0
Documentation.NotebookToMarkdown
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_dataimages (image/png,image/gif,image/jpeg) → inline<img>data URIs
- Cell attachments (
) are inlined as base64data: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 ships a docfx IDocumentProcessor (JupyterDocumentProcessor) that claims .ipynb
files and routes them through docfx's Markdown pipeline. To enable it, place the plugin assembly in
the plugins folder of a docfx template and reference that template from your build.
Restore the package and copy the plugin assembly (and
Newtonsoft.Json.dll) into a template:_templates/NotebookPlugin/plugins/ Documentation.NotebookToMarkdown.dll Newtonsoft.Json.dllUse the
lib/net8.0orlib/net10.0assembly that matches the runtime your docfx tool runs on.Reference the template in
docfx.json(alongsidedefaultor your own template):{ "build": { "content": [ { "files": ["**/*.ipynb"] } ], "dest": "_site", "template": [ "default", "_templates/NotebookPlugin" ] } }Run
docfx build. Each.ipynbis converted and rendered to an.htmlpage.
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
| Product | Versions 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. |
-
net10.0
- Newtonsoft.Json (>= 13.0.4)
-
net8.0
- Newtonsoft.Json (>= 13.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.