What's the best way to convert an HTML string to plain text?

Ask a question
4

Do you have a method or a C# library that converts an HTML string to a plain text?
Obviouly we need to respect as much as possible the h1, h2, h3 tags, unordered lists (i.e. ul), ordered lists (i.e. ol), etc.

Coin iconoffer bounty
add comment

1 Answer

9

You can use the Html Agility Pack, a HTML parser for .NET, for this. One of their samples shows how to convert HTML to plain text: https://html-agility-pack.net/online-examples

add comment

Your Answer