Markdig 0.41.2 (original) (raw)

Markdig is a fast, powerful, CommonMark compliant, extensible Markdown processor for .NET.

NOTE: The repository is under construction. There will be a dedicated website and proper documentation at some point!

You can try Markdig online and compare it to other implementations on babelmark3

Features

If you are looking for support for an old .NET Framework 3.5 or 4.0, you can download Markdig 0.18.3.

Third Party Extensions

Documentation

The repository is under construction. There will be a dedicated website and proper documentation at some point!

While there is not yet a dedicated documentation, you can find from the specs documentation how to use these extensions.

In the meantime, you can have a "behind the scene" article about Markdig in my blog post "Implementing a Markdown Engine for .NET"

Download

Markdig is available as a NuGet package: NuGet

Also Markdig.Signed NuGet package provides signed assemblies.

Usage

The main entry point for the API is the Markdig.Markdown class:

By default, without any options, Markdig is using the plain CommonMark parser:

var result = Markdown.ToHtml("This is a text with some *emphasis*");
Console.WriteLine(result);   // prints: <p>This is a text with some <em>emphasis</em></p>

In order to activate most of all advanced extensions (except Emoji, SoftLine as HardLine, Bootstrap, YAML Front Matter, JiraLinks and SmartyPants)

// Configure the pipeline with all advanced extensions active
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
var result = Markdown.ToHtml("This is a text with some *emphasis*", pipeline);

Try it online!

You can have a look at the MarkdownExtensions that describes all actionable extensions (by modifying the MarkdownPipeline)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. For detailed contributing guidelines, please see contributing.md.

Build

In order to build Markdig, you need to install .NET 6.0

License

This software is released under the BSD-Clause 2 license.

Benchmarking

The latest benchmark was collected on April 23 2022, against the following implementations:

// * Summary *

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
AMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores
.NET SDK=6.0.202
  [Host]     : .NET 6.0.4 (6.0.422.16404), X64 RyuJIT
  DefaultJob : .NET 6.0.4 (6.0.422.16404), X64 RyuJIT


|            Method |       Mean |     Error |    StdDev |
|------------------ |-----------:|----------:|----------:|
|           markdig |   1.979 ms | 0.0221 ms | 0.0185 ms |
|             cmark |   2.571 ms | 0.0081 ms | 0.0076 ms |
|    CommonMark.NET |   2.016 ms | 0.0169 ms | 0.0158 ms |
|     MarkdownSharp | 221.455 ms | 1.4442 ms | 1.3509 ms |

Supports this project with a monthly donation and help me continue improving it. [Become a sponsor]

lilith Lilith River, author of Imageflow Server, an easy on-demand image editing, optimization, and delivery server

Credits

Thanks to the fantastic work done by John Mac Farlane for the CommonMark specs and all the people involved in making Markdown a better standard!

This project would not have been possible without this huge foundation.

Thanks also to the project BenchmarkDotNet that makes benchmarking so easy to setup!

Some decoding part (e.g HTML EntityHelper.cs) have been re-used from CommonMark.NET

Thanks to the work done by @clarkd on the JIRA Link extension (https://github.com/clarkd/MarkdigJiraLinker), now included with this project!

Alexandre MUTEL aka xoofx

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. net9.0 is compatible. 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 was computed. 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.
.NET Core netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed.
.NET Standard netstandard2.0 is compatible. netstandard2.1 is compatible.
.NET Framework net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed.
MonoAndroid monoandroid was computed.
MonoMac monomac was computed.
MonoTouch monotouch was computed.
Tizen tizen40 was computed. tizen60 was computed.
Xamarin.iOS xamarinios was computed.
Xamarin.Mac xamarinmac was computed.
Xamarin.TVOS xamarintvos was computed.
Xamarin.WatchOS xamarinwatchos was computed.

NuGet packages (379)

Showing the top 5 NuGet packages that depend on Markdig:

Package Downloads
ppy.osu.Framework A 2D application/game framework written with rhythm games in mind. 2.2M
Westwind.AspNetCore.Markdown This library provides Markdown support for ASP.NET Core applications: * Markdown TagHelper - embed static markdown text from files, urls or bind model data * Markdown Page Handler Middleware to render Markdown files in your site * Markdown Parsing Support via Markdown.Parse() and Markdown.ParseHtmlString() * Markdown Parsing from Files via Markdown.ParseFromFile() and .ParseFromFileAsync() * Markdown Parsing from URL via Markdown.ParseFromUrl() and .ParseFromUrlAsync() * Supports basic HTML Sanitation * TagHelper supports White Space Normalization * Customization of Markdown Processing Options 1.4M
contentstack.csharp .NET SDK for the Contentstack Content Delivery API. 1.1M
Octostache Variable substitution syntax used in Octopus Deploy. 1.1M
FenixAlliance.ACL.Dependencies Application Component for the Alliance Business Suite. 933.9K

GitHub repositories (164)

Showing the top 20 popular GitHub repositories that depend on Markdig:

Repository Stars
DevToys-app/DevToys A Swiss Army knife for developers. 29.0K
microsoft/semantic-kernel Integrate cutting-edge LLM technology quickly and easily into your apps 25.0K
dotnet/maui .NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop. 22.7K
dotnet/AspNetCore.Docs Documentation for ASP.NET Core 12.9K
JosefNemec/Playnite Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games. 10.8K
dodyg/practical-aspnetcore Practical samples of ASP.NET Core 10 Preview 4, 9, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects. 10.0K
OrchardCMS/OrchardCore Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework. 7.7K
BartoszCichecki/LenovoLegionToolkit Lightweight Lenovo Vantage and Hotkeys replacement for Lenovo Legion laptops. 6.5K
LykosAI/StabilityMatrix Multi-Platform Package Manager for Stable Diffusion 6.1K
ant-design-blazor/ant-design-blazor 🌈A rich set of enterprise-class UI components based on Ant Design and Blazor. 6.0K
ScottPlot/ScottPlot Interactive plotting library for .NET 5.9K
ServiceStack/ServiceStack Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all 5.5K
Richasy/Bili.Copilot B站第三方 Windows 桌面客户端,使用 Windows App SDK 构建的原生应用 4.5K
dotnet/docfx Static site generator for .NET API documentation. 4.3K
Ombi-app/Ombi Want a Movie or TV Show on Plex/Emby/Jellyfin? Use Ombi! 3.9K
Megabit/Blazorise Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material. 3.4K
jitwxs/163MusicLyrics 云音乐歌词获取处理工具【网易云、QQ音乐】 2.9K
Belphemur/SoundSwitch C# application to switch default playing device. Download: https://soundswitch.aaflalo.me/ 2.8K
loic-sharma/BaGet A lightweight NuGet and symbol server 2.7K
bloxstraplabs/bloxstrap An alternative bootstrapper for Roblox with a bunch of extra features. 2.3K
Version Downloads Last updated
0.41.2 9,288 6/5/2025
0.41.1 181,505 4/28/2025
0.41.0 76,879 4/15/2025
0.40.0 1,064,225 1/10/2025
0.39.1 188,110 12/19/2024
0.39.0 30,689 12/17/2024
0.38.0 739,428 10/25/2024
0.37.0 2,597,132 4/9/2024
0.36.2 466,719 3/14/2024
0.36.1 654 3/14/2024
0.36.0 20,246 3/14/2024
0.35.0 382,143 2/17/2024
0.34.0 819,423 12/14/2023
0.33.0 2,439,654 8/30/2023
0.32.0 361,832 8/4/2023
0.31.0 1,941,265 2/27/2023
0.30.4 2,095,401 9/27/2022
0.30.3 778,579 8/12/2022
0.30.2 1,383,139 4/23/2022
0.30.1 6,291 4/22/2022
0.30.0 54,748 4/21/2022
0.29.0 3,039 4/20/2022
0.28.1 225,527 3/27/2022
0.28.0 211,495 3/11/2022
0.27.0 534,045 1/23/2022
0.26.0 2,121,635 8/27/2021
0.25.0 832,750 6/10/2021
0.24.0 2,743,549 3/20/2021
0.23.0 1,831,688 1/16/2021
0.22.1 569,028 12/2/2020
0.22.0 2,631,382 10/5/2020
0.21.1 638,623 8/17/2020
0.21.0 9,509 8/17/2020
0.20.0 1,092,627 4/18/2020
0.18.3 415,046 3/8/2020
0.18.2 2,065 3/8/2020
0.18.1 528,176 1/21/2020
0.18.0 718,357 10/24/2019
0.17.1 735,117 7/4/2019
0.17.0 443,059 5/11/2019
0.16.0 572,928 2/25/2019
0.15.7 154,264 1/11/2019
0.15.6 22,382 12/28/2018
0.15.5 67,773 12/11/2018
0.15.4 743,348 10/7/2018
0.15.3 19,685 9/26/2018
0.15.2 244,021 8/21/2018
0.15.1 92,325 7/10/2018
0.15.0 642,668 4/4/2018
0.14.9 331,129 1/15/2018
0.14.8 183,439 12/5/2017
0.14.7 36,589 11/25/2017
0.14.6 67,511 11/21/2017
0.14.5 10,495 11/18/2017
0.14.4 4,104 11/18/2017
0.14.3 41,872 11/1/2017
0.14.2 4,157 11/1/2017
0.14.1 8,802 10/27/2017
0.14.0 4,115 10/27/2017
0.13.4 44,990 10/17/2017
0.13.3 81,784 8/30/2017
0.13.2 15,001 8/29/2017
0.13.1 144,172 8/21/2017
0.13.0 10,174 8/3/2017
0.12.4 29,867 7/31/2017
0.12.3 46,172 6/26/2017
0.12.2 8,779 6/18/2017
0.12.1 88,602 5/29/2017
0.12.0 4,213 5/28/2017
0.11.0 52,201 5/8/2017
0.10.7 27,353 4/1/2017
0.10.6 124,490 2/24/2017
0.10.5 61,351 2/14/2017
0.10.4 585,900 12/12/2016
0.10.3 55,547 11/29/2016
0.10.2 4,089 11/26/2016
0.10.1 6,203 11/19/2016
0.10.0 15,139 10/16/2016
0.9.1 5,002 10/11/2016
0.9.0 4,910 10/11/2016
0.8.5 7,952 9/23/2016
0.8.4 4,224 9/22/2016
0.8.3 4,598 9/22/2016
0.8.2 4,618 9/22/2016
0.8.1 4,513 9/21/2016
0.8.0 4,513 9/19/2016
0.7.5 4,440 9/18/2016
0.7.4 24,721 7/30/2016
0.7.3 5,705 7/23/2016
0.7.2 8,419 7/20/2016
0.7.1 6,859 6/30/2016
0.7.0 4,494 6/27/2016
0.6.2 4,275 6/25/2016
0.6.1 4,258 6/24/2016
0.6.0 4,187 6/24/2016
0.5.12 4,189 6/23/2016
0.5.11 4,171 6/23/2016
0.5.10 4,226 6/22/2016
0.5.9 33,270 6/21/2016
0.5.8 4,300 6/21/2016
0.5.7 4,288 6/20/2016
0.5.6 4,227 6/20/2016
0.5.5 4,257 6/20/2016
0.5.4 4,159 6/19/2016
0.5.3 4,225 6/19/2016
0.5.2 4,243 6/17/2016
0.5.1 4,401 6/15/2016
0.5.0 4,252 6/15/2016
0.4.0 4,408 6/13/2016
0.3.4 4,200 6/10/2016
0.3.3 4,261 6/10/2016
0.3.2 4,157 6/9/2016
0.3.1 4,200 6/9/2016
0.3.0 4,164 6/8/2016
0.2.1 4,233 6/6/2016
0.2.0 4,216 5/30/2016
0.1.1 4,216 5/30/2016
0.1.0 11,098 5/25/2016