Markdig is a markdown parser library that converts text into structured HTML, plain text, or other formats using a configurable pipeline. It functions as a CommonMark compliant parser and an abstract syntax tree generator that transforms markdown into a hierarchical tree of block and inline nodes with precise source location mapping.
The project is distinguished by a decoupled renderer architecture that separates parsing logic from output generation, enabling the transformation of the syntax tree into non-HTML formats such as LaTeX or XAML. It also serves as a lossless markdown processor by tracking non-semantic whitespace and trivia, which allows documents to be re-rendered without losing original formatting.
The library covers a broad range of capabilities including the ability to extend markdown syntax through pluggable parser extensions and the manipulation of the abstract syntax tree for document analysis. It supports advanced elements such as tables, mathematics, and footnotes, and includes features for international text handling, typography enhancements, and YAML front matter extraction.
Rendered output can be written directly to a text stream to reduce memory overhead for large documents.