Class Tags
The Tags-API is for manipulating strings which contain html or should contain html
- like stripping away tags, converting
<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 SourceBr2Nl(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 |
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 |
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 |
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 |
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 |
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 |
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