AdocNet.Parser
1.0.11
dotnet add package AdocNet.Parser --version 1.0.11
NuGet\Install-Package AdocNet.Parser -Version 1.0.11
<PackageReference Include="AdocNet.Parser" Version="1.0.11" />
<PackageVersion Include="AdocNet.Parser" Version="1.0.11" />
<PackageReference Include="AdocNet.Parser" />
paket add AdocNet.Parser --version 1.0.11
#r "nuget: AdocNet.Parser, 1.0.11"
#:package AdocNet.Parser@1.0.11
#addin nuget:?package=AdocNet.Parser&version=1.0.11
#tool nuget:?package=AdocNet.Parser&version=1.0.11
Adoc.Net
A pure managed C# AsciiDoc library for .NET. No external runtime dependencies.
Adoc.Net parses AsciiDoc into a typed AST and renders it to HTML5, PDF, DocBook 5.0, EPUB 3.0, man pages, or reveal.js slides. HTML rendering supports custom per-node templates via INodeTemplate. It targets both .NET 10 (optimized) and .NET Standard 2.0 (broad compatibility: .NET Framework 4.6.1+, .NET Core 2.0+, Mono, Unity, Xamarin).
Asciidoctor parity
AdocNet 1.0 produces byte-identical output to Asciidoctor for HTML, DocBook,
and Reveal.js across the full 36-document conformance corpus
(spec/conformance/*.adoc, verified via tools/parity-sweep.py). EPUB ships
the same asset payload as asciidoctor-epub3 (fonts, stylesheets, default
images) with a dedicated chapter renderer emitting the reference's semantic
HTML5; readers see indistinguishable output. Man output is cleaner roff than
the reference while remaining structurally equivalent. See CHANGELOG.md for
the v1.0 parity arc.
| Format | Per-doc diff (sum, 36-doc corpus) | Perfect-match docs |
|---|---|---|
| HTML | 0 | 36/36 ✓ |
| DocBook | 0 | 36/36 ✓ |
| Reveal.js (slide DOM) | 0 | 36/36 ✓ |
| Man | 5,510 (stylistic roff) | 11/36 |
| EPUB | 87 (small structural residuals) | 0/36, visually indistinguishable |
Installation
dotnet add package AdocNet
For the CLI tools:
dotnet tool install --global AdocNet.Tool # adocnet (HTML default)
dotnet tool install --global AdocNet.Pdf # adocnet-pdf
dotnet tool install --global AdocNet.Epub # adocnet-epub
dotnet tool install --global AdocNet.DocBook # adocnet-docbook
Quick Start
using AdocNet;
// One line — that's it
string html = Adoc.ToHtml("= Hello\n\nThis is *bold* text.");
More control
// Styled full HTML document with CSS theme
string page = Adoc.ToStyledHtml(source, HtmlTheme.Asciidoctor);
// PDF output
byte[] pdf = Adoc.ToPdf(source);
// Write directly to a stream (no intermediate string)
using var file = File.Create("output.html");
Adoc.ToHtml(source, file);
// Convert a file with include resolution
Adoc.ConvertFile("docs/chapter.adoc", file);
// Parse with diagnostics
var result = Adoc.Parse(source);
if (result.HasErrors)
foreach (var d in result.Diagnostics) Console.WriteLine(d);
Full API (when you need options)
using AdocNet.Parser;
using AdocNet.Converters.Html;
var result = AdocParser.Parse(source, new ParseOptions
{
SourceFilePath = "docs/chapter.adoc", // enables include resolution
Attributes = new Dictionary<string, string> { ["version"] = "2.0" },
});
var html = new HtmlRenderer().RenderToString(result.Document,
new HtmlRenderOptions { Theme = HtmlTheme.Asciidoctor });
Render to PDF
using AdocNet.Converters.Pdf;
byte[] pdf = new PdfRenderer().RenderToBytes(result.Document);
File.WriteAllBytes("output.pdf", pdf);
Render to DocBook
using AdocNet.Converters.DocBook;
string xml = new DocBookRenderer().RenderToString(result.Document);
Render to EPUB
using AdocNet.Converters.Epub;
byte[] epub = new EpubRenderer().RenderToBytes(result.Document);
File.WriteAllBytes("output.epub", epub);
Parse with includes
var text = File.ReadAllText("book.adoc");
var result = AdocParser.Parse(text, new ParseOptions
{
SourceFilePath = "book.adoc",
});
Check for errors
if (result.HasErrors)
{
foreach (var diag in result.Diagnostics.Where(d => d.IsError))
Console.Error.WriteLine(diag);
}
CLI Tools
# General-purpose (default: HTML)
adocnet input.adoc # → input.html
adocnet input.adoc -b pdf # → input.pdf
adocnet input.adoc -o - # → stdout
# Specialized tools (same flags, different default format)
adocnet-pdf input.adoc # → input.pdf
adocnet-epub input.adoc # → input.epub
adocnet-docbook input.adoc # → input.xml
# Common options (all tools)
adocnet input.adoc -o custom.html # explicit output file
adocnet input.adoc -a version=2.0 # set document attribute
adocnet docs/ -r -D build/ # convert directory
adocnet docs/ --watch -v # watch and rebuild
adocnet preview input.adoc # live preview with hot reload
# Built-in HTML themes (require -e for full document with embedded CSS)
adocnet input.adoc -e --theme default # AdocNet's bold, modern default
adocnet input.adoc -e --theme asciidoctor # iconic Asciidoctor red-on-cream look
adocnet input.adoc -e --theme clean # minimal monochrome
adocnet input.adoc -e --theme github # GitHub-flavoured markdown style
The --theme asciidoctor option is for users migrating from Asciidoctor
who want their HTML output to look familiar — it reproduces the iconic
red section headings, serif body, and centered layout.
See docs/CLI.md for the full reference.
Supported AsciiDoc Features
Block-level
| Feature | Status |
|---|---|
| Document title, author, revision | Supported |
Section headings (==/## through ======/######) |
Supported |
| Paragraphs | Supported |
| Unordered, ordered, description (Q&A, horizontal), and nested lists | Supported |
| Checklists | Supported |
| Tables (header/footer, column specs, spans, alignment, cell styles) | Supported |
| Source blocks with language and callouts | Supported |
Markdown fenced code blocks (``` with optional language) |
Supported |
| Listing, literal, example, open, sidebar, verse, quote blocks | Supported |
Markdown-compatible blockquotes (> prefix) |
Supported |
| Admonitions (NOTE, TIP, WARNING, IMPORTANT, CAUTION) | Supported |
| Include directives (files, partial includes, leveloffset, indent) | Supported |
| Conditional directives (ifdef, ifndef, ifeval) | Supported |
Document attributes (:name: value, line continuation with \) |
Supported |
Conditional attribute substitution ({foo?yes}, {foo!no}) |
Supported |
Table of contents (:toc:, toc::[] macro placement) |
Supported |
Book doctype section styles ([appendix], [glossary], etc.) |
Supported |
| Book doctype parts (level-0 sections as "Part I", "Part II") | Supported |
| Block images, video, audio macros | Supported |
| Anchors, cross-references, inter-document xrefs | Supported |
| Footnotes with back-references | Supported |
| Bibliography sections | Supported |
| Page breaks, horizontal rules | Supported |
Inline
| Feature | Status |
|---|---|
| Bold, italic, monospace, highlight | Supported |
Nested formatting (*_bold italic_*) |
Supported |
| Bare URLs, link macros, email links | Supported |
| Image macros | Supported |
Attribute references ({name}) |
Supported |
Passthrough (+text+, pass:[text]) |
Supported |
Cross-references (<<id>>) |
Supported |
| Footnotes | Supported |
Superscript (^text^), subscript (~text~) |
Supported |
| Smart punctuation (em/en dash, ellipsis, curly quotes) | Supported |
Inline macros (kbd:[], btn:[], menu:[]) |
Supported |
Rendering Features
| Feature | HTML | |
|---|---|---|
| Built-in themes (Default, Asciidoctor, Clean, Github) | 4 themes | Style presets |
| Syntax highlighting (C#, Java, JS, Python, JSON, XML, SQL) | Server-side <span> classes |
Per-token color operators |
| Hyphenation (English, Liang/Knuth algorithm) | N/A (browser CSS) | Enabled via option |
| Custom styling | Custom CSS override | Color/spacing properties |
| TrueType font embedding with Unicode | N/A | Full Unicode support |
Processing Extensions
| Feature | Status |
|---|---|
Document processors (IDocumentProcessor) |
Supported |
Block processors (IBlockProcessor) |
Supported |
Inline processors (IInlineProcessor) |
Supported |
| Diagram blocks (PlantUML, Mermaid, Ditaa, Graphviz) | Supported (external tool) |
Node replacement and removal (NodeReplacements) |
Supported |
Warning callback (OnWarning) |
Supported |
Dynamic extension loading (LoadExtension, --extensions) |
Supported |
Extension packaging (ext install, ext list, ext remove) |
Supported |
Extension registry (ext info, ext search, dependency validation) |
Supported |
Extension safety (ext status, failure disabling, API version) |
Supported |
Output processors (IOutputProcessor, post-render transforms) |
Supported |
| Kroki diagram runner (HTTP-based, no local tools needed) | Supported |
Extension lifecycle (IExtensionLifecycle) |
Supported |
Extension enable/disable (ext enable, ext disable) |
Supported |
Zip-based extension install (ext install myext.zip) |
Supported |
Extension diagnostics (RenderContext.AddDiagnostic) |
Supported |
Extension capabilities (IExtensionCapabilities, determinism declaration) |
Supported |
Extension priority (IExtensionPriority, execution ordering) |
Supported |
Max engine version (maxAdocNetVersion in manifest) |
Supported |
| bool Process() return with short-circuiting | Supported |
| AssemblyLoadContext isolation (net6.0+) | Supported |
Extension hot-reload (EnableHotReload, FileSystemWatcher) |
Supported |
| Dependency-ordered loading (topological sort) | Supported |
Extension signing verification (publicKeyToken) |
Supported |
Extension validation tool (ext validate) |
Supported |
Performance
| Feature | Status |
|---|---|
| Parse cache (SHA-256 keyed LRU) | Supported |
| Render cache (composite key, deterministic extensions only) | Supported |
| Persistent cache (disk-based, cross-session render cache) | Supported |
Editor Integration
| Feature | Status |
|---|---|
| DocumentChange model for incremental edits | Supported |
| DocumentSnapshot versioned document state | Supported |
Cache-aware incremental re-parse (ParseIncremental) |
Supported |
AST structural hashing (StructuralHash) |
Supported |
Section-level tree diff (AstDiffer) |
Supported |
Incremental HTML rendering (IncrementalHtmlRenderer) |
Supported |
| Extension diagnostics after Convert() | Supported |
Collapsible blocks ([%collapsible] with <details>/<summary>) |
Supported |
Data URI embedding (:data-uri: for inline base64 images) |
Supported |
Font Awesome CSS injection (:icons: font) |
Supported |
Docinfo injection (:docinfo: header/footer files) |
Supported |
| Safe modes (Unsafe, Safe, Server, Secure) | Supported |
STEM/Math (MathJax, stem:[], latexmath:[], asciimath:[]) |
Supported |
Rendering attributes: :sectanchors:, :sectlinks:, :hide-uri-scheme: |
Supported |
Rendering attributes: :source-language:, :linkattrs:, :webfonts: |
Supported |
Rendering attributes: :nofooter:, :nofootnotes:, :notitle:, :last-update-label: |
Supported |
YAML front matter stripping (:skip-front-matter:, stored as :front-matter: attribute) |
Supported |
CSS delivery attributes: :stylesheet:, :linkcss:, :stylesdir: |
Supported |
$$...$$ stem delimiters (block and inline, scoped to :stem:) |
Supported |
:max-include-depth: document attribute (document-level cap, capped at API maximum) |
Supported |
Architecture
Eleven assemblies, each with a single responsibility:
| Assembly | Namespace | Description |
|---|---|---|
| AdocNet.Ast | AdocNet.Ast |
Typed AST node classes |
| AdocNet.Core | AdocNet |
Diagnostics, options, renderer framework |
| AdocNet.Parser | AdocNet.Parser |
Block and inline parsing |
| AdocNet.Converters.Html | AdocNet.Converters.Html |
HTML5 renderer with themes |
| AdocNet.Converters.Pdf | AdocNet.Converters.Pdf |
Pure managed PDF 1.4 renderer with TrueType font embedding and Unicode support |
| AdocNet.Converters.DocBook | AdocNet.Converters.DocBook |
DocBook 5.0 renderer |
| AdocNet.Converters.Epub | AdocNet.Converters.Epub |
EPUB 3.0 renderer |
| AdocNet.Converters.Man | AdocNet.Converters.Man |
Man page (roff) renderer |
| AdocNet.Converters.Revealjs | AdocNet.Converters.Revealjs |
Reveal.js slides renderer |
| AdocNet.Layout | AdocNet.Layout |
UI-agnostic layout model and AST-to-layout builder |
| AdocNet.Avalonia | AdocNet.Avalonia |
Avalonia UI renderer (layout tree to controls) |
The data flow for the Avalonia viewer is strictly layered: AST → Layout → Avalonia. The Layout library has zero UI dependencies and targets netstandard2.0, making it consumable by any .NET UI framework.
Documentation
| Guide | Description |
|---|---|
| USAGE.md | Library usage, parsing, rendering workflows |
| CLI.md | CLI reference and examples |
| RENDERERS.md | Renderer guide (HTML, PDF, DocBook, EPUB) |
| PDF_RENDERER.md | PDF renderer: fonts, images, links, tables, configuration |
| EXTENSIONS.md | Processing extensions, custom renderers, and include readers |
| DYNAMIC_EXTENSIONS.md | Loading extensions from external DLLs at runtime |
| EXTENSION_PACKAGING.md | Extension packaging, installation, and automatic loading |
| EXTENSION_REGISTRY.md | Extension registry, search, and dependency validation |
| EXTENSION_SAFETY.md | Extension safety: failure disabling, API version, structured loading |
| PERFORMANCE.md | Performance caching: parse cache, render cache, configuration |
| EDITOR_INTEGRATION.md | Editor APIs: DocumentChange, DocumentSnapshot, ParseIncremental |
| INCREMENTAL_RENDERING.md | Incremental rendering: structural hashing, tree diff, HTML splicing |
| DIAGRAMS.md | Diagram block processing with external tools |
| COMPATIBILITY.md | Asciidoctor conformance and known differences |
| SECURITY.md | Security considerations for untrusted input |
Performance
AdocNet is a native managed library with no interpreter startup, so it's significantly faster than Asciidoctor (Ruby) for typical workloads. Preliminary measurements on the 36-document conformance corpus show 15-25× speedup for HTML rendering on warm JIT. To benchmark on your hardware:
dotnet run -c Release --project benchmarks/AdocNet.Benchmarks
Concrete numbers (with BenchmarkDotNet methodology, percentile breakdowns, allocation counts) will be published in a follow-up release.
Migrating from Asciidoctor
For users moving from the Asciidoctor (Ruby) toolchain, the
docs/MIGRATION-FROM-ASCIIDOCTOR.md guide covers CLI flag mapping,
parity matrix per format, intentional differences (e.g. CDN vs local
paths for reveal.js assets), and known out-of-scope features.
Building
dotnet build
dotnet test
Target Frameworks
All core libraries target netstandard2.0 and net10.0. The CLI and LSP server target net10.0 only.
| Consumer | Resolved TFM |
|---|---|
| .NET Framework 4.6.1+ | netstandard2.0 |
| .NET Core 2.0+ | netstandard2.0 |
| .NET 5-9 | netstandard2.0 |
| .NET 10+ | net10.0 (optimized) |
License
MIT
| 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 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. 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. |
| .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
- AdocNet.Ast (>= 1.0.11)
- AdocNet.Core (>= 1.0.11)
-
net10.0
- AdocNet.Ast (>= 1.0.11)
- AdocNet.Core (>= 1.0.11)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on AdocNet.Parser:
| Package | Downloads |
|---|---|
|
AdocNet.Converters.Html
HTML5 renderer for the Adoc.Net library. |
|
|
AdocNet.Converters.DocBook
DocBook 5.0 renderer for the Adoc.Net library. |
|
|
AdocNet
Pure .NET AsciiDoc parser, HTML and PDF renderer. No external dependencies. |
|
|
AdocNet.Converters.Man
Man page (roff) renderer for the Adoc.Net library. |
|
|
AdocNet.Converters.Revealjs
Reveal.js slides renderer for the Adoc.Net library. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.11 | 10 | 6/4/2026 |
| 1.0.10 | 74 | 6/3/2026 |
| 1.0.9 | 315 | 6/1/2026 |
| 1.0.8 | 358 | 5/22/2026 |
| 1.0.6 | 355 | 5/22/2026 |
| 1.0.5 | 349 | 5/19/2026 |
| 1.0.4 | 336 | 5/19/2026 |
| 1.0.3 | 354 | 5/19/2026 |
| 1.0.2 | 348 | 5/18/2026 |
| 1.0.1 | 342 | 5/18/2026 |
| 1.0.0 | 341 | 5/17/2026 |
| 1.0.0-beta.26 | 66 | 4/21/2026 |
| 1.0.0-beta.25 | 62 | 4/19/2026 |
| 1.0.0-beta.24 | 63 | 4/15/2026 |
| 1.0.0-beta.22 | 65 | 4/15/2026 |
| 1.0.0-beta.20 | 65 | 4/13/2026 |
| 1.0.0-beta.19 | 60 | 4/13/2026 |
| 1.0.0-beta.18 | 62 | 4/12/2026 |
| 1.0.0-beta.17 | 64 | 4/12/2026 |
| 1.0.0-beta.16 | 60 | 4/10/2026 |
v1.0.11: Table parser correctly reserves rowspan columns in following rows (#41). A `.N+|` rowspan in a non-last column was not reserving its column in the rows it spanned, so the parser over-filled those rows — collapsing several source rows into fewer AST rows and, with overlapping rowspans, dropping trailing cells entirely. The row-grouping loop now skips trailing columns held by active rowspans before closing a row, so each source row consumes exactly the free-column count. Every backend (HTML, Avalonia, PDF) inherits the corrected structure. See CHANGELOG.md.