• 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

    Class Tags

    The Tags-API is for manipulating strings which contain html or should contain html

    • like stripping away tags, converting &lt;br> tags to new-lines and similar.
      Important: Tags can easily be confused with the Tag object.
    Inheritance
    System.Object
    Tags
    Namespace: ToSic.Razor.Blade
    Assembly: ToSic.Razor.dll
    Syntax
    public static class Tags

    Methods

    | Improve this Doc View Source

    Br2Nl(String)

    Convert <br> and <br/> into line-breaks (\n)

    Declaration
    public static string Br2Nl(string value)
    Parameters
    Type Name Description
    System.String value
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    Br2Space(String)

    Convert <br> and <br/> into line-breaks

    Declaration
    public static string Br2Space(string value)
    Parameters
    Type Name Description
    System.String value
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    Decode(String)

    Decode an encoded html back into a normal string.

    Declaration
    public static string Decode(string value)
    Parameters
    Type Name Description
    System.String value

    encoded string

    Returns
    Type Description
    System.String

    shorter, unencoded string

    | Improve this Doc View Source

    Encode(String)

    Safely encode a string for representation into html. Special note: apostrophes are encoded as ', not as "

    Declaration
    public static string Encode(string value)
    Parameters
    Type Name Description
    System.String value

    original value

    Returns
    Type Description
    System.String

    encoded string

    | Improve this Doc View Source

    Nl2Br(String)

    Convert \n into <br> line-breaks

    Declaration
    public static string Nl2Br(string value)
    Parameters
    Type Name Description
    System.String value
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    SafeUrl(String)

    Convert URLs into a safe format, to properly escape spaces, umlauts, etc. Important for images etc. which may have special characters

    Declaration
    public static RawHtmlString SafeUrl(string url)
    Parameters
    Type Name Description
    System.String url
    Returns
    Type Description
    ToSic.Razor.Markup.RawHtmlString
    | Improve this Doc View Source

    Strip(String)

    Remove all HTML tags from a string.

    Declaration
    [Obsolete("Starting in V3.9 you should use IScrub.All(...) instead")]
    public static string Strip(string original)
    Parameters
    Type Name Description
    System.String original

    original HTML

    Returns
    Type Description
    System.String

    A cleaned string without any HTML tags

    Remarks

    Added in v2

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