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.
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponent.SetParametersAsync
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenMarkdown : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRenderBasic 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 />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.
public RadzenMarkdown()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.
public bool AllowHtml { get; set; }
| Type | Description |
|---|---|
| bool | 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. |
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.
public IEnumerable<string> AllowedHtmlAttributes { get; set; }
| 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. |
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.
public IEnumerable<string> AllowedHtmlTags { get; set; }
| 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. |
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.
public int AutoLinkHeadingDepth { get; set; }
| Type | Description |
|---|---|
| int | 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. |
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.
public RenderFragment ChildContent { get; set; }
| Type | Description |
|---|---|
| RenderFragment | 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. |
Gets or sets the markdown content as a string. When set, takes precedence over ChildContent. Use this to bind markdown from a variable.
public string Text { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the markdown content as a string. When set, takes precedence over ChildContent. Use this to bind markdown from a variable. |