Search Results for

    Show / Hide Table of Contents
    View Source

    Class MarkdownEditorValueConverter

    Converts values stored by the Markdown editor property editor into HTML or other displayable formats for use within Umbraco.

    Inheritance
    object
    PropertyValueConverterBase
    Namespace: Umbraco.Cms.Core.PropertyEditors.ValueConverters
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    [DefaultPropertyValueConverter]
    public class MarkdownEditorValueConverter : PropertyValueConverterBase, IDeliveryApiPropertyValueConverter, IPropertyValueConverter, IDiscoverable

    Constructors

    View Source

    MarkdownEditorValueConverter(HtmlLocalLinkParser, HtmlUrlParser)

    Initializes a new instance of the MarkdownEditorValueConverter class.

    Declaration
    [Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 19.")]
    public MarkdownEditorValueConverter(HtmlLocalLinkParser localLinkParser, HtmlUrlParser urlParser)
    Parameters
    Type Name Description
    HtmlLocalLinkParser localLinkParser

    An instance of HtmlLocalLinkParser used to parse local links in HTML content.

    HtmlUrlParser urlParser

    An instance of HtmlUrlParser used to parse URLs in HTML content.

    View Source

    MarkdownEditorValueConverter(HtmlLocalLinkParser, HtmlUrlParser, IMarkdownToHtmlConverter)

    Initializes a new instance of the MarkdownEditorValueConverter class.

    Declaration
    public MarkdownEditorValueConverter(HtmlLocalLinkParser localLinkParser, HtmlUrlParser urlParser, IMarkdownToHtmlConverter markdownToHtmlConverter)
    Parameters
    Type Name Description
    HtmlLocalLinkParser localLinkParser

    An instance used to parse local links within HTML content.

    HtmlUrlParser urlParser

    An instance used to parse URLs within HTML content.

    IMarkdownToHtmlConverter markdownToHtmlConverter

    An instance responsible for converting markdown to HTML.

    Methods

    View Source

    ConvertIntermediateToDeliveryApiObject(IPublishedElement, IPublishedPropertyType, PropertyCacheLevel, object?, bool, bool)

    Converts the intermediate value of a Markdown editor property to an object suitable for the Delivery API.

    Declaration
    public object? ConvertIntermediateToDeliveryApiObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview, bool expanding)
    Parameters
    Type Name Description
    IPublishedElement owner

    The published element that owns the property.

    IPublishedPropertyType propertyType

    The type of the published property.

    PropertyCacheLevel referenceCacheLevel

    The cache level for property references.

    object inter

    The intermediate value to convert.

    bool preview

    True if the conversion is for preview mode; otherwise, false.

    bool expanding

    True if the value is being expanded; otherwise, false.

    Returns
    Type Description
    object

    The Markdown string if present; otherwise, an empty string.

    View Source

    ConvertIntermediateToObject(IPublishedElement, IPublishedPropertyType, PropertyCacheLevel, object?, bool)

    Converts the intermediate value, expected to be a Markdown string, into an HTML-encoded string suitable for frontend rendering.

    Declaration
    public override object ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview)
    Parameters
    Type Name Description
    IPublishedElement owner

    The published element that owns the property.

    IPublishedPropertyType propertyType

    The metadata describing the property type.

    PropertyCacheLevel referenceCacheLevel

    The cache level at which the property value is stored.

    object inter

    The intermediate value to convert, typically a Markdown string or null.

    bool preview

    A value indicating whether the conversion is for preview purposes.

    Returns
    Type Description
    object

    An HtmlEncodedString containing the HTML representation of the Markdown content, or an empty HtmlEncodedString if the input is null.

    View Source

    ConvertSourceToIntermediate(IPublishedElement, IPublishedPropertyType, object?, bool)

    Converts the source value of a Markdown editor property to an intermediate string format by parsing and resolving internal links and URLs.

    Declaration
    public override object? ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object? source, bool preview)
    Parameters
    Type Name Description
    IPublishedElement owner

    The published element that owns the property.

    IPublishedPropertyType propertyType

    The metadata describing the property type.

    object source

    The source value to convert, expected to be a string or convertible to string.

    bool preview

    A value indicating whether the conversion is for preview mode.

    Returns
    Type Description
    object

    The processed string with internal links and URLs resolved, or null if source is null.

    View Source

    GetDeliveryApiPropertyCacheLevel(IPublishedPropertyType)

    Returns the cache level to use for the Delivery API for a given Markdown property type.

    Declaration
    public PropertyCacheLevel GetDeliveryApiPropertyCacheLevel(IPublishedPropertyType propertyType)
    Parameters
    Type Name Description
    IPublishedPropertyType propertyType

    The IPublishedPropertyType representing the Markdown property.

    Returns
    Type Description
    PropertyCacheLevel

    The PropertyCacheLevel to use for the Delivery API.

    View Source

    GetDeliveryApiPropertyValueType(IPublishedPropertyType)

    Gets the delivery API property value type for the specified published property type.

    Declaration
    public Type GetDeliveryApiPropertyValueType(IPublishedPropertyType propertyType)
    Parameters
    Type Name Description
    IPublishedPropertyType propertyType

    The published property type.

    Returns
    Type Description
    Type

    The type of the value returned by the delivery API.

    View Source

    GetPropertyCacheLevel(IPublishedPropertyType)

    Gets the cache level for the specified property type. For the Markdown editor, this always returns Snapshot.

    Declaration
    public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
    Parameters
    Type Name Description
    IPublishedPropertyType propertyType

    The property type for which to determine the cache level.

    Returns
    Type Description
    PropertyCacheLevel

    The cache level, which is always Snapshot for this value converter.

    View Source

    GetPropertyValueType(IPublishedPropertyType)

    Gets the .NET type of the property value returned by the Markdown editor for the specified property type.

    Declaration
    public override Type GetPropertyValueType(IPublishedPropertyType propertyType)
    Parameters
    Type Name Description
    IPublishedPropertyType propertyType

    The published property type.

    Returns
    Type Description
    Type

    The IHtmlEncodedString type representing the property value.

    View Source

    IsConverter(IPublishedPropertyType)

    Returns a value indicating whether this converter is applicable to the specified property type.

    Declaration
    public override bool IsConverter(IPublishedPropertyType propertyType)
    Parameters
    Type Name Description
    IPublishedPropertyType propertyType

    The property type to evaluate.

    Returns
    Type Description
    bool

    true if the converter can handle the specified property type; otherwise, false.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX