Nucleus .Net Core CMS

ContentExtensions Class

Namespace: Nucleus.Extensions
Assembly: Nucleus.Extensions.dll
Content extensions.
ConvertTo (Content content, String targetContentType)
Convert a Models.Content object's Value to the format specified by targetContentType. This function changes the values of the Value and ContentType properties in the specified Models.Content object.
Parameters
Name Type
content Nucleus.Abstractions.Models.Content
targetContentType String
Remarks
This function supports convertion to and from text/html, text/markdown and text/plain.
ToHtml (Content content)
Convert the specified content to Html.
Parameters
Name Type
content Nucleus.Abstractions.Models.Content
ToHtml (String content, String fromContentType)
Return a string containing the conversion of the specified Models.Content object's Value to Html.
Parameters
Name Type
content String
fromContentType String

MIME type of the original content.

Returns
The converted content string.
Remarks
The contentType can be text/markdown or text/plain. All other content type values are treated as text/html and are not converted.
ToMarkdown (Content content)
Return a string containing the conversion of the specified Models.Content object's Value to Markdown.
Parameters
Name Type
content Nucleus.Abstractions.Models.Content
ToMarkdown (String content, String fromContentType)
Converts the specified string content to Markdown.
Parameters
Name Type
content String
fromContentType String

MIME type of the original content.

Returns
The converted content string.
Remarks
The contentType can be text/html or text/plain. All other content type values are treated as text/markdown and are not converted.
ToText (Content content)
Return a string containing the conversion of the specified Models.Content object's Value to plain text.
Parameters
Name Type
content Nucleus.Abstractions.Models.Content
ToText (String content, String fromContentType)
Convert the specified string content to plain text.
Parameters
Name Type
content String
fromContentType String

MIME type of the original content.

Returns
The converted content string.
Remarks
The contentType can be text/markdown or text/html. All other content type values are treated as text/plain and are not converted.