Skip to content

Add multiple tags fluent helper#40

Open
leotsarev wants to merge 2 commits intoVereyon:masterfrom
leotsarev:patch-1
Open

Add multiple tags fluent helper#40
leotsarev wants to merge 2 commits intoVereyon:masterfrom
leotsarev:patch-1

Conversation

@leotsarev
Copy link
Copy Markdown
Contributor

This is concept of group fluent tag helper.
Do you like it?

        htmlSanitizer.Tags("code", "pre", "blockquote").RemoveEmpty();

        htmlSanitizer.Tags("p", "div", "span", "ul", "ol", "li").Flatten();


public static class HtmlSanitizerGroupFluentHelper
{
public record HtmlSanitizerTagRules(IReadOnlyCollection<HtmlSanitizerTagRule> RuleList);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really needed to define HtmlSanitizerTagRules? Can't we simply have the Tags() extension method return a collection of HtmlSanitizerTagRule and have the other extension methods act on such a collection?

It would save defining a type, but I guess it would result in a lot of clutter on the intellisense as all LINQ methods are also available on that collection. I'm not really sure on what the best option is. Are there any examples in other libraries?

@cakkermans
Copy link
Copy Markdown
Member

Hi @leotsarev , yes, I think this suggestion makes sense: it makes is much easier to define large rule sets. I have added a comment on regarding the record you defined, please have a look.
In addition, I would appreciate it if the final PR contains documentation like the original fluent helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants