Skip to content
Introducing AI Conversations: Natural Language Interaction for Your Apps! Learn More

Markdown

Render and edit markdown content using native controls — no WebView required on MAUI. Includes a read-only MarkdownView renderer and a full MarkdownEditor with formatting toolbar and live preview. Uses Markdig for parsing with support for tables, task lists, and more.

  • NuGet downloads for Shiny.Maui.Controls.Markdown
  • NuGet downloads for Shiny.Blazor.Controls.Markdown
Frameworks
.NET MAUI
Blazor
ViewerEditor
MarkdownViewMarkdownEditor

Add the XAML namespace:

xmlns:md="http://shiny.net/maui/markdown"

A read-only markdown renderer that converts markdown text to native MAUI controls.

<md:MarkdownView Markdown="{Binding DocumentContent}" Padding="16" />
PropertyTypeDefaultDescription
Markdownstring""Markdown content to render
ThemeMarkdownTheme?nullRendering theme (auto Light/Dark if null)
IsScrollEnabledbooltrueEnable/disable scrolling
EventEventArgsDescription
LinkTappedLinkTappedEventArgsFired when a link is tapped

Handle links in code-behind:

markdownView.LinkTapped += (sender, args) =>
{
if (args.Url.StartsWith("internal://"))
{
// Handle internal navigation
args.Handled = true; // Prevents default browser launch
}
};

A full editor with formatting toolbar, live preview toggle, and customizable toolbar items.

<md:MarkdownEditor Markdown="{Binding NoteContent, Mode=TwoWay}"
Placeholder="Start writing markdown..."
Padding="8" />
PropertyTypeDefaultDescription
Markdownstring""Markdown content (TwoWay)
ThemeMarkdownTheme?nullPreview theme (auto Light/Dark if null)
Placeholderstring"Write markdown here..."Placeholder text
ToolbarItemsIReadOnlyList<MarkdownToolbarItem>?Default setFormatting toolbar buttons
IsPreviewVisibleboolfalseToggle preview pane (TwoWay)
ToolbarBackgroundColorColor?nullToolbar background
EditorBackgroundColorColor?nullEditor background
EventEventArgsDescription
LinkTappedLinkTappedEventArgsForwarded from preview link taps
TextChangedTextChangedEventArgsFired when editor text changes

The default toolbar includes: Bold, Italic, Inline Code, H1-H3, Bullet/Numbered/Task Lists, Link, Quote, and Code Block. Use MarkdownToolbarItems.All for all 15 items, or build a custom set:

editor.ToolbarItems = new[]
{
MarkdownToolbarItems.Bold,
MarkdownToolbarItems.Italic,
MarkdownToolbarItems.Link,
MarkdownToolbarItems.CodeBlock
};

Comprehensive theming for rendered markdown. Auto-resolves Light/Dark based on Application.Current?.RequestedTheme when null.

// Use built-in themes
markdownView.Theme = MarkdownTheme.Light;
markdownView.Theme = MarkdownTheme.Dark;
// Or customize
markdownView.Theme = new MarkdownTheme
{
TextColor = Colors.Navy,
LinkColor = Colors.Green,
H1FontSize = 36,
BlockSpacing = 16
};
CategoryProperties
ColorsTextColor, MutedTextColor, LinkColor, CodeBackgroundColor, CodeTextColor, CodeBlockBackgroundColor, CodeBlockTextColor, BlockquoteBorderColor, BlockquoteBackgroundColor, HorizontalRuleColor, TableBorderColor, TableHeaderBackgroundColor
Font SizesBaseFontSize (16), H1FontSize (32), H2FontSize (24), H3FontSize (20), H4FontSize (18), H5FontSize (16), H6FontSize (14), CodeFontSize (14)
SpacingBlockSpacing (12), ListIndent (24), CodeFontFamily

Bold, italic, strikethrough, H1-H6 headings, unordered/ordered/task lists, inline code, fenced code blocks, links (with LinkTapped event), images, blockquotes, tables, horizontal rules, and line breaks.

Install the NuGet package:

Terminal window
dotnet add package Shiny.Blazor.Controls.Markdown

Add the @using directive — typically in _Imports.razor:

@using Shiny.Blazor.Controls.Markdown
<MarkdownView Markdown="@content" />
@code {
string content = """
# Hello World
This is **bold** and *italic* text.
- Item 1
- Item 2
""";
}
<MarkdownEditor Markdown="@noteContent"
MarkdownChanged="v => noteContent = v"
Placeholder="Start writing markdown..."
IsPreviewVisible="@showPreview"
IsPreviewVisibleChanged="v => showPreview = v" />
<button @onclick="() => showPreview = !showPreview">
Toggle Preview
</button>
@code {
string noteContent = "";
bool showPreview;
}
claude plugin marketplace add shinyorg/skills
claude plugin install shiny-controls@shiny
copilot plugin marketplace add https://github.com/shinyorg/skills
copilot plugin install shiny-controls@shiny
View shiny-controls Plugin