Markdig 0.38.0

Markdig Build Status Coverage Status NuGet Donate

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

Showing the top 20 packages that depend on Markdig.

Packages Downloads
Aiursoft.DocGenerator
A tool for generating document for ASP.NET Core.
119
MoongladePure.Utils
Package Description
9
MoongladePure.Utils
Package Description
8
MoongladePure.Utils
Package Description
7
Aiursoft.BaGet.Web
BaGet's NuGet server implementation
7
BaGet.Web
BaGet's NuGet server implementation
6
Microsoft.Fast.Components.FluentUI
A set of Blazor components wrapping Microsoft’s official Fluent UI Web Components. They implement the latest state of the Fluent design language, are built on FAST and work in every major browser.
4
Microsoft.Fast.Components.FluentUI
A set of Blazor components wrapping Microsoft’s official Fluent UI Web Components. They implement the latest state of the Fluent design language, are built on FAST and work in every major browser.
3

https://github.com/xoofx/markdig/releases/tag/0.38.0

.NET Framework 4.6.2

.NET 6.0

  • No dependencies.

.NET 8.0

  • No dependencies.

.NET Standard 2.0

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
0.38.0 134 10/26/2024
0.37.0 271 04/10/2024
0.36.2 92 03/25/2024
0.36.1 6 03/31/2024
0.36.0 5 05/12/2024
0.35.0 117 03/25/2024
0.34.0 6 04/29/2024
0.33.0 6 04/29/2024
0.32.0 8 04/29/2024
0.31.0 4 04/29/2024
0.30.4 7 04/29/2024
0.30.3 4 04/05/2024
0.30.2 5 04/29/2024
0.30.1 5 04/29/2024
0.30.0 5 04/29/2024
0.29.0 3 04/29/2024
0.28.1 5 04/29/2024
0.28.0 5 04/29/2024
0.27.0 5 04/29/2024
0.26.0 6 04/29/2024
0.25.0 4 04/29/2024
0.24.0 3 04/29/2024
0.23.0 7 04/29/2024
0.22.1 8 04/29/2024
0.22.0 3 04/29/2024
0.21.1 4 04/29/2024
0.21.0 6 04/09/2024
0.20.0 3 04/29/2024
0.18.3 3 04/29/2024
0.18.2 4 04/29/2024
0.18.1 5 04/06/2024
0.18.0 5 04/10/2024
0.17.1 5 04/29/2024
0.17.0 4 04/29/2024
0.16.0 3 04/29/2024
0.15.7 5 04/29/2024
0.15.6 4 04/29/2024
0.15.5 5 04/29/2024
0.15.4 4 04/29/2024
0.15.3 3 06/04/2024
0.15.2 4 04/29/2024
0.15.1 6 04/29/2024
0.15.0 5 04/29/2024
0.14.9 5 04/29/2024
0.14.8 7 04/25/2024
0.14.7 7 04/29/2024
0.14.6 7 04/29/2024
0.14.5 5 04/29/2024
0.14.4 4 04/29/2024
0.14.3 6 04/29/2024
0.14.2 4 04/29/2024
0.14.1 6 04/29/2024
0.14.0 5 04/29/2024
0.13.4 4 04/29/2024
0.13.3 3 04/29/2024
0.13.2 6 04/29/2024
0.13.1 4 04/29/2024
0.13.0 5 04/29/2024
0.12.4 7 04/29/2024
0.12.3 6 04/29/2024
0.12.2 5 04/29/2024
0.12.1 4 04/29/2024
0.12.0 5 04/29/2024
0.11.0 5 04/29/2024
0.10.7 6 04/18/2024
0.10.6 4 04/29/2024
0.10.5 3 04/29/2024
0.10.4 4 04/29/2024
0.10.3 5 04/29/2024
0.10.2 4 04/29/2024
0.10.1 6 04/29/2024
0.10.0 4 04/29/2024
0.9.1 5 04/29/2024
0.9.0 5 04/29/2024
0.8.5 5 04/29/2024
0.8.4 5 04/29/2024
0.8.3 5 04/06/2024
0.8.2 4 04/29/2024
0.8.1 4 04/29/2024
0.8.0 7 04/05/2024
0.7.5 4 04/29/2024
0.7.4 6 04/29/2024
0.7.3 4 04/29/2024
0.7.2 3 04/29/2024
0.7.1 4 04/29/2024
0.7.0 3 04/29/2024
0.6.2 5 04/29/2024
0.6.1 6 04/29/2024
0.6.0 4 04/15/2024
0.5.12 6 04/29/2024
0.5.11 5 04/29/2024
0.5.10 7 04/29/2024
0.5.9 4 04/29/2024
0.5.8 3 04/29/2024
0.5.7 3 04/29/2024
0.5.6 5 04/29/2024
0.5.5 5 04/29/2024
0.5.4 5 04/29/2024
0.5.3 3 04/29/2024
0.5.2 4 04/29/2024
0.5.1 4 04/29/2024
0.5.0 4 04/29/2024
0.4.0 8 04/29/2024
0.3.4 5 04/29/2024
0.3.3 4 04/29/2024
0.3.2 6 03/26/2024
0.3.1 5 04/29/2024
0.3.0 4 04/29/2024
0.2.1 5 04/29/2024
0.2.0 5 04/29/2024
0.1.1 4 04/29/2024
0.1.0 4 04/29/2024