OfficeIMO.MarkdownRenderer.Wpf
0.1.3
Prefix Reserved
dotnet add package OfficeIMO.MarkdownRenderer.Wpf --version 0.1.3
NuGet\Install-Package OfficeIMO.MarkdownRenderer.Wpf -Version 0.1.3
<PackageReference Include="OfficeIMO.MarkdownRenderer.Wpf" Version="0.1.3" />
<PackageVersion Include="OfficeIMO.MarkdownRenderer.Wpf" Version="0.1.3" />
<PackageReference Include="OfficeIMO.MarkdownRenderer.Wpf" />
paket add OfficeIMO.MarkdownRenderer.Wpf --version 0.1.3
#r "nuget: OfficeIMO.MarkdownRenderer.Wpf, 0.1.3"
#:package OfficeIMO.MarkdownRenderer.Wpf@0.1.3
#addin nuget:?package=OfficeIMO.MarkdownRenderer.Wpf&version=0.1.3
#tool nuget:?package=OfficeIMO.MarkdownRenderer.Wpf&version=0.1.3
OfficeIMO.MarkdownRenderer.Wpf
OfficeIMO.MarkdownRenderer.Wpf provides a reusable WPF MarkdownView control built on WebView2 and OfficeIMO.MarkdownRenderer.
What It Solves
- renders Markdown through the existing OfficeIMO HTML shell/update pipeline
- keeps host apps in control of presets, CSS overrides, and link handling
- supports clipboard copy messages from the shell for code/table actions
- stays safe for the main OfficeIMO cross-platform CI by only compiling the WPF surface on Windows targets
- can optionally host pre-rendered HTML bodies for advanced app-specific layouts
Requirements
- Windows desktop application using WPF
- WebView2 runtime available on the target machine
OfficeIMO.MarkdownRenderer.Wpfplus itsOfficeIMO.MarkdownRendererdependency
If you deploy to machines that may not already have WebView2 installed, ship or bootstrap the Evergreen WebView2 Runtime as part of your installer strategy.
Quick Start
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:omd="clr-namespace:OfficeIMO.MarkdownRenderer.Wpf;assembly=OfficeIMO.MarkdownRenderer.Wpf">
<Grid>
<omd:MarkdownView x:Name="Preview"
Preset="Relaxed"
DocumentTitle="README"
ShellCss=":root { color-scheme: dark; }" />
</Grid>
</Window>
Preview.Markdown = """
# Hello
This content is rendered by OfficeIMO.MarkdownRenderer.Wpf.
""";
Preview.ConfigureRendererOptions = options =>
{
options.EnableCodeCopyButtons = true;
options.EnableTableCopyButtons = true;
};
Preview.ErrorOccurred += (_, args) =>
{
Debug.WriteLine($"Markdown preview error during {args.Context}: {args.Exception}");
};
Advanced Hosts
For hosts that need to compose richer layouts, such as timelines or card-based discussion views, set BodyHtml directly instead of Markdown. This keeps WebView shell hosting inside OfficeIMO.MarkdownRenderer.Wpf while still allowing the app to build custom HTML from multiple rendered markdown fragments.
Host Theming
The control is intentionally host-driven:
- use
Presetto choose the baseline renderer profile - use
ShellCssto append host-specific CSS variables and overrides - use
ConfigureRendererOptionsfor advanced renderer customization - handle
NavigationRequestedto intercept external links before the default shell launch behavior - handle
ErrorOccurredif the host wants telemetry, fallback UI, or structured diagnostics
Example:
Preview.ShellCss = """
:root {
color-scheme: dark;
--omd-bg: #12141d;
--omd-fg: #e5e9f0;
--omd-link: #6cb6ff;
}
body {
background: var(--omd-bg);
color: var(--omd-fg);
}
a {
color: var(--omd-link);
}
""";
Notes
BaseHrefexpects an absolute URI and is ignored when invalidMarkdownis the normal content path;BodyHtmlis meant for advanced hosts that render multiple markdown fragments into one composed surface- the control implements
IDisposableso long-lived hosts can release WebView2 resources explicitly when the view is no longer needed
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- Microsoft.Web.WebView2 (>= 1.0.3856.49)
- OfficeIMO.MarkdownRenderer (>= 0.2.8)
-
net10.0
- OfficeIMO.MarkdownRenderer (>= 0.2.8)
-
net10.0-windows7.0
- Microsoft.Web.WebView2 (>= 1.0.3856.49)
- OfficeIMO.MarkdownRenderer (>= 0.2.8)
-
net8.0
- OfficeIMO.MarkdownRenderer (>= 0.2.8)
-
net8.0-windows7.0
- Microsoft.Web.WebView2 (>= 1.0.3856.49)
- OfficeIMO.MarkdownRenderer (>= 0.2.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
0.1.0: introduces a reusable WPF/WebView2 MarkdownView host for OfficeIMO.MarkdownRenderer with host-driven preset, theming, clipboard, and external-link hooks.