• Home
  • Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • ToSic.Razor.Blade
      • IHtmlTag
      • IHtmlTagsService
      • IScrub
      • Tag
      • Tags
      • Text
    • ToSic.Razor.Html5
      • A
      • Abbr
      • Address
      • Area
      • Article
      • Aside
      • Audio
      • B
      • Base
      • Bdi
      • Bdo
      • Blockquote
      • Br
      • Button
      • Canvas
      • Caption
      • Cite
      • Code
      • Col
      • Colgroup
      • Comment
      • Data
      • Datalist
      • Dd
      • Del
      • Details
      • Dfn
      • Dialog
      • Div
      • Dl
      • Dt
      • Em
      • Embed
      • Fieldset
      • Figcaption
      • Figure
      • Footer
      • Form
      • H1
      • H2
      • H3
      • H4
      • H5
      • H6
      • Head
      • Header
      • Hr
      • I
      • Icon
      • Iframe
      • Img
      • Input
      • Ins
      • Kbd
      • Label
      • Legend
      • Li
      • Link
      • Main
      • Map
      • Mark
      • Meta
      • MetaOg
      • Meter
      • Nav
      • Noscript
      • Object
      • Ol
      • Optgroup
      • Option
      • Output
      • P
      • Param
      • Picture
      • Pre
      • Progress
      • Q
      • Rp
      • Rt
      • Ruby
      • S
      • Samp
      • Script
      • ScriptJsonLd
      • Section
      • Select
      • Small
      • Source
      • Span
      • Strong
      • Style
      • Sub
      • Summary
      • Sup
      • Svg
      • Table
      • Tbody
      • Td
      • Template
      • Textarea
      • Tfoot
      • Th
      • Thead
      • Time
      • Tr
      • Track
      • U
      • Ul
      • Var
      • Video
      • Wbr
    • ToSic.Razor.Markup
      • Attribute
      • AttributeOptions
      • Attributes
      • ITag
      • Tag<T>
      • TagBase
      • TagChildren
      • TagCustom
      • TagList
      • TagOptions
      • TagText
    • ToSic.Razor.StartUp
      • StartUp

    Interface IScrub

    IScrub helps wash/clean html from things you want removed. It can take care of all tags, just specific tags or certain attributes.

    Note that it is implemented as an interface, so you must use Dependency Injection to get it.

    Namespace: ToSic.Razor.Blade
    Assembly: ToSic.Razor.dll
    Syntax
    public interface IScrub
    Remarks

    Added in v3.9

    Methods

    | Improve this Doc View Source

    All(String)

    Remove all HTML tags from a string.

    Declaration
    string All(string html)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    Returns
    Type Description
    System.String

    A cleaned string without any HTML tags

    | Improve this Doc View Source

    Attributes(String)

    Remove all HTML attributes.

    Declaration
    string Attributes(string html)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    Returns
    Type Description
    System.String

    A string without any attributes inside the HTML Tags

    | Improve this Doc View Source

    Attributes(String, String)

    Remove all instances of a specified attribute.

    Declaration
    string Attributes(string html, string attribute)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    System.String attribute

    string defining the attribute to remove

    Returns
    Type Description
    System.String

    A string which doesn't contain the specified attribute

    | Improve this Doc View Source

    Attributes(String, String[])

    Remove all instances of an array of specified attributes.

    Declaration
    string Attributes(string html, params string[] attributes)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    System.String[] attributes

    array defining the attributes to remove

    Returns
    Type Description
    System.String

    A string which doesn't contain the specified attributes

    | Improve this Doc View Source

    Classes(String)

    Remove all class attributes

    Declaration
    string Classes(string html)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    Returns
    Type Description
    System.String

    A string without any class=""/class=''/class= attributes

    | Improve this Doc View Source

    Except(String, String[])

    Remove all HTML Tags except of a specified list

    Declaration
    string Except(string html, params string[] tags)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    System.String[] tags

    array defining the HTML Tags which shouldn't be removed

    Returns
    Type Description
    System.String

    A string which doesn't contain the specified HTML Tags

    | Improve this Doc View Source

    Only(String, String)

    Remove one specific HTML tag from a string.

    Declaration
    string Only(string html, string tag)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    System.String tag

    tag name to remove

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    Only(String, String[])

    Remove many specific HTML tags from a string.

    Declaration
    string Only(string html, params string[] tags)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    System.String[] tags

    one or more tags to remove

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    Styles(String)

    Remove all style attributes

    Declaration
    string Styles(string html)
    Parameters
    Type Name Description
    System.String html

    Original HTML

    Returns
    Type Description
    System.String

    A string without any style=""/style=''/style= attributes

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX