Istarion.Html
1.0.0-beta.1
This is a prerelease version of Istarion.Html.
dotnet add package Istarion.Html --version 1.0.0-beta.1
NuGet\Install-Package Istarion.Html -Version 1.0.0-beta.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="Istarion.Html" Version="1.0.0-beta.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Istarion.Html" Version="1.0.0-beta.1" />
<PackageReference Include="Istarion.Html" />
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 Istarion.Html --version 1.0.0-beta.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Istarion.Html, 1.0.0-beta.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 Istarion.Html@1.0.0-beta.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=Istarion.Html&version=1.0.0-beta.1&prerelease
#tool nuget:?package=Istarion.Html&version=1.0.0-beta.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Istarion.Html
A high-performance, DOM-less, low GC, streaming HTML parser and transformer library for .NET. Parse HTML via a SAX-style callback interface, decode entities, and transform HTML to formatted output or JSX (R.e("tag", props, ...)).
Features
- Streaming parser — Feed UTF-8 bytes or characters in chunks; no need to load the entire document into memory.
- SAX-style API — Implement
IHtmlHandlerto receive events: text, comments, elements (start/end), attributes, and script blocks. - HTML entity decoding — Named and numeric entities via
HtmlDecoder(e.g.&, , ). - Round-trip formatting —
HtmlFormatterwrites parsed HTML back out, preserving structure. - HTML → JSX —
JsxTransformer/JsxFormatterconvert HTML to React-style JSX:R.e("div", { "class": "x" }, "text"). - Text rules —
HtmlTextRules: known HTML5 tags, inline vs block, React-style whitespace normalization. - ASP.NET Core integration — Implements
IHtmlContent; use withHtmlEncoderandWriteTo(TextWriter, HtmlEncoder). - Stream & writer adapters —
HtmlStreamandHtmlTextWriterfor piping HTML through the parser into your handler.
Installation
dotnet add package Istarion.Html
Or in .csproj:
<PackageReference Include="Istarion.Html" Version="1.0.0" />
Requirements
- .NET 9.0 or .NET 10.0
Microsoft.AspNetCore.App(forIHtmlContentand HTML encoding)
Getting started
Parse HTML with a custom handler
using Istarion.Html;
var writer = new StringWriter();
var handler = new HtmlFormatter(writer);
var parser = new HtmlParser(handler);
parser.FeedChars("<div>Hello</div>".AsSpan(), last: true);
// or: parser.FeedBytes(utf8Bytes, last: true);
writer.ToString(); // "<div>Hello</div>"
Transform HTML to JSX
using Istarion.Html;
using Microsoft.AspNetCore.Html;
string html = @"<div class=""container""><span>Hello</span></div>";
IHtmlContent source = new HtmlString(html);
using var output = new StringWriter();
var transformer = new JsxTransformer(output);
((IHtmlContent)transformer).WriteTo(output, HtmlEncoder.Default);
// output: R.e("div", { "class": "container" }, R.e("span", null, "Hello"))
Or from a string directly:
using var sw = new StringWriter();
var transformer = new JsxTransformer(sw);
transformer.Transform("<br/>");
// R.e("br", null)
Decode HTML entities
using Istarion.Html;
string decoded = HtmlDecoder.DecodeToString("& < ".AsSpan());
// "& < \u00A0"
License
MIT. Copyright (c) 2026 Istarion Software Pty Ltd
| Product | Versions 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 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.
-
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.0.0-beta.1 | 106 | 3/16/2026 |