{"id":29614924,"url":"https://github.com/lunet-io/markdig","last_synced_at":"2025-07-21T00:01:48.815Z","repository":{"id":37880104,"uuid":"59669326","full_name":"xoofx/markdig","owner":"xoofx","description":"A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET","archived":false,"fork":false,"pushed_at":"2025-06-24T06:41:24.000Z","size":5297,"stargazers_count":4855,"open_issues_count":122,"forks_count":484,"subscribers_count":95,"default_branch":"master","last_synced_at":"2025-07-17T13:27:32.006Z","etag":null,"topics":["commonmark","commonmark-parsing","csharp","dotnet","dotnetcore","gfm","markdown","markdown-flavors","markdown-parser","markdown-processor","markdown-to-html"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xoofx.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":"contributing.md","funding":".github/FUNDING.yml","license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["xoofx"]}},"created_at":"2016-05-25T14:18:26.000Z","updated_at":"2025-07-17T08:33:46.000Z","dependencies_parsed_at":"2023-11-14T18:46:24.439Z","dependency_job_id":"d1450995-de21-4bcb-a46b-d6f7bd45ba0b","html_url":"https://github.com/xoofx/markdig","commit_stats":{"total_commits":1344,"total_committers":89,"mean_commits":"15.101123595505618","dds":0.5877976190476191,"last_synced_commit":"b7cb169fd3a924e1e0d4e2e487a22c51caaedd10"},"previous_names":["lunet-io/markdig"],"tags_count":119,"template":false,"template_full_name":null,"purl":"pkg:github/xoofx/markdig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoofx%2Fmarkdig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoofx%2Fmarkdig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoofx%2Fmarkdig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoofx%2Fmarkdig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xoofx","download_url":"https://codeload.github.com/xoofx/markdig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoofx%2Fmarkdig/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266217170,"owners_count":23894242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commonmark","commonmark-parsing","csharp","dotnet","dotnetcore","gfm","markdown","markdown-flavors","markdown-parser","markdown-processor","markdown-to-html"],"created_at":"2025-07-21T00:01:23.105Z","updated_at":"2025-07-21T00:01:48.749Z","avatar_url":"https://github.com/xoofx.png","language":"C#","readme":"# Markdig [![ci](https://github.com/xoofx/markdig/actions/workflows/ci.yml/badge.svg)](https://github.com/xoofx/markdig/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/xoofx/markdig/badge.svg?branch=master)](https://coveralls.io/github/xoofx/markdig?branch=master) [![NuGet](https://img.shields.io/nuget/v/Markdig.svg)](https://www.nuget.org/packages/Markdig/) [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=FRGHXBTP442JL)\n\n\u003cimg align=\"right\" width=\"160px\" height=\"160px\" src=\"img/markdig.png\"\u003e\n\nMarkdig is a fast, powerful, [CommonMark](https://commonmark.org/) compliant, extensible Markdown processor for .NET.\n\n\u003e NOTE: The repository is under construction. There will be a dedicated website and proper documentation at some point!\n\nYou can **try Markdig online** and compare it to other implementations on [babelmark3](https://babelmark.github.io/?text=Hello+**Markdig**!)\n\n## Features\n\n- **Very fast parser and html renderer** (no-regexp), very lightweight in terms of GC pressure. See benchmarks\n- **Abstract Syntax Tree** with precise source code location for syntax tree, useful when building a Markdown editor.\n  - Checkout [Markdown Editor v2 for Visual Studio 2022](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.MarkdownEditor2) powered by Markdig!\n- Converter to **HTML**\n- Passing more than **600+ tests** from the latest [CommonMark specs (0.31.2)](https://spec.commonmark.org/)\n- Includes all the core elements of CommonMark:\n  - including **GFM fenced code blocks**.  \n- **Extensible** architecture\n  - Even the core Markdown/CommonMark parsing is pluggable, so it allows to disable builtin Markdown/Commonmark parsing (e.g [Disable HTML parsing](https://github.com/lunet-io/markdig/blob/7964bd0160d4c18e4155127a4c863d61ebd8944a/src/Markdig/MarkdownExtensions.cs#L306)) or change behaviour (e.g change matching `#` of a headers with `@`)   \n- [**Roundtrip support**](./src/Markdig/Roundtrip.md): Parses trivia (whitespace, newlines and other characters) to support lossless parse ⭢ render roundtrip. This enables changing markdown documents without introducing undesired trivia changes.\n- Built-in with **20+ extensions**, including:\n  - 2 kind of tables:\n    - [**Pipe tables**](src/Markdig.Tests/Specs/PipeTableSpecs.md) (inspired from GitHub tables and [PanDoc - Pipe Tables](https://pandoc.org/MANUAL.html#extension-pipe_tables))\n    - [**Grid tables**](src/Markdig.Tests/Specs/GridTableSpecs.md) (inspired from [Pandoc - Grid Tables](https://pandoc.org/MANUAL.html#extension-grid_tables)) \n  - [**Extra emphasis**](src/Markdig.Tests/Specs/EmphasisExtraSpecs.md) (inspired from [Pandoc - Emphasis](https://pandoc.org/MANUAL.html#strikeout) and [Markdown-it](https://markdown-it.github.io/)) \n    - strike through `~~`,\n    - Subscript `~`\n    - Superscript `^` \n    - Inserted `++`\n    - Marked `==`\n  - [**Special attributes**](src/Markdig.Tests/Specs/GenericAttributesSpecs.md) or attached HTML attributes (inspired from [PHP Markdown Extra - Special Attributes](https://michelf.ca/projects/php-markdown/extra/#spe-attr))\n  - [**Definition lists**](src/Markdig.Tests/Specs/DefinitionListSpecs.md) (inspired from [PHP Markdown Extra - Definitions Lists](https://michelf.ca/projects/php-markdown/extra/#def-list))\n  - [**Footnotes**](src/Markdig.Tests/Specs/FootnotesSpecs.md) (inspired from [PHP Markdown Extra - Footnotes](https://michelf.ca/projects/php-markdown/extra/#footnotes))\n  - [**Auto-identifiers**](src/Markdig.Tests/Specs/AutoIdentifierSpecs.md) for headings (similar to [Pandoc - Auto Identifiers](https://pandoc.org/MANUAL.html#extension-auto_identifiers))\n  - [**Auto-links**](src/Markdig.Tests/Specs/AutoLinks.md) generates links if a text starts with `http://` or `https://` or `ftp://` or `mailto:` or `www.xxx.yyy`\n  - [**Task Lists**](src/Markdig.Tests/Specs/TaskListSpecs.md)  inspired from [Github Task lists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments).\n  - [**Extra bullet lists**](src/Markdig.Tests/Specs/ListExtraSpecs.md), supporting alpha bullet `a.` `b.` and roman bullet (`i`, `ii`...etc.)\n  - [**Media support**](src/Markdig.Tests/Specs/MediaSpecs.md) for media url (youtube, vimeo, mp4...etc.) (inspired from this [CommonMark discussion](https://talk.commonmark.org/t/embedded-audio-and-video/441))\n  - [**Abbreviations**](src/Markdig.Tests/Specs/AbbreviationSpecs.md) (inspired from [PHP Markdown Extra - Abbreviations](https://michelf.ca/projects/php-markdown/extra/#abbr))\n  - [**Citation**](src/Markdig.Tests/Specs/FigureFooterAndCiteSpecs.md) text by enclosing `\"\"...\"\"` (inspired by this [CommonMark discussion ](https://talk.commonmark.org/t/referencing-creative-works-with-cite/892))\n  - [**Custom containers**](src/Markdig.Tests/Specs/CustomContainerSpecs.md) similar to fenced code block `:::` for generating a proper `\u003cdiv\u003e...\u003c/div\u003e` instead (inspired by this [CommonMark discussion ](https://talk.commonmark.org/t/custom-container-for-block-and-inline/2051))\n  - [**Figures**](src/Markdig.Tests/Specs/FigureFooterAndCiteSpecs.md) (inspired from this [CommonMark discussion](https://talk.commonmark.org/t/image-tag-should-expand-to-figure-when-used-with-title/265/5))\n  - [**Footers**](src/Markdig.Tests/Specs/FigureFooterAndCiteSpecs.md) (inspired from this [CommonMark discussion](https://talk.commonmark.org/t/syntax-for-footer/2070))\n  - [**Mathematics**](src/Markdig.Tests/Specs/MathSpecs.md)/Latex extension by enclosing `$$` for block and `$` for inline math (inspired from this [CommonMark discussion](https://talk.commonmark.org/t/mathematics-extension/457/31))\n  - [**Soft lines as hard lines**](src/Markdig.Tests/Specs/HardlineBreakSpecs.md)\n  - [**Emoji**](src/Markdig.Tests/Specs/EmojiSpecs.md) support (inspired from [Markdown-it](https://markdown-it.github.io/))\n  - [**SmartyPants**](src/Markdig.Tests/Specs/SmartyPantsSpecs.md) (inspired from [Daring Fireball - SmartyPants](https://daringfireball.net/projects/smartypants/))\n  - [**Bootstrap**](src/Markdig.Tests/Specs/BootstrapSpecs.md) class (to output bootstrap class)\n  - [**Diagrams**](src/Markdig.Tests/Specs/DiagramsSpecs.md) 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`](https://mermaid.js.org) and [`nomnoml`](https://github.com/skanaar/nomnoml) diagrams)\n  - [**YAML Front Matter**](src/Markdig.Tests/Specs/YamlSpecs.md) 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)\n  - [**JIRA links**](src/Markdig.Tests/Specs/JiraLinks.md) to automatically generate links for JIRA project references (Thanks to @clarkd: https://github.com/clarkd/MarkdigJiraLinker)\n- 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`.\n\nIf you are looking for support for an old .NET Framework 3.5 or 4.0, you can download Markdig `0.18.3`.\n\t\n### Third Party Extensions\n\n- [**WPF/XAML Markdown Renderer**: `markdig.wpf`](https://github.com/Kryptos-FR/markdig.wpf)\n- [**WPF/XAML Markdown Renderer**: `Neo.Markdig.Xaml`](https://github.com/neolithos/NeoMarkdigXaml)\n- [**Syntax highlighting**: `Markdig.SyntaxHighlighting`](https://github.com/RichardSlater/Markdig.SyntaxHighlighting)\n- [**Syntax highlighting using ColorCode-Universal**: `Markdown.ColorCode`](https://github.com/wbaldoumas/markdown-colorcode)\n- [**Syntax highlighting using Prism.js**: `WebStoating.Markdig.Prism`](https://github.com/ilich/Markdig.Prism)\n- [**Embedded C# scripting**: `Markdig.Extensions.ScriptCs`](https://github.com/macaba/Markdig.Extensions.ScriptCs)\n\n## Documentation\n\n\u003e The repository is under construction. There will be a dedicated website and proper documentation at some point!\n\nWhile there is not yet a dedicated documentation, you can find from the [specs documentation](src/Markdig.Tests/Specs/readme.md) how to use these extensions.\n\nIn the meantime, you can have a \"behind the scene\" article about Markdig in my blog post [\"Implementing a Markdown Engine for .NET\"](https://xoofx.github.io/blog/2016/06/13/implementing-a-markdown-processor-for-dotnet/)\n\n## Download\n\nMarkdig is available as a NuGet package: [![NuGet](https://img.shields.io/nuget/v/Markdig.svg)](https://www.nuget.org/packages/Markdig/)\n\nAlso [Markdig.Signed](https://www.nuget.org/packages/Markdig.Signed/) NuGet package provides signed assemblies.\n\n## Usage\n\nThe main entry point for the API is the `Markdig.Markdown` class:\n\nBy default, without any options, Markdig is using the plain CommonMark parser:\n\n```csharp\nvar result = Markdown.ToHtml(\"This is a text with some *emphasis*\");\nConsole.WriteLine(result);   // prints: \u003cp\u003eThis is a text with some \u003cem\u003eemphasis\u003c/em\u003e\u003c/p\u003e\n```\n\nIn order to activate most of all advanced extensions (except Emoji, SoftLine as HardLine, Bootstrap, YAML Front Matter, JiraLinks and SmartyPants)\n\n```csharp\n// Configure the pipeline with all advanced extensions active\nvar pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();\nvar result = Markdown.ToHtml(\"This is a text with some *emphasis*\", pipeline);\n```\n\n[Try it online!](https://dotnetfiddle.net/GoZXyI)\n\nYou can have a look at the [MarkdownExtensions](https://github.com/lunet-io/markdig/blob/master/src/Markdig/MarkdownExtensions.cs) that describes all actionable extensions (by modifying the MarkdownPipeline)\n\n## Contributing\n\nContributions 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](contributing.md).\n\n## Build\n\nIn order to build Markdig, you need to install [.NET 6.0](https://dotnet.microsoft.com/en-us/download)\n\n## License\n\nThis software is released under the [BSD-Clause 2 license](https://github.com/lunet-io/markdig/blob/master/license.txt).\n\n\n## Benchmarking\n\nThe latest benchmark was collected on April 23 2022, against the following implementations:\n\n- [Markdig](https://github.com/lunet-io/markdig) (version: 0.30.2): itself\n- [cmark](https://github.com/commonmark/cmark) (version: 0.30.2): Reference C implementation of CommonMark, no support for extensions\n- [CommonMark.NET(master)](https://github.com/Knagis/CommonMark.NET) (version: 0.15.1): CommonMark implementation for .NET, no support for extensions, port of cmark, deprecated.\n- [MarkdownSharp](https://github.com/Kiri-rin/markdownsharp) (version: 2.0.5): Open source C# implementation of Markdown processor, as featured previously on Stack Overflow, regexp based.\n\n```\n// * Summary *\n\nBenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000\nAMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores\n.NET SDK=6.0.202\n  [Host]     : .NET 6.0.4 (6.0.422.16404), X64 RyuJIT\n  DefaultJob : .NET 6.0.4 (6.0.422.16404), X64 RyuJIT\n\n\n|            Method |       Mean |     Error |    StdDev |\n|------------------ |-----------:|----------:|----------:|\n|           markdig |   1.979 ms | 0.0221 ms | 0.0185 ms |\n|             cmark |   2.571 ms | 0.0081 ms | 0.0076 ms |\n|    CommonMark.NET |   2.016 ms | 0.0169 ms | 0.0158 ms |\n|     MarkdownSharp | 221.455 ms | 1.4442 ms | 1.3509 ms |\n```\n\n- Markdig is roughly **x100 times faster than MarkdownSharp**\n- **20% faster than the reference cmark C implementation** \n\n## Sponsors\n\nSupports this project with a monthly donation and help me continue improving it. \\[[Become a sponsor](https://github.com/sponsors/xoofx)\\]\n\n[\u003cimg src=\"https://github.com/lilith.png?size=200\" width=\"64px;\" style=\"border-radius: 50%\" alt=\"lilith\"/\u003e](https://github.com/lilith) Lilith River, author of [Imageflow Server, an easy on-demand\nimage editing, optimization, and delivery server](https://github.com/imazen/imageflow-server)\n\n## Credits\n\nThanks to the fantastic work done by [John Mac Farlane](https://johnmacfarlane.net/) for the CommonMark specs and all the people involved in making Markdown a better standard!\n\nThis project would not have been possible without this huge foundation.\n\nThanks also to the project [BenchmarkDotNet](https://github.com/PerfDotNet/BenchmarkDotNet) that makes benchmarking so easy to setup!\n\nSome decoding part (e.g HTML [EntityHelper.cs](https://github.com/lunet-io/markdig/blob/master/src/Markdig/Helpers/EntityHelper.cs)) have been re-used from [CommonMark.NET](https://github.com/Knagis/CommonMark.NET)\n\nThanks to the work done by @clarkd on the [JIRA Link extension](https://github.com/clarkd/MarkdigJiraLinker), now included with this project!\n## Author\n\nAlexandre MUTEL aka [xoofx](https://xoofx.github.io/)\n","funding_links":["https://github.com/sponsors/xoofx","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=FRGHXBTP442JL"],"categories":["Frameworks, Libraries and Tools","框架, 库和工具","Markdown Processors","Markdown parser","C# Tools and Frameworks","Tools","C# Tools, Libraries and Frameworks","C# Tools","High Performance Libraries","Markdown处理器","Parsing"],"sub_categories":["Misc","大杂烩","Interfaces","viii. Linear Regression","E-Books","VS Code Extensions for Developer Productivity","Objective-C Tools, Libraries, and Frameworks","Mesh networks","Application Insights","GUI - other"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunet-io%2Fmarkdig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flunet-io%2Fmarkdig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunet-io%2Fmarkdig/lists"}