Markdig

Markdig — Fast, powerful Markdown processor for .NET

A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET.

dotnet add package Markdig

Available on NuGet — .NET Standard 2.0+

Try Markdig live with the public API. Edit Markdown, pick extensions, and click Run (or press Ctrl+Enter).

The public API truncates input to the first 1000 characters.

This uses MarkdownPipelineBuilder.Configure(...) on the remote playground service.

Checking service availability…

<h1>Markdig Playground</h1>
<p>Markdig is a <strong>fast</strong> and extensible Markdown processor for .NET.</p>

Markdig Playground

Markdig is a fast and extensible Markdown processor for .NET.

Regex-free parser and HTML renderer with minimal GC pressure. 20% faster than the reference C implementation (cmark) and 100× faster than regex-based processors.

Getting started · Usage guide

Passes 600+ tests from the latest CommonMark specification (0.31.2). Full support for all core Markdown constructs including GFM fenced code blocks.

CommonMark syntax

Tables, task lists, math, diagrams, footnotes, emoji, alert blocks, abbreviations, and more — all included out of the box. Enable them individually or all at once.

Extensions

Pluggable architecture — even core parsing is customizable. Create your own block parsers, inline parsers, and renderers with a clean API.

Developer guide

Full abstract syntax tree with precise source locations. Power syntax highlighters, editors, and document analysis tools with the complete Descendants API.

AST guide

Parse with trivia tracking for lossless parse → render roundtrips. Modify Markdown documents programmatically without introducing unwanted changes.

Pipeline & roundtrip

using Markdig;

// Simple CommonMark conversion
var result = Markdown.ToHtml("This is a text with some *emphasis*");
// => "<p>This is a text with some <em>emphasis</em></p>\n"

// Enable all advanced extensions
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
var result = Markdown.ToHtml("This is a ~~strikethrough~~", pipeline);
// => "<p>This is a <del>strikethrough</del></p>\n"

For more examples, see the Getting started guide.