A server-side entry in TopGit's GitHub warehouse: xoofx/markdig, 5.3k stars, Backend, C#. A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Markdig is a fast, powerful, CommonMark compliant, extensible Markdown processor for .NET.
Documentation: https://xoofx.github.io/markdig
You can try Markdig online and compare it to other implementations on babelmark3
Features
Very fast parser and html renderer (no-regexp), very lightweight in terms of GC pressure. See benchmarks
Abstract Syntax Tree with precise source code location for syntax tree, useful when building a Markdown editor.
Checkout Markdown Editor v2 for Visual Studio 2022 powered by Markdig!
Converter to HTML
Passing more than 600+ tests from the latest CommonMark specs (0.31.2)
Includes all the core elements of CommonMark:
including GFM fenced code blocks.
Extensible architecture
Even the core Markdown/CommonMark parsing is pluggable, so it allows to disable builtin Markdown/Commonmark parsing (e.g Disable HTML parsing) or change behaviour (e.g change matching # of a headers with @)
Roundtrip support: Parses trivia (whitespace, newlines and other characters) to support lossless parse ⭢ render roundtrip. This enables changing markdown documents without introducing undesired trivia changes.
Pipe tables (inspired from GitHub tables and PanDoc - Pipe Tables)
Grid tables (inspired from Pandoc - Grid Tables)
Extra emphasis (inspired from Pandoc - Emphasis and Markdown-it)
strike through ~~,
Subscript ~
Superscript ^
Inserted ++
Marked ==
Special attributes or attached HTML attributes (inspired from PHP Markdown Extra - Special Attributes)
Definition lists (inspired from PHP Markdown Extra - Definitions Lists)
Footnotes (inspired from PHP Markdown Extra - Footnotes)
Auto-identifiers for headings (similar to Pandoc - Auto Identifiers)
Auto-links generates links if a text starts with http:// or https:// or ftp:// or mailto: or www.xxx.yyy
Task Lists inspired from Github Task lists.
Extra bullet lists, supporting alpha bullet a.b. and roman bullet (i, ii...etc.)
Media support for media url (youtube, vimeo, mp4...etc.) (inspired from this CommonMark discussion)
Abbreviations (inspired from PHP Markdown Extra - Abbreviations)
Citation text by enclosing ""..."" (inspired by this CommonMark discussion )
Custom containers similar to fenced code block ::: for generating a proper <div>...</div> instead (inspired by this CommonMark discussion )
Figures (inspired from this CommonMark discussion)
Footers (inspired from this CommonMark discussion)
Mathematics/Latex extension by enclosing $$ for block and $ for inline math (inspired from this CommonMark discussion)
Soft lines as hard lines
Emoji support (inspired from Markdown-it)
SmartyPants (inspired from Daring Fireball - SmartyPants)
Bootstrap class (to output bootstrap class)
Diagrams extension whenever a fenced code block contains a special keyword, it will be converted to a div block with the content as-is (currently, supports mermaid and nomnoml diagrams)
YAML Front Matter to parse without evaluating the front matter and to discard it from the HTML output (typically used for previewing without the front matter in MarkdownEditor)
JIRA links to automatically generate links for JIRA project references (Thanks to @clarkd: https://github.com/clarkd/MarkdigJiraLinker)
CJK-friendly Emphasis to mitigate a CommonMark specification issue in CJK languages (Thanks to @tats-u: https://github.com/tats-u/markdown-cjk-friendly)
Starting with Markdig version 0.20.0+, Markdig is compatible only with NETStandard 2.0, NETStandard 2.1, NETCoreApp 2.1 and NETCoreApp 3.1.
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
WPF/XAML Markdown Renderer: markdig.wpf
WPF/XAML Markdown Renderer: Neo.Markdig.Xaml
Syntax highlighting: Markdig.SyntaxHighlighting
Syntax highlighting using ColorCode-Universal: Markdown.ColorCode
Syntax highlighting using Prism.js: WebStoating.Markdig.Prism
Full documentation is available at https://xoofx.github.io/markdig — covering getting started, usage, all extensions, and the developer guide for writing custom parsers and renderers.
For detailed specs and corner cases of each extension, see the specs documentation.
For a "behind the scene" article about Markdig, see the blog post "Implementing a Markdown Engine for .NET".
Download
Markdig is available as a NuGet package:
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 10.0
License
This software is released under the BSD-Clause 2 license.
Sponsors
Supports this project with a monthly donation and help me continue improving it. [Become a sponsor]
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, now included with this project!
How does xoofx/markdig compare to other Backend projects?
xoofx/markdig is tracked by TopGit in the Backend category, with 5.3k GitHub stars and written in C#. Browse the Backend topic page on TopGit to compare it against similar projects by stars and activity.
Is xoofx/markdig open source?
Yes — xoofx/markdig ships under the BSD-2-Clause license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/xoofx/markdig.
What else is in the Backend space?
xoofx/markdig is tracked by TopGit under the Backend category, alongside 11 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is xoofx/markdig?
xoofx/markdig (xoofx/markdig) is a C# project on GitHub. From the project's own README: A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
Where do I read more about xoofx/markdig?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/xoofx/markdig is the definitive source.
Why is xoofx/markdig categorized under Backend?
TopGit places xoofx/markdig in the Backend category based on its GitHub topics and description (tagged: "commonmark", "commonmark-parsing", "csharp"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Is markdig worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of markdig.