Renders Markdown content as HTML using Bootstrap typography.
Pass a Markdown string to the Content parameter.
Hello, Markdown! This is a paragraph with italic and inline code.
<HxMarkdown Content="@_markdown" />
@code {
private string _markdown = """
**Hello, Markdown!** This is a paragraph with *italic* and `inline code`.
""";
}Supports headings, lists, blockquotes, code blocks, tables, and inline formatting (bold, italic, strikethrough, inline code, links, images).
A paragraph with bold, italic, strikethrough, and code.
This is a blockquote.
Visit Havit Blazor.
Fenced code blocks are rendered inside <pre><code> with an optional language-* class.
public class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello, World!");
}
}Inline code: var x = 42;
Markdown tables are rendered with a configurable CSS class (default table for Bootstrap styling).
By default, HTML tags in the input are escaped. Set SanitizeHtml="false" to allow raw HTML pass-through (use only with trusted content).
Default (sanitized):
This has <strong>raw HTML bold</strong> and a <span style="color: red;">red span</span>.
With SanitizeHtml="false":
This has raw HTML bold and a red span.
Override the Bootstrap CSS classes applied to tables, blockquotes, and images via parameters or HxMarkdown.Defaults.
By default, no wrapper <div> is rendered. A wrapper is automatically added when you set CssClass or AdditionalAttributes.
Without wrapper (default):
A simple paragraph rendered from Markdown.
With wrapper (CssClass set):
A simple paragraph rendered from Markdown.
| Name | Type | Description |
|---|---|---|
| ContentREQUIRED | string |
Markdown text to render as HTML. |
| AdditionalAttributes | Dictionary<string, object> |
Additional attributes to be splatted onto the wrapper <div> element.
When set, the output is wrapped in a <div>. |
| BlockquoteCssClass | string |
CSS class for <blockquote> elements rendered from markdown blockquotes.
Default is "blockquote" (Bootstrap blockquote). |
| CssClass | string |
Any additional CSS class to apply to the wrapper element.
When set (or when AdditionalAttributes is used), the output is wrapped in a <div>. |
| ImageCssClass | string |
CSS class for <img> elements rendered from markdown images.
Default is "img-fluid" (Bootstrap responsive image). |
| SanitizeHtml | bool? |
When true (default), HTML tags in the input are escaped.
When false, raw HTML in the input passes through to the output (use only with trusted content). |
| Settings | MarkdownSettings |
Set of settings to be applied to the component instance (overrides Defaults, overridden by individual parameters). |
| TableCssClass | string |
CSS class for <table> elements rendered from markdown tables.
Default is "table" (Bootstrap table). |
| Property | Type | Description |
|---|---|---|
| Defaults | MarkdownSettings |
Application-wide defaults for HxMarkdown and derived components. |