AngleSharp – A .NET HTML Parser That Became a Foundation for Many Projects
说明与用途
AngleSharp 是一个 .NET 库,提供标准化的 HTML、CSS、SVG 和 XML 解析。它最初是一次在飞机上写的副项目,后来发展成为许多应用的基础组件,例如 HtmlSanitizer、bUnit 和 PreMailer.Net,累计下载量超过 5 亿。
问题
Developers needed a standards‑conformant HTML/CSS/JS parser in .NET that could be used for scraping, testing, sanitizing, and rendering without a browser.
结果
AngleSharp grew from a side‑project written on a plane to a widely adopted .NET foundation library with over 500 million installs, powering HTML sanitization, Blazor testing, email rendering, and many commercial applications.
工作流
- 1. Install AngleSharp via NuGet.
- 2. Create an HtmlParser or BrowsingContext.
- 3. Parse markup or load documents from the network.
- 4. Query the DOM with standard selectors.
- 5. Extend functionality with satellite packages (Css, Js, Xml, Diffing).
证据
AngleSharp is a .NET library that parses HTML, SVG, MathML, CSS, and (to a good extent) XML, and gives you back a fully-featured, spec-conformant DOM.
The core package alone sits at over 310 million downloads, with satellite packages bringing the total above 500 million installs.
HtmlSanitizer uses AngleSharp to parse and re‑render HTML while stripping out anything that could be used for cross‑site scripting.
- 记录日期: 2026-09-21T11:00:33.520Z