CodeBrix.MarkupParse.MitLicenseForever 1.0.248.1160

dotnet add package CodeBrix.MarkupParse.MitLicenseForever --version 1.0.248.1160
                    
NuGet\Install-Package CodeBrix.MarkupParse.MitLicenseForever -Version 1.0.248.1160
                    
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="CodeBrix.MarkupParse.MitLicenseForever" Version="1.0.248.1160" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeBrix.MarkupParse.MitLicenseForever" Version="1.0.248.1160" />
                    
Directory.Packages.props
<PackageReference Include="CodeBrix.MarkupParse.MitLicenseForever" />
                    
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 CodeBrix.MarkupParse.MitLicenseForever --version 1.0.248.1160
                    
#r "nuget: CodeBrix.MarkupParse.MitLicenseForever, 1.0.248.1160"
                    
#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 CodeBrix.MarkupParse.MitLicenseForever@1.0.248.1160
                    
#: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=CodeBrix.MarkupParse.MitLicenseForever&version=1.0.248.1160
                    
Install as a Cake Addin
#tool nuget:?package=CodeBrix.MarkupParse.MitLicenseForever&version=1.0.248.1160
                    
Install as a Cake Tool

CodeBrix.MarkupParse

A fully managed, cross-platform HTML/markup parsing library for .NET. CodeBrix.MarkupParse has no dependencies other than .NET, and is provided as a .NET 10 library and associated CodeBrix.MarkupParse.MitLicenseForever NuGet package.

CodeBrix.MarkupParse supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.

Installation

dotnet add package CodeBrix.MarkupParse.MitLicenseForever

Note that the NuGet package ID and the namespace are different - there is no package named plain CodeBrix.MarkupParse:

  • NuGet package ID: CodeBrix.MarkupParse.MitLicenseForever
  • Assembly and root namespace: CodeBrix.MarkupParse

The type you start from, HtmlParser, lives in CodeBrix.MarkupParse.Html.Parser; Configuration and BrowsingContext, used for loading documents over HTTP, live in the root CodeBrix.MarkupParse namespace. The package has no NuGet dependencies and no native libraries, and runs anywhere .NET 10 runs. XML documentation (IntelliSense) ships alongside the assembly.

CodeBrix.MarkupParse supports:

  • HTML parsing and DOM construction
  • CSS selector queries (QuerySelector, QuerySelectorAll)
  • Document manipulation (create, append, remove elements)
  • HTML serialization (OuterHtml, InnerHtml, TextContent)
  • Markup formatting (standard, pretty-print, minified, XHTML)
  • Fragment parsing
  • Source position tracking
  • Asynchronous document loading and parsing
  • SVG and MathML element support
  • Form handling and validation
  • Many more...

CodeBrix.MarkupParse parses and manipulates HTML; it does not render, style or execute it. There is no layout or box model, no getComputedStyle, and <script> content is treated as text and never run. It parses CSS selectors for querying but does not parse or evaluate CSS stylesheets - the sibling CodeBrix.StyleSheetParse.MitLicenseForever package covers that. It is also not an XML parser, not a general-purpose HTTP client, and - importantly - not an HTML sanitizer: there is no allow-list scrubber, so parsing untrusted markup and re-serializing it is not a security boundary.

Sample Code

Parse an HTML String

using CodeBrix.MarkupParse.Html.Parser;

var parser = new HtmlParser();
var document = parser.ParseDocument("<h1>Hello World</h1><p>This is a paragraph element");

Console.WriteLine(document.DocumentElement.OuterHtml);

Query Elements with CSS Selectors

using CodeBrix.MarkupParse.Html.Parser;
using System.Linq;

var parser = new HtmlParser();
var document = parser.ParseDocument(
    "<ul><li>First item<li>Second item<li class='blue'>Third item!<li class='blue red'>Last item!</ul>");

// Use CSS selectors to find elements
var blueItems = document.QuerySelectorAll("li.blue");
var titles = blueItems.Select(m => m.TextContent);

Manipulate the DOM

using CodeBrix.MarkupParse.Html.Parser;

var parser = new HtmlParser();
var document = parser.ParseDocument("<h1>Some example source</h1><p>This is a paragraph element");

var p = document.CreateElement("p");
p.TextContent = "This is another paragraph.";
document.Body.AppendChild(p);

Console.WriteLine(document.DocumentElement.OuterHtml);

Track Source Positions

using CodeBrix.MarkupParse.Html.Parser;

var parser = new HtmlParser(new HtmlParserOptions
{
    IsKeepingSourceReferences = true,
});
var document = parser.ParseDocument("<!doctype html><body>");
var bodyPos = document.Body.SourceReference.Position;
// bodyPos == TextPosition(Line: 1, Column: 16, Position: 16)

Load a Document from a URL

using CodeBrix.MarkupParse;
using System.Linq;

var config = Configuration.Default.WithDefaultLoader();
var address = "https://en.wikipedia.org/wiki/List_of_The_Big_Bang_Theory_episodes";
var document = await BrowsingContext.New(config).OpenAsync(address);

var cells = document.QuerySelectorAll("tr.vevent td:nth-child(3)");
var titles = cells.Select(m => m.TextContent);

Documentation

The NuGet package includes AGENT-README.txt, a complete API reference and usage guide written for AI coding agents - point your agent at that file when it is writing code against this library.

Additional sample code and usage examples are available in the CodeBrix.MarkupParse.Tests project: https://github.com/ellisnet/CodeBrix.MarkupParse/tree/main/tests/CodeBrix.MarkupParse.Tests

License

CodeBrix.MarkupParse is licensed under the MIT License - see the LICENSE file.

For licensing and provenance information about the open source code included in this package, see THIRD-PARTY-NOTICES.txt.

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 (1)

Showing the top 1 NuGet packages that depend on CodeBrix.MarkupParse.MitLicenseForever:

Package Downloads
CodeBrix.PdfDocCreate.Html2Pdf.MitLicenseForever

Turns HTML pages, including their CSS styling and images, into PDF documents. Output looks the same on Windows, macOS, and Linux, since nothing else on the machine is needed to produce it. Supports inline styles, style blocks, and linked stylesheets, and embeds any images or SVG graphics used on the page.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.248.1160 198 9/5/2026
1.0.238.561 220 8/26/2026
1.0.164.1248 237 6/13/2026
1.0.117 145 4/29/2026
1.0.100 133 4/11/2026