Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

AngleSharp: A Standards‑Compliant HTML Parser for .NET

说明与用途

AngleSharp 是一个完全符合 W3C 标准的 .NET HTML/CSS/JS 解析器,支持 HTML 清理、Blazor 单元测试、邮件 CSS 内联等功能,并被 Bitwarden、OrchardCore 等众多项目使用,下载量已超过 3.1 亿。

问题

Developers needed a reliable, spec‑conformant HTML/CSS/JS parser in .NET for web scraping, testing, sanitization, and rendering, but existing solutions were fragile or incomplete.

结果

AngleSharp became a foundational library with 310M+ NuGet downloads, powering sanitization, testing, email rendering, and many commercial applications such as Bitwarden and OrchardCore.

工作流

  • 1. Install AngleSharp via NuGet.
  • 2. Create a BrowsingContext with desired extensions (e.g., CSS, JS).
  • 3. Load or parse HTML documents.
  • 4. Query the DOM using standard selectors.
  • 5. Use extensions for CSS styling, JavaScript execution, or XML handling as needed.
  • 6. Integrate into downstream libraries (e.g., HtmlSanitizer, bUnit).

证据

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 AngleSharp NuGet package alone sits at over 310 million downloads.

来源

HtmlSanitizer uses AngleSharp to parse and re-render HTML while stripping out anything that could be used for cross-site scripting.

来源

  • 记录日期: 2026-09-15T12:30:22.480Z