JNIsolutions.Net.HTMLlib 1.3.0.1

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

JNI Solutions HTML Library

A .NET library written in C# for programmatically generating and parsing HTML documents. The library provides a strongly-typed class for each supported HTML tag, making it easy to build well-structured HTML output without writing raw markup.

Features

  • Create complete HTML documents programmatically
  • Strongly-typed classes for all commonly used HTML tags
  • Parse existing HTML documents back into an object model
  • Full support for global HTML attributes and event attributes on every element
  • Multi-target: runs on .NET Framework 4.8 and modern .NET

Supported .NET Versions

Platform Versions
.NET Framework 4.8
.NET 6.0, 8.0, 10.0

Note: .NET Framework 4.8 is supported on Windows only. .NET 6.0, 8.0, and 10.0 are supported on Windows, Linux, and macOS.

Supported HTML Tags

Document Structure

Class HTML Tag Description
HTMLDocument (full document) Represents a complete HTML document including <html>, <head>, and <body>
HTMLHeadElement <head> Document head container — holds metadata tags
HTMLBodyElement <body> Document body container — holds visible content

Metadata & Head Elements

Class HTML Tag Description
Base <base> Specifies a base URL and/or target for all relative links in the page
Link <link> Links external resources such as stylesheets
Meta <meta> Defines metadata such as charset, viewport, and Open Graph tags
Style <style> Embeds an internal CSS style block
Title <title> Sets the document title shown in the browser tab

Sectioning & Grouping

Class HTML Tag Description
BlockQuote <blockquote> A section quoted from another source
Div <div> Generic block-level container
Hgroup <hgroup> Groups a heading with related content such as a subheading
Nav <nav> A section of navigation links
NoScript <noscript> Fallback content rendered when scripting is disabled

Headings

Class HTML Tag Description
Heading <h1> – <h6> Section headings — level 1 (most important) to level 6

Text Content

Class HTML Tag Description
Address <a> Hyperlink (anchor tag)
Abbr <abbr> Abbreviation or acronym with an expanded title
Para <p> Paragraph
Pre <pre> Preformatted text, preserving whitespace and line breaks
Text (text node) Plain text content — no surrounding tag

Inline Text Formatting

Class HTML Tag Description
Bold <b> Bold text
Emphasis <em> Emphasised (italic) text
Italic <i> Italic text
SpanT <span> Generic inline container
Strong <strong> Strong importance (bold) text

Lists

Class HTML Tag Description
DD <dd> Description / definition in a definition list
DL <dl> Definition list
DT <dt> Term in a definition list
LI <li> List item in an ordered or unordered list
OL <ol> Ordered (numbered) list
UL <ul> Unordered (bulleted) list

Tables

Class HTML Tag Description
Caption <caption> Table caption
Col <col> Column properties within a <colgroup>
ColGroup <colgroup> Group of columns in a table
DataCell <td> Table data cell
HeaderCell <th> Table header cell
Table <table> Table
TableRow <tr> Table row
Tbody <tbody> Table body section
Tfoot <tfoot> Table footer section
Thead <thead> Table header section

Embedded Content

Class HTML Tag Description
Iframe <iframe> Inline frame embedding another HTML page
Image <img> Embeds an image
Object <object> Embeds external content such as a plugin or media file
Param <param> Parameter for an <object> element

Forms

Class HTML Tag Description
Button <button> Clickable button

Scripting

Class HTML Tag Description
Script <script> Embeds or references client-side JavaScript

Other

Class HTML Tag Description
BR <br> Line break
Comment `` HTML comment
HR <hr> Thematic break (horizontal rule)

CSS Helpers

Class Description
CSSdeclaration Represents a single CSS property-value pair
CSSselector Represents a complete CSS rule (selector + declarations)

Getting Started

Installation

Install via NuGet:

dotnet add package JNIsolutions.Net.HTMLlib

Example

using JNIsolutions.Net.HTMLlib;
using System.Globalization;

// Create a new HTML document
HTMLDocument document = new HTMLDocument
{
    Lang = CultureInfo.CurrentUICulture
};

// Add head elements
document.Head.Tags.Add(new Meta { Name = "viewport", Content = "width=device-width, initial-scale=1" });
document.Head.Tags.Add(new Title("My Page"));
document.Head.Tags.Add(new Link
{
    Rel  = "stylesheet",
    Href = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
});

// Add body content
Hgroup hgroup = new Hgroup();
hgroup.Keywords.Add(new Heading("Welcome", 1));
hgroup.Keywords.Add(new Para("Hello, world!"));
document.Body.Tags.Add(hgroup);

// Build a table
Table table = new Table();
table.Keywords.Add(new Caption("People"));

Thead thead = new Thead();
TableRow headerRow = new TableRow();
headerRow.Keywords.Add(new HeaderCell("Name"));
headerRow.Keywords.Add(new HeaderCell("Age"));
thead.Keywords.Add(headerRow);
table.Keywords.Add(thead);

Tbody tbody = new Tbody();
TableRow dataRow = new TableRow();
dataRow.Keywords.Add(new DataCell("Alice"));
dataRow.Keywords.Add(new DataCell("30"));
tbody.Keywords.Add(dataRow);
table.Keywords.Add(tbody);

document.Body.Tags.Add(table);

// Render to HTML string
string html = document.ToString();
Console.WriteLine(html);

Parsing HTML

The library can also parse an existing HTML string back into an object model:

string existingHtml = File.ReadAllText("page.html");
HTMLDocument parsed = new HTMLDocument().Parse(existingHtml);
Console.WriteLine(parsed.ToString());

License

This project is licensed under the BSD 4-Clause License. See LICENSE.txt for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.
  • net10.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.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.3.0.1 112 5/23/2026
1.3.0 107 5/23/2026
1.2.0 114 5/23/2026
1.1.8 170 11/9/2025
1.1.6 202 10/21/2025
1.1.5 184 10/21/2025
1.1.4 220 8/8/2024
1.1.3 140 7/29/2024
1.1.2 184 7/17/2024
1.1.1 189 7/17/2024

At this stage not all HTML tags are implemented, but the commonly used ones are available. Future versions will progressively implement more tags.