RadzenMarkdown Class

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

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenMarkdown : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

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

RadzenMarkdownlink

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()

Properties

AllowHtmllink

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
public bool AllowHtml { get; set; }
Property Value
Type Description
boolGets 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.

AllowedHtmlAttributeslink

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
public IEnumerable<string> AllowedHtmlAttributes { get; set; }
Property Value
Type Description
IEnumerable<string>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.

AllowedHtmlTagslink

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
public IEnumerable<string> AllowedHtmlTags { get; set; }
Property Value
Type Description
IEnumerable<string>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.

AutoLinkHeadingDepthlink

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
public int AutoLinkHeadingDepth { get; set; }
Property Value
Type Description
intGets 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.

ChildContentlink

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
public RenderFragment ChildContent { get; set; }
Property Value
Type Description
RenderFragmentGets 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.

Textlink

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

Declaration
public string Text { get; set; }
Property Value
Type Description
stringGets or sets the markdown content as a string. When set, takes precedence over ChildContent. Use this to bind markdown from a variable.

Methods

BuildRenderTreelink

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

GetComponentCssClasslink

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string
An error has occurred. This app may no longer respond until reloaded. Reload 🗙