Files
2026-03-01 13:57:39 +01:00
..
2026-02-22 00:50:41 +01:00
2026-02-21 23:50:30 +01:00
2026-02-22 14:11:54 +01:00
2026-02-21 23:50:30 +01:00
2026-02-22 00:33:17 +01:00

title, layout, og_type
title layout og_type
Home simple website
Markdig — Fast, powerful Markdown processor for .NET

Markdig

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

dotnet add package Markdig

Available on NuGet — .NET Standard 2.0+

Playground

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.
advanced common common+pipetables+tasklists+footnotes advanced+nohtml common+autoidentifiers+mathematics
This uses MarkdownPipelineBuilder.Configure(...) on the remote playground service.
Run 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.

Blazing fast

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

CommonMark compliant

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

20+ extensions

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

Fully extensible

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

Developer guide

Rich AST

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

AST guide

Roundtrip support

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

Pipeline & roundtrip

<script> (function () { "use strict"; var section = document.getElementById("playground"); if (!section) return; var apiUrl = (section.getAttribute("data-api-url") || "").replace(/\/+$/, ""); var markdownEl = document.getElementById("playground-markdown"); var extensionsEl = document.getElementById("playground-extensions"); var runButton = document.getElementById("playground-run"); var statusEl = document.getElementById("playground-status"); var htmlEl = document.getElementById("playground-html"); var previewEl = document.getElementById("playground-preview"); var defaultMarkdown = [ "# Markdig Playground", "", "Markdig is a **fast** and extensible Markdown processor for .NET.", "", "- [x] Task list support", "- [ ] Pipe table support", "- [ ] Footnotes", "", "| Feature | Enabled |", "| ------- | :-----: |", "| CommonMark | |", "| Extensions | |", "", "[^note]: Footnotes require an extension set that includes `footnotes`." ].join("\n"); if (!markdownEl.value) { markdownEl.value = defaultMarkdown; } function setStatus(html, cssClass) { statusEl.className = "small " + (cssClass || "text-secondary"); statusEl.innerHTML = html; } function setBusy(isBusy) { runButton.disabled = isBusy; runButton.classList.toggle("btn-secondary", isBusy); runButton.classList.toggle("btn-primary", !isBusy); } function runPlayground() { if (runButton.disabled) return; setBusy(true); setStatus(' Rendering…', "text-info"); htmlEl.textContent = ""; previewEl.innerHTML = ""; var query = new URLSearchParams({ text: markdownEl.value || "", extension: extensionsEl.value || "advanced" }); fetch(apiUrl + "/api/to_html?" + query.toString(), { method: "GET", mode: "cors" }) .then(function (response) { if (!response.ok) throw new Error("HTTP " + response.status); return response.json(); }) .then(function (payload) { var html = payload && typeof payload.html === "string" ? payload.html : ""; htmlEl.textContent = html; if (html.toLowerCase().startsWith("exception:")) { previewEl.textContent = html; setStatus(' Rendering error', "text-danger"); return; } previewEl.innerHTML = html; var version = payload && payload.version ? " (v" + payload.version + ")" : ""; setStatus(' Done' + version, "text-success"); }) .catch(function (error) { htmlEl.textContent = "Request failed: " + error.message; previewEl.textContent = "Unable to reach the Markdig playground service."; setStatus(' Service unavailable or blocked by CORS', "text-danger"); }) .finally(function () { setBusy(false); }); } if (!apiUrl) { setStatus(' Playground API URL not configured.', "text-warning"); return; } setBusy(true); fetch(apiUrl + "/api/to_html?text=health&extension=common", { method: "GET", mode: "cors" }) .then(function (response) { if (!response.ok) throw new Error("HTTP " + response.status); return response.json(); }) .then(function (payload) { var version = payload && payload.version ? " (v" + payload.version + ")" : ""; setStatus(' Service available' + version, "text-success"); setBusy(false); }) .catch(function () { setStatus(' Service unavailable or blocked by CORS', "text-danger"); htmlEl.textContent = "The current browser cannot access the remote API endpoint."; previewEl.textContent = "Use the 'Open service' button to try the playground directly."; }); runButton.addEventListener("click", runPlayground); document.addEventListener("keydown", function (event) { if ((event.ctrlKey || event.metaKey) && event.key === "Enter") { event.preventDefault(); runPlayground(); } }); })(); </script>
Quick example
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.