Xml2Doc.Core
2.0.0
See the version list below for details.
dotnet add package Xml2Doc.Core --version 2.0.0
NuGet\Install-Package Xml2Doc.Core -Version 2.0.0
<PackageReference Include="Xml2Doc.Core" Version="2.0.0" />
<PackageVersion Include="Xml2Doc.Core" Version="2.0.0" />
<PackageReference Include="Xml2Doc.Core" />
paket add Xml2Doc.Core --version 2.0.0
#r "nuget: Xml2Doc.Core, 2.0.0"
#:package Xml2Doc.Core@2.0.0
#addin nuget:?package=Xml2Doc.Core&version=2.0.0
#tool nuget:?package=Xml2Doc.Core&version=2.0.0
Xml2Doc.Core
Core library for the Xml2Doc toolset (part of mod-posh). Now multi-targeted and verified for consistent output across modern .NET TFMs.
Overview
Xml2Doc.Core is the engine behind the Xml2Doc CLI and MSBuild task. It parses XML doc comments, resolves references, and renders clean, linkable Markdown—either one file per type or a single combined document.
Features
- Parses common XML doc elements:
<summary>,<remarks>,<example>,<seealso>,<exception>,<inheritdoc/>. - Converts
<see>,<paramref>into inline Markdown links and code spans. - Cleans namespaces and shortens generics (
List<T>vsSystem.Collections.Generic.List<T>). - Built-in type aliasing (
System.String→string, etc.) without breaking identifiers (StringComparerremains intact). - Overload grouping for cleaner member sections.
- Two output modes:
- Per-type (
RenderToDirectory) →TypeName.mdwith in-file member anchors. - Single-file (
RenderToSingleFile/RenderToString) → one Markdown with headings + explicit anchors.
- Per-type (
- Stable, explicit anchors for members; GitHub-style heading slugs for types (single-file).
- Depth-aware generic formatting (correctly renders nested generics).
- Paragraph- and code-block–preserving normalization.
- Configuration via
RendererOptions:- Filename mode:
VerbatimorCleanGenerics RootNamespaceToTrim(display-only trimming)- Code block language (default
csharp) - Per-type
index.mdgeneration (GenerateIndex, defaulttrue) - Markdown line endings (
Lfdefault,CrLf, orNative) - Output mode (single vs. multi-file)
- Filename mode:
Supported Target Frameworks
Shipped TFMs:
netstandard2.0— broad library reachnet8.0net9.0
Guarantee: Default Markdown output is deterministic and equivalent across these TFMs and hosts, including LF line endings. We test cross-TFM output directly without relying on post-render newline normalization.
Language-version notes
netstandard2.0: Source uses C# 10 syntax (file-scoped namespaces/global usings) but avoids runtime-only APIs not present in NS2.0. Where needed, we use compatibility shims and alternate overloads (e.g., preferstring.Split(char, StringSplitOptions)and avoidIndex/Rangein hot paths).net8.0/net9.0: SDK defaults.
Behavior Guarantees Across TFMs
- Anchors/slugs: Identical across TFMs and modes.
- Linking: Member
creftargets resolve to owning type pages (per-type) or in-document anchors (single-file). - Formatting: Built-in aliases, generic labels, paragraph and code-block handling match exactly.
Compatibility (netstandard2.0)
To keep netstandard2.0 first-class:
- Removed reliance on APIs absent in NS2.0 (
AsSpan,Range/Index, certainSplitoverloads). - Added targeted nullability guards where analyzers flagged potential issues (no behavior changes).
- Kept rendering logic identical to newer TFMs.
Anchors & Link Behavior
Per-type (
RenderToDirectory)- Types render to
*.mdfiles (filename strategy controlled byFileNameMode). - Members link to anchors inside the type file (e.g.,
Type.md#member-anchor).
- Types render to
Single-file (
RenderToSingleFile/RenderToString)- Types get heading-based slugs (GitHub-style).
- Members get explicit anchors in the combined document.
Example
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);
// Per-type output
renderer.RenderToDirectory("./docs");
// Single-file output
renderer.RenderToSingleFile("./docs/api.md");
Tests & Snapshots
- Snapshot tests assert stable Markdown for representative inputs.
- Cross-TFM test renders via CLI for
net8.0andnet9.0and compares outputs (with EOL normalization). - A Windows-only, opt-in check ensures the MSBuild task graph stays healthy (especially P2P TFM mapping).
Related Work / Issues
- #33 — Multi-framework support: Core (
netstandard2.0;net8.0;net9.0), CLI (net8.0;net9.0), MSBuild task (net472;net8.0). - #46 —
netstandard2.0compatibility: removedIndex/Rangeusages, updatedSplitusage, and added nullability guards.
Maintenance & Support
- Tracks current .NET (e.g.,
net8.0,net9.0) while keepingnetstandard2.0for broad compatibility. - If you notice any cross-TFM drift in output, please open an issue with a minimal XML sample plus expected vs. actual Markdown.
| Product | Versions 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 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 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. |
| .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. |
-
.NETStandard 2.0
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
- System.Numerics.Vectors (>= 4.5.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Text.Encodings.Web (>= 8.0.0)
- System.Text.Json (>= 8.0.5)
-
net8.0
- No dependencies.
-
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 |
|---|---|---|
| 2.3.0 | 89 | 8/17/2026 |
| 2.2.0 | 85 | 8/17/2026 |
| 2.1.0 | 96 | 8/16/2026 |
| 2.0.3 | 83 | 8/15/2026 |
| 2.0.2 | 94 | 8/14/2026 |
| 2.0.1 | 96 | 8/14/2026 |
| 2.0.0 | 82 | 8/13/2026 |
| 2.0.0-preview.113-g69c1a44 | 49 | 8/13/2026 |
| 1.4.0 | 90 | 8/13/2026 |
| 1.4.0-preview.111-g7a5369b | 55 | 8/13/2026 |
| 1.4.0-preview.110-g1edd8f0 | 56 | 8/13/2026 |
| 1.4.0-preview.109-g42abc6e | 61 | 8/13/2026 |
| 1.4.0-preview.108-g611e3f5 | 52 | 8/13/2026 |
| 1.4.0-preview.107-gc4dc99b | 51 | 8/13/2026 |
| 1.4.0-preview.106-gffe4bab | 48 | 8/13/2026 |
| 1.4.0-preview.105-gd9e6cf3 | 50 | 8/13/2026 |
| 1.4.0-preview.104-gfa11148 | 52 | 8/13/2026 |
| 1.4.0-preview.103-gc413f43 | 50 | 8/13/2026 |
| 1.4.0-preview.102-g7ed4c9f | 59 | 8/13/2026 |
| 1.4.0-preview.101-g1fbacd3 | 63 | 8/1/2026 |