Recursive AI
LibraryC#Available

onehtml

HTML and CSS for .NET, in pure C#. Parse HTML the way a browser does, edit it without disturbing a byte the edit didn’t touch, and check pages for accessibility without a browser.

dotnet add package RecursiveAI.OneHtml

A quick look

Parse, query and edit. An edit changes only the bytes it touches, the result is re-parsed and verified, and the old snapshot stays valid.

How editing works
Program.csC#
using RecursiveAI.OneHtml;
using RecursiveAI.OneHtml.Editing;
Document doc = Document.Parse("<p>Hello <a href=/x>world</a>");
Node link = doc.Root.QuerySelector("a[href]");
EditResult edit = doc.Apply(new[] { Edit.SetAttribute(link, "title", "A link") });
byte[] output = edit.Document!.ToLosslessBytes();
What it does

What it does

Parses like a browser

The WHATWG parser: encoding sniffing, the tokenizer and every insertion mode. It passes the html5lib tokenizer and tree-construction tests.

Edits that leave the rest alone

Lossless editing of HTML, inline styles and stylesheets. Untouched bytes stay identical, and every result is re-parsed and verified.

The accessibility tree Chromium exposes

WAI-ARIA 1.2, HTML-AAM and AccName 1.2, with Chromium’s choices written down. A reading view and navigation lists show what a screen-reader user meets.

Accessibility checks without a browser

One rule catalogue covering the WCAG success criteria, suggested edits where exactly one fix exists, and axe-compatible and SARIF 2.1.0 output.

Performance

2.74× AngleSharp’s parsing speed

Parsing a 100-page sample of a crawled corpus from bytes, end to end, takes 125.0 ms per sweep, against 341.7 ms for AngleSharp 1.8.6 and 292.8 ms for HtmlAgilityPack 1.13.1. Measured with BenchmarkDotNet on .NET 10.

The method and harness

The packages

Go further