Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenMarkdown

    A markdown rendering component that parses and displays Markdown syntax as formatted HTML. RadzenMarkdown converts Markdown text (headings, lists, links, code blocks, etc.) into rich HTML content with security features. Parses CommonMark-compliant markdown and renders it as HTML. Ideal for documentation, blog posts, README files, or any content authored in Markdown format. Features full support for standard Markdown syntax (headings, bold, italic, lists, links, images, code, blockquotes, tables), optional HTML tag support within markdown with security filtering, dangerous tag filtering (script, iframe, object) to prevent XSS attacks, automatic anchor link creation for headings (configurable depth), control over allowed HTML tags and attributes, and flexible input via child content or Text property. Parses markdown and renders it as Blazor components/HTML for display. Use AllowHtml = false to strictly render only Markdown syntax without any HTML pass-through.

    Inheritance
    object
    ComponentBase
    RadzenComponent
    RadzenMarkdown
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.OnContextMenu(MouseEventArgs)
    RadzenComponent.GetCssClass()
    RadzenComponent.GetId()
    RadzenComponent.Debounce(Func<Task>, int)
    RadzenComponent.OnInitialized()
    RadzenComponent.SetParametersAsync(ParameterView)
    RadzenComponent.OnAfterRenderAsync(bool)
    RadzenComponent.RaiseContextMenu(MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.AddContextMenu()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Dispose()
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.Reference
    RadzenComponent.CurrentStyle
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenMarkdown : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    Examples

    Basic markdown rendering:

    <RadzenMarkdown>
    # Welcome
    This is **bold** and this is *italic*.
    - List item 1
    - List item 2
    [Link to Radzen](https://radzen.com)
    </RadzenMarkdown>

    Markdown from variable:

    <RadzenMarkdown Text=@markdownContent />
    @code {
        string markdownContent = "## Documentation\nThis is the content...";
    }

    Markdown with auto-linking headings:

    <RadzenMarkdown AutoLinkHeadingDepth="3" Text=@readme />

    Constructors

    RadzenMarkdown()

    A markdown rendering component that parses and displays Markdown syntax as formatted HTML. RadzenMarkdown converts Markdown text (headings, lists, links, code blocks, etc.) into rich HTML content with security features. Parses CommonMark-compliant markdown and renders it as HTML. Ideal for documentation, blog posts, README files, or any content authored in Markdown format. Features full support for standard Markdown syntax (headings, bold, italic, lists, links, images, code, blockquotes, tables), optional HTML tag support within markdown with security filtering, dangerous tag filtering (script, iframe, object) to prevent XSS attacks, automatic anchor link creation for headings (configurable depth), control over allowed HTML tags and attributes, and flexible input via child content or Text property. Parses markdown and renders it as Blazor components/HTML for display. Use AllowHtml = false to strictly render only Markdown syntax without any HTML pass-through.

    Declaration
    public RadzenMarkdown()
    Examples

    Basic markdown rendering:

    <RadzenMarkdown>
    # Welcome
    This is **bold** and this is *italic*.
    - List item 1
    - List item 2
    [Link to Radzen](https://radzen.com)
    </RadzenMarkdown>

    Markdown from variable:

    <RadzenMarkdown Text=@markdownContent />
    @code {
        string markdownContent = "## Documentation\nThis is the content...";
    }

    Markdown with auto-linking headings:

    <RadzenMarkdown AutoLinkHeadingDepth="3" Text=@readme />

    Properties

    AllowHtml

    Gets or sets whether HTML tags within the markdown are rendered or escaped. When true (default), safe HTML tags are allowed. Dangerous tags (script, iframe, style, object) are always filtered. When false, all HTML is treated as plain text and displayed literally.

    Declaration
    [Parameter]
    public bool AllowHtml { get; set; }
    Property Value
    Type Description
    bool

    true to allow safe HTML; false to escape all HTML. Default is true.

    AllowedHtmlAttributes

    Gets or sets a whitelist of HTML attributes permitted on HTML tags when AllowHtml is true. If set, only these attributes are rendered; others are stripped. If not set, uses a default list of safe attributes.

    Declaration
    [Parameter]
    public IEnumerable<string>? AllowedHtmlAttributes { get; set; }
    Property Value
    Type Description
    IEnumerable<string>

    The allowed HTML attribute names, or null to use the default safe attribute list.

    AllowedHtmlTags

    Gets or sets a whitelist of HTML tags permitted in the markdown when AllowHtml is true. If set, only these tags will be rendered; others are stripped. If not set, uses a default list of safe tags.

    Declaration
    [Parameter]
    public IEnumerable<string>? AllowedHtmlTags { get; set; }
    Property Value
    Type Description
    IEnumerable<string>

    The allowed HTML tag names, or null to use the default safe tag list.

    AutoLinkHeadingDepth

    Gets or sets the maximum heading level (1-6) for which to automatically generate anchor links. For example, setting to 3 creates anchors for h1, h2, and h3 headings. Set to 0 to disable auto-linking. Auto-links enable table of contents navigation.

    Declaration
    [Parameter]
    public int AutoLinkHeadingDepth { get; set; }
    Property Value
    Type Description
    int

    The maximum heading depth for auto-linking (0-6). Default is 0 (disabled).

    ChildContent

    Gets or sets the markdown content as a render fragment. The markdown text should be placed directly inside the component tags. Overridden by Text if both are set.

    Declaration
    [Parameter]
    public RenderFragment? ChildContent { get; set; }
    Property Value
    Type Description
    RenderFragment

    The markdown content render fragment.

    Text

    Gets or sets the markdown content as a string. When set, takes precedence over ChildContent. Use this to bind markdown from a variable.

    Declaration
    [Parameter]
    public string? Text { get; set; }
    Property Value
    Type Description
    string

    The markdown text content.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    A markdown rendering component that parses and displays Markdown syntax as formatted HTML. RadzenMarkdown converts Markdown text (headings, lists, links, code blocks, etc.) into rich HTML content with security features. Parses CommonMark-compliant markdown and renders it as HTML. Ideal for documentation, blog posts, README files, or any content authored in Markdown format. Features full support for standard Markdown syntax (headings, bold, italic, lists, links, images, code, blockquotes, tables), optional HTML tag support within markdown with security filtering, dangerous tag filtering (script, iframe, object) to prevent XSS attacks, automatic anchor link creation for headings (configurable depth), control over allowed HTML tags and attributes, and flexible input via child content or Text property. Parses markdown and renders it as Blazor components/HTML for display. Use AllowHtml = false to strictly render only Markdown syntax without any HTML pass-through.

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    string
    Overrides
    RadzenComponent.GetComponentCssClass()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT