https://github.com/Ruzzie/Textorizer
Sanitize and 'clean' html for safe consumption in a plain text format.
https://github.com/Ruzzie/Textorizer
html plain-text sanitize sanitize-html text
Last synced: 25 days ago
JSON representation
Sanitize and 'clean' html for safe consumption in a plain text format.
- Host: GitHub
- URL: https://github.com/Ruzzie/Textorizer
- Owner: Ruzzie
- License: other
- Created: 2020-10-10T10:52:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-04T06:14:28.000Z (4 months ago)
- Last Synced: 2025-04-06T10:19:44.676Z (about 1 month ago)
- Topics: html, plain-text, sanitize, sanitize-html, text
- Language: C#
- Homepage:
- Size: 131 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Textorizer
[](https://ci.appveyor.com/project/Ruzzie/textorizer)
[](https://www.nuget.org/packages/Textorizer)Sanitize and 'clean' html for safe consumption in a plain text format.
```csharp
var plainText = Textorize.HtmlToPlainText("I contain htmlconvert me
");
// plaintext = "I contain html\nconvert me\n"
```
Converts html input to a safe plain text representation without html.
Content in Style and Script tags are completely removed, html entity characters are explicitly converted to their unicode characters.
Invalid html is handled best effort for a reasonable equivalent plain text output.Keep in mind the following equivalence:
Textorize(input) == Textorize(HtmlEncode(Textorize(input)))For more examples see the [testsuite](https://github.com/Ruzzie/Textorizer/blob/ae0577ed07f930759a1796bb877cd31884fe6709/source/Textorizer.UnitTests/HtmlTextorizerTests.cs#L12)
## Install
### Package Manager Console
```
PM> Install-Package Textorizer
```### .NET CLI Console
```
> dotnet add package Textorizer
```## License
Dual licensed
MIT
https://opensource.org/licenses/MIT
Unlicense
https://opensource.org/licenses/Unlicense