Alexandre Mutel 080dee270d Add benchmarks
2016-05-26 00:04:25 +09:00
2016-02-10 00:12:40 +09:00
2016-02-10 00:12:40 +09:00
2016-05-26 00:04:25 +09:00

Markdig NuGet

Markdig is a fast, powerfull, 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!

Features

Download

Markdig is available as a NuGet package: NuGet

Usage

The main entry point for the API is the 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 all extensions (except Emoji)

var result = Markdown.ToHtml("This is a text with some **emphasis**", new MarkdownPipeline().UseAllExtensions());

You can have a look at the MarkdownPipeline file that describes all actionable extensions.

License

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

Benchmarking

This is an early preview of the benchmarking against various implementations:

  • Markdig: itself
  • CommonMarkCpp: cmark, Reference C implementation of CommonMark
  • CommonMark.NET: CommonMark implementation for .NET, not extensible, port of cmark
  • MarkdownDeep another .NET implementation
  • MarkdownSharp: Open source C# implementation of Markdown processor, as featured on Stack Overflow, regexp based.
  • Moonshine: popular C Markdown processor

Markdig is roughly x100 times faster than MarkdownSharp and extremelly competitive to other implems (that are not feature wise comparable)

// * Summary *

BenchmarkDotNet=v0.9.6.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, ProcessorCount=8
Frequency=3319351 ticks, Resolution=301.2637 ns, Timer=TSC
HostCLR=MS.NET 4.0.30319.42000, Arch=32-bit RELEASE
JitModules=clrjit-v4.6.1080.0

Type=Program  Mode=Throughput  LaunchCount=2
WarmupCount=2  TargetCount=10

               Method |      Median |    StdDev |
--------------------- |------------ |---------- |
              Markdig |   5.7798 ms | 0.0704 ms |
        CommonMarkCpp |   4.2094 ms | 0.0814 ms |
        CommonMarkNet |   4.8176 ms | 0.0536 ms |
CommonMarkNet (devel) |   5.7454 ms | 0.0907 ms |
         MarkdownDeep |   7.9569 ms | 0.0622 ms |
        MarkdownSharp | 689.4781 ms | 1.6341 ms |
            Moonshine |   6.1299 ms | 0.2440 ms |

// ***** BenchmarkRunner: End *****

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.

Author

Alexandre MUTEL aka xoofx

Description
No description provided
Readme 8.3 MiB
Latest
2026-02-10 06:11:01 +00:00
Languages
C# 99.9%