Project

HtmlTinkerX

HtmlTinkerX is a powerful async C# library for HTML, CSS, and JS processing, parsing, formatting, and optimization. It provides web content processing capabilities including browser automation, document parsing with multiple engines, resource optimization, and more. PSParseHTML is the PowerShell module exposing HtmlTinkerX to PowerShell.

Stars126
Forks19
Open issues1
ReleaseHtmlTinkerX-v2.0.7
Language: HTML Updated: 2026-03-23T22:17:20.0000000+00:00

Curated Examples

Parse and format HTML

Use HtmlTinkerX from C# to parse HTML and format markup.

This pattern is useful when a .NET application needs to turn HTML into structured data before saving, comparing, or reporting on it.

It is adapted from the quick-start patterns in the HtmlTinkerX README.

When to use this pattern

  • You need HTML table data in a .NET workflow.
  • You want consistent formatting before storing or comparing markup.
  • You prefer the C# API instead of shelling out to PowerShell.

Example

using HtmlTinkerX;

string html = await File.ReadAllTextAsync("page.html");

var tables = HtmlParser.ParseTablesWithAngleSharp(html);
string formatted = HtmlFormatter.FormatHtml(html);
string minified = HtmlOptimizer.OptimizeHtml(html);

Console.WriteLine($"Tables found: {tables.Count}");
await File.WriteAllTextAsync("page.formatted.html", formatted);
await File.WriteAllTextAsync("page.min.html", minified);

What this demonstrates

  • parsing HTML into structured table data
  • formatting markup for readable output
  • minifying the same document for compact output

Source