CDS.Markdown.Lite
1.5.5
dotnet add package CDS.Markdown.Lite --version 1.5.5
NuGet\Install-Package CDS.Markdown.Lite -Version 1.5.5
<PackageReference Include="CDS.Markdown.Lite" Version="1.5.5" />
<PackageVersion Include="CDS.Markdown.Lite" Version="1.5.5" />
<PackageReference Include="CDS.Markdown.Lite" />
paket add CDS.Markdown.Lite --version 1.5.5
#r "nuget: CDS.Markdown.Lite, 1.5.5"
#:package CDS.Markdown.Lite@1.5.5
#addin nuget:?package=CDS.Markdown.Lite&version=1.5.5
#tool nuget:?package=CDS.Markdown.Lite&version=1.5.5
CDS.Markdown Solution
CDS.Markdown is a comprehensive .NET library for both rendering and generating Markdown. It is designed for easy integration into your .NET 8 and .NET 10 applications.
Two packages
CDS.Markdown.Lite |
CDS.Markdown |
|
|---|---|---|
| Gives you | MarkdownTextBox + the Fluent/Builder generation APIs |
Everything in CDS.Markdown.Lite, plus MarkdownViewer |
| Depends on | Markdig only |
Markdig, Microsoft.Web.WebView2, and CDS.Markdown.Lite |
| Pick this when | You only need prose-sized rendering or Markdown generation, and want to keep WebView2 out of your dependency tree entirely | You need MarkdownViewer's full document fidelity (Mermaid, MathJax, real tables, images, links) |
CDS.Markdown depends on CDS.Markdown.Lite, so installing CDS.Markdown still gets you MarkdownTextBox and the generation APIs too โ nothing is lost by installing the bigger package. Install CDS.Markdown.Lite on its own only when you specifically want to avoid the WebView2 dependency.
Features
- ๐ฅ๏ธ WinForms Viewer Control (
CDS.Markdown): A drop-inMarkdownViewercontrol powered by WebView2 and Markdig. Includes Light and Dark mode theme support. - โก Lightweight Text Box Control (
CDS.Markdown.Lite):MarkdownTextBox, aRichTextBox-based control for prose-sized Markdown (headings, formatting, lists, tables) with no WebView2 process and a synchronous preferred-height read โ a cheaper option when you're rendering many small fragments (e.g. chat bubbles) rather than a full document. - ๐ Programmatic Creation (
CDS.Markdown.Lite): Generate Markdown dynamically using a clean Fluent API or a traditional Builder API. - ๐ Offline-First: Embedded resources for GitHub-style CSS, Mermaid.js diagrams, and MathJax (LaTeX math) mean no internet connection is required to render advanced Markdown.
- ๐งช Fully Tested: Comprehensive unit test coverage ensuring reliable HTML generation and Markdown building.
Quick Start
1. Installation
Install whichever package matches what you need (see the table above):
dotnet add package CDS.Markdown.Lite
# or, for the full WebView2 viewer too:
dotnet add package CDS.Markdown
2. Viewing Markdown (WinForms)
Drop the MarkdownViewer control onto your form and load a file:
await markdownViewer1.LoadMarkdownAsync("readme.md");
๐ Read the full Viewer Documentation
Or, for many small fragments rather than a full document, drop a MarkdownTextBox control onto your form instead โ this one only needs CDS.Markdown.Lite:
markdownTextBox1.SetMarkdown("**Hello**, world!");
See the "Embedding as a Fragment" section of the Viewer Documentation for the tradeoff between the two controls.
3. Generating Markdown (Fluent API)
Create structured Markdown programmatically without string wrangling:
var markdown = new FluentMarkdownDocument()
.AddHeading("Hello, World!")
.AddParagraph("This is a **bold** statement.")
.AddBulletList(["First item", "Second item"])
.AddMermaidDiagram("graph TD;\nA-->B;")
.ToMarkdown();
๐ Read the full Creation Documentation
Project Structure
CDS.Markdown.Lite: The lightweight library โMarkdownTextBoxand the Markdown generation APIs. Depends on Markdig only.CDS.Markdown: The WebView2-based viewer control and its HTML-building pipeline. Depends onCDS.Markdown.Lite.Demo: A sample WinForms application demonstrating the viewer, the text box, and the creation APIs.UnitTests: MSTest project covering both packages โ HTML rendering, session management,MarkdownTextBoxrendering, and Markdown generation.UiTests: FlaUI project that drives the realDemo.exeend-to-end.
Documentation
Attributions
- github-markdown-css (MIT License)
- Markdig (BSD-2-Clause)
- Mermaid.js (MIT License)
- MathJax (Apache-2.0)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CDS.Markdown.Lite:
| Package | Downloads |
|---|---|
|
CDS.Markdown
Easy-to-use .NET WinForms control for rendering full Markdown documents using WebView2 (MarkdownViewer). Also pulls in CDS.Markdown.Lite, so you still get MarkdownTextBox and the Markdown generation APIs. If you only need those, install CDS.Markdown.Lite instead to avoid the WebView2 dependency. |
|
|
CDS.ScriptChat.WinForms
WinForms script+chat panel for the CDS.ScriptChat library. Host-agnostic: the script buffer is reached through caller-supplied delegates, with no dependency on any specific editor control. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial public release.