RecursiveAI.OneHtml 1.1.1

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

RecursiveAI.OneHtml

Parse HTML exactly as a browser does, query it, compute styles, and edit HTML and CSS without disturbing a byte the edit didn't touch. Pure C# on the .NET base class library, safe code only, NativeAOT- and trim-compatible, net10.0.

  • Encoding and parser. The WHATWG Encoding Standard (BOM, transport Content-Type, <meta> prescan) and the HTML tokenizer and tree construction, including the adoption agency algorithm, foster parenting, <template>, foreign content and fragment parsing. Parse errors are recorded as the spec says, never thrown.
  • DOM as snapshots. A Document is an immutable arena; Node is a readonly struct handle. Every node knows its byte range in the original, and parser-inserted nodes are marked.
  • Selectors Level 4 compiled for repeated use, and locators that are checked to match exactly their target.
  • CSS. CSS Syntax parsing with source maps, a property table generated from the CSS specifications, and a cascade for every known property (layers, !important, var(), shorthands, media and supports conditions) under a StyleContext that holds the viewport, media features and one focus or hover state.
  • Lossless editing. doc.Apply(edits) splices bytes only where an edit landed, re-parses the output and compares it with the expected tree, and returns a new snapshot plus a change set. Edits can be saved as versioned JSON and replayed on another copy of the page; a replay that cannot find exactly one matching target reports stale or ambiguous and never guesses.
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();

Styles under a context:

using RecursiveAI.OneHtml.Css;
Document doc = Document.Parse("<style>a { color: red } a:focus { color: blue }</style><a href=/x>x</a>");
Node link = doc.Root.QuerySelector("a");
DocumentStyles styles = DocumentStyles.Create(doc);
string normal = styles.GetStyle(link).GetPropertyValue("color");
string focused = styles.WithContext(StyleContext.Default.WithFocus(link)).GetStyle(link).GetPropertyValue("color");

The library never reads files or the network, runs no script and does no layout. Linked stylesheets are supplied by the caller. Hostile-input limits (depth, attribute count, input size, stylesheet and selector complexity) are checked before the work they guard.

More

Licensed under either of MIT or Apache-2.0 at your option. Copyright Recursive AI, LLC.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on RecursiveAI.OneHtml:

Package Downloads
RecursiveAI.OneHtml.Accessibility

The accessibility tree for OneHtml documents, computed without a browser from WAI-ARIA 1.2, HTML-AAM and AccName 1.2 with Chromium choices documented: roles, names, states, relations, reading view, navigation lists, diffs and incremental updates.

RecursiveAI.OneRender

HTML and CSS layout and rendering engine: styled nodes in, box tree, incremental layout and a retained display list out.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0 0 10/27/2026
1.3.0 0 10/27/2026
1.2.0 5 10/27/2026
1.1.1 27 10/27/2026
1.1.0 35 10/27/2026
1.0.0 52 10/26/2026