Class HtmlUtils

Html string and formatting utilities

System.Object
  Westwind.Utilities.HtmlUtils
public static class HtmlUtils : object

Class Members

MemberDescription

BinaryToEmbeddedBase64

Create an embedded image url for binary data like images and media

public static string BinaryToEmbeddedBase64(Byte[] imageBytes,     string mimeType)

DisplayMemo

Fixes a plain text field for display as HTML by replacing carriage returns with the appropriate br and p tags for breaks.

public static string DisplayMemo(string htmlText)

DisplayMemoEncoded

Method that handles handles display of text by breaking text. Unlike the non-encoded version it encodes any embedded HTML text

public static string DisplayMemoEncoded(string text)

EmbeddedBase64ToBinary

Decoded an embedded base64 resource string into its binary content and mime type

public static ValueTuple<Byte[],String> EmbeddedBase64ToBinary(string base64Data)

FixHTMLForDisplay

Replaces and and Quote characters to HTML safe equivalents.

public static string FixHTMLForDisplay(string html)

GetSiteBasePath

Returns the base URL of a site from a full URL

public static string GetSiteBasePath(string url)

Href

Create an Href HTML link.

public static string Href(string text,     string url,     string target,     string additionalMarkup)

public static string Href(string url)

HtmlAbstract

Creates an Abstract from an HTML document. Strips the HTML into plain text, then creates an abstract.

public static string HtmlAbstract(string html,     int length)

ImgRef

Returns an IMG link as a string. If the image is null or empty a blank string is returned.

public static string ImgRef(string imageUrl,     string additionalMarkup)

SanitizeHtml

Sanitizes HTML to some of the most of

public static string SanitizeHtml(string html,     string htmlTagBlacklist)

StripHtml

Strips HTML tags out of an HTML string and returns just the text.

public static string StripHtml(string html)

Requirements

Namespace: Westwind.Utilities
Assembly: westwind.utilities.dll

© West Wind Technologies, 1996-2024 • Updated: 06/29/24
Comment or report problem with topic