Markdig 0.36.2

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Markdig --version 0.36.2
NuGet\Install-Package Markdig -Version 0.36.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Markdig" Version="0.36.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Markdig --version 0.36.2
#r "nuget: Markdig, 0.36.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Markdig as a Cake Addin
#addin nuget:?package=Markdig&version=0.36.2

// Install Markdig as a Cake Tool
#tool nuget:?package=Markdig&version=0.36.2

Markdig Build Status Coverage Status NuGet Donate

<img align="right" width="160px" height="160px" src="img/markdig.png">

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:

  • Markdig (version: 0.30.2): itself
  • cmark (version: 0.30.2): Reference C implementation of CommonMark, no support for extensions
  • CommonMark.NET(master) (version: 0.15.1): CommonMark implementation for .NET, no support for extensions, port of cmark, deprecated.
  • MarkdownSharp (version: 2.0.5): Open source C# implementation of Markdown processor, as featured previously on Stack Overflow, regexp based.
// * 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 |
  • Markdig is roughly x100 times faster than MarkdownSharp
  • 20% faster than the reference cmark C implementation

If you are using this library and find it useful for your project, please consider a donation for it!

Donate

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!

Author

Alexandre MUTEL aka xoofx

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

  • .NETStandard 2.0

  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (296)

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.

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 For similar features in System.Web based classic ASP.NET apps see `Westwind.Web.Markdown`.

FenixAlliance.ACL.Dependencies

Application Component for the Alliance Business Suite.

Octostache

Variable substitution syntax used in Octopus Deploy.

Piranha The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Core package for Piranha CMS for .NET Core

GitHub repositories (126)

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

Repository Stars
DevToys-app/DevToys
A Swiss Army knife for developers.
dotnet/maui
.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 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.
Version Downloads Last updated
0.36.2 4,461 3/14/2024
0.36.1 63 3/14/2024
0.36.0 1,753 3/14/2024
0.35.0 78,732 2/17/2024
0.34.0 319,722 12/14/2023
0.33.0 794,433 8/30/2023
0.32.0 191,606 8/4/2023
0.31.0 1,320,144 2/27/2023
0.30.4 1,507,162 9/27/2022
0.30.3 497,273 8/12/2022
0.30.2 1,145,312 4/23/2022
0.30.1 5,953 4/22/2022
0.30.0 52,484 4/21/2022
0.29.0 2,511 4/20/2022
0.28.1 183,790 3/27/2022
0.28.0 180,275 3/11/2022
0.27.0 459,379 1/23/2022
0.26.0 1,605,596 8/27/2021
0.25.0 752,858 6/10/2021
0.24.0 1,459,822 3/20/2021
0.23.0 1,492,020 1/16/2021
0.22.1 509,911 12/2/2020
0.22.0 2,069,132 10/5/2020
0.21.1 554,269 8/17/2020
0.21.0 8,458 8/17/2020
0.20.0 941,170 4/18/2020
0.18.3 359,704 3/8/2020
0.18.2 1,733 3/8/2020
0.18.1 470,096 1/21/2020
0.18.0 619,413 10/24/2019
0.17.1 675,350 7/4/2019
0.17.0 431,239 5/11/2019
0.16.0 510,126 2/25/2019
0.15.7 142,950 1/11/2019
0.15.6 21,559 12/28/2018
0.15.5 65,105 12/11/2018
0.15.4 586,863 10/7/2018
0.15.3 18,409 9/26/2018
0.15.2 219,530 8/21/2018
0.15.1 85,756 7/10/2018
0.15.0 571,696 4/4/2018
0.14.9 314,714 1/15/2018
0.14.8 167,958 12/5/2017
0.14.7 32,122 11/25/2017
0.14.6 60,920 11/21/2017
0.14.5 9,768 11/18/2017
0.14.4 3,746 11/18/2017
0.14.3 37,079 11/1/2017
0.14.2 3,796 11/1/2017
0.14.1 7,641 10/27/2017
0.14.0 3,760 10/27/2017
0.13.4 36,935 10/17/2017
0.13.3 72,942 8/30/2017
0.13.2 14,146 8/29/2017
0.13.1 142,641 8/21/2017
0.13.0 9,759 8/3/2017
0.12.4 26,904 7/31/2017
0.12.3 41,244 6/26/2017
0.12.2 7,386 6/18/2017
0.12.1 80,300 5/29/2017
0.12.0 3,827 5/28/2017
0.11.0 45,334 5/8/2017
0.10.7 26,589 4/1/2017
0.10.6 115,762 2/24/2017
0.10.5 59,912 2/14/2017
0.10.4 435,582 12/12/2016
0.10.3 48,617 11/29/2016
0.10.2 3,684 11/26/2016
0.10.1 5,827 11/19/2016
0.10.0 14,243 10/16/2016
0.9.1 4,633 10/11/2016
0.9.0 4,536 10/11/2016
0.8.5 7,013 9/23/2016
0.8.4 3,869 9/22/2016
0.8.3 4,224 9/22/2016
0.8.2 4,224 9/22/2016
0.8.1 4,164 9/21/2016
0.8.0 4,133 9/19/2016
0.7.5 4,041 9/18/2016
0.7.4 21,448 7/30/2016
0.7.3 5,302 7/23/2016
0.7.2 7,534 7/20/2016
0.7.1 6,218 6/30/2016
0.7.0 4,154 6/27/2016
0.6.2 3,903 6/25/2016
0.6.1 3,897 6/24/2016
0.6.0 3,828 6/24/2016
0.5.12 3,824 6/23/2016
0.5.11 3,809 6/23/2016
0.5.10 3,855 6/22/2016
0.5.9 32,859 6/21/2016
0.5.8 3,925 6/21/2016
0.5.7 3,931 6/20/2016
0.5.6 3,866 6/20/2016
0.5.5 3,896 6/20/2016
0.5.4 3,826 6/19/2016
0.5.3 3,848 6/19/2016
0.5.2 3,867 6/17/2016
0.5.1 4,030 6/15/2016
0.5.0 3,886 6/15/2016
0.4.0 4,054 6/13/2016
0.3.4 3,808 6/10/2016
0.3.3 3,895 6/10/2016
0.3.2 3,805 6/9/2016
0.3.1 3,819 6/9/2016
0.3.0 3,806 6/8/2016
0.2.1 3,869 6/6/2016
0.2.0 3,848 5/30/2016
0.1.1 3,842 5/30/2016
0.1.0 6,383 5/25/2016