From f2374dc3324918fbba0c4d80355559f0603897cd Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Fri, 7 Jun 2019 12:15:33 +0300 Subject: [PATCH] Add link to wiki Fixes #167 --- README.md | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b8577ab..6bc9851 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,25 @@ In order to facilitate different use cases, HtmlSanitizer can be customized at s - Provide a base URI that will be used to resolve relative URIs against. - Cancelable events are raised before a tag, attribute, or style is removed. +Usage +----- + +Install the [HtmlSanitizer NuGet package](https://www.nuget.org/packages/HtmlSanitizer/). Then: + +```C# +var sanitizer = new HtmlSanitizer(); +var html = @"
Test
"; +var sanitized = sanitizer.Sanitize(html, "http://www.example.com"); +Assert.That(sanitized, Is.EqualTo(@"
" + + @"Test
")); +``` + +There's an [online demo](http://xss.ganss.org/), plus there's also a [.NET Fiddle](https://dotnetfiddle.net/qqpiDh) you can play with. + +More example code and a description of possible options can be found in the [Wiki](https://github.com/mganss/HtmlSanitizer/wiki). + ### Tags allowed by default `a, abbr, acronym, address, area, article, aside, b, bdi, big, blockquote, br, button, caption, center, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dir, div, dl, dt, em, fieldset, figcaption, figure, font, footer, form, h1, h2, h3, h4, h5, h6, header, hr, i, img, input, ins, kbd, keygen, label, legend, li, main, map, mark, menu, menuitem, meter, nav, ol, optgroup, option, output, p, pre, progress, q, rp, rt, ruby, s, samp, section, select, small, span, strike, strong, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, tr, tt, u, ul, var, wbr` @@ -85,23 +104,6 @@ On the other hand, although some broken HTML is fixed by the parser, the output - `` - `

test

` -Usage ------ - -Install the [HtmlSanitizer NuGet package](https://www.nuget.org/packages/HtmlSanitizer/). Then: - -```C# -var sanitizer = new HtmlSanitizer(); -var html = @"
Test
"; -var sanitized = sanitizer.Sanitize(html, "http://www.example.com"); -Assert.That(sanitized, Is.EqualTo(@"
" - + @"Test
")); -``` - -There's an [online demo](http://xss.ganss.org/), plus there's also a [.NET Fiddle](https://dotnetfiddle.net/qqpiDh) you can play with. - License -------