Xml2Doc.Core 1.3.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Xml2Doc.Core --version 1.3.1
                    
NuGet\Install-Package Xml2Doc.Core -Version 1.3.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="Xml2Doc.Core" Version="1.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xml2Doc.Core" Version="1.3.1" />
                    
Directory.Packages.props
<PackageReference Include="Xml2Doc.Core" />
                    
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 Xml2Doc.Core --version 1.3.1
                    
#r "nuget: Xml2Doc.Core, 1.3.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 Xml2Doc.Core@1.3.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=Xml2Doc.Core&version=1.3.1
                    
Install as a Cake Addin
#tool nuget:?package=Xml2Doc.Core&version=1.3.1
                    
Install as a Cake Tool

Xml2Doc.Core

Core library for the Xml2Doc toolset, part of the mod-posh organization.

Overview

Xml2Doc.Core is the engine that powers all Xml2Doc tools — including the CLI and MSBuild integration. It handles XML parsing, type resolution, link conversion, and Markdown rendering in a way that’s simple to extend or reuse.

Features

  • Parses <summary>, <remarks>, <example>, <seealso>, <exception>, and <inheritdoc/>.
  • Converts <see> and <paramref> into inline Markdown links and code spans.
  • Cleans up namespaces and shortens generic types (e.g. List<T> instead of System.Collections.Generic.List<T>).
  • Aliases built-in types (System.Stringstring, System.Int32int) with token‑aware replacement to avoid corrupting identifiers (e.g., keeps StringComparer intact).
  • Supports overload grouping for cleaner docs.
  • Supports both per-type and single-file Markdown output with consistent link resolution.
  • Emits stable, explicit HTML anchors for all members; in single-file output, types also get heading‑based anchors.
  • Depth‑aware generic formatting in labels and signatures so nested generics (e.g., Dictionary<string, List<Dictionary<string, int>>>) render correctly.
  • Paragraph‑preserving normalization: preserves paragraph breaks and fenced code blocks, trims excess spaces within lines, and fixes stray spaces before punctuation.
  • Provides rich configuration through RendererOptions:
    • Filename mode (Verbatim or CleanGenerics)
    • Root namespace trimming (display-only)
    • Code block language (default: csharp)
    • Output mode selection (single vs. multi-file)
  • Includes snapshot-tested output for consistent Markdown generation.
  • Per-type output (RenderToDirectory)
    • Types link to per-type files produced by the selected filename mode.
    • Members link to anchors within the type file: Type.md#member-anchor.
  • Single-file output (RenderToSingleFile / RenderToString)
    • Types link to the in-document heading slug (derived from the visible type heading).
    • Members link to explicit in-document anchors.

Anchor strategy

  • Members: each section begins with <a id="..."></a> computed from the member ID by:
    • applying C# aliases (e.g., System.Int32int),
    • normalizing XML-doc generic braces {}[] for HTML safety,
    • lowercasing the result (stable identifiers).
  • Types (single-file only): each type section also emits an anchor derived from the visible heading text (GitHub-like slug).

Example Usage

using Xml2Doc.Core;

var model = XmlDocModel.Load("MyLibrary.xml");
var options = new RendererOptions(
    FileNameMode: FileNameMode.CleanGenerics,
    RootNamespaceToTrim: "MyCompany.MyProduct",
    CodeBlockLanguage: "csharp"
);

var renderer = new MarkdownRenderer(model, options);

// Generate one file per type
renderer.RenderToDirectory("./docs");

// Or combine everything into one Markdown file
renderer.RenderToSingleFile("./docs/api.md");
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 was computed.  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.
  • net9.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
1.4.0-preview.98-g5ab3c0c 31 3/15/2026
1.4.0-preview.97-g6b55cdc 35 3/15/2026
1.4.0-preview.96-gd4b8414 36 3/15/2026
1.4.0-preview.95-g36489cc 36 3/15/2026
1.4.0-preview.94-g95a0d96 35 3/15/2026
1.4.0-preview.93-g8d985ca 33 3/15/2026
1.4.0-preview.92-g16d5460 35 3/15/2026
1.4.0-preview.91-gdc7994e 36 3/14/2026
1.4.0-preview.90-g773c9bc 41 3/14/2026
1.4.0-preview.89-g412955a 44 3/14/2026
1.4.0-preview.88-gd4339e3 40 3/14/2026
1.4.0-preview.87-g762e834 40 3/14/2026
1.4.0-preview.86-g10fb1f6 229 12/17/2025
1.4.0-preview.85-g20398c2 223 12/17/2025
1.4.0-preview.84-g14ae0ae 225 12/17/2025
1.4.0-preview.83-g7ca4dad 219 12/17/2025
1.4.0-preview.82-gccf3c5b 236 12/17/2025
1.4.0-preview.81-ga03f733 239 12/17/2025
1.4.0-preview.80-g111a6ac 91 11/7/2025
1.3.1 323 10/26/2025
Loading failed