# xoofx/markdig

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/xoofx-markdig).**

5,127 stars · 505 forks · C# · bsd-2-clause

## Links

- GitHub: https://github.com/xoofx/markdig
- awesome-repositories: https://awesome-repositories.com/repository/xoofx-markdig.md

## Topics

`commonmark` `commonmark-parsing` `csharp` `dotnet` `dotnetcore` `gfm` `markdown` `markdown-flavors` `markdown-parser` `markdown-processor` `markdown-to-html`

## Description

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.

## Tags

### Content Management & Publishing

- [Markdown to HTML Converters](https://awesome-repositories.com/f/content-management-publishing/markdown-to-html-converters.md) — Transforms Markdown plaintext markup into structured HTML for web display. ([source](https://cdn.jsdelivr.net/gh/xoofx/markdig@master/README.md))
- [CommonMark Compliant Parsers](https://awesome-repositories.com/f/content-management-publishing/commonmark-compliant-parsers.md) — Adheres to the CommonMark standard to ensure consistent processing of headings, lists, and links.
- [Markdown Abstract Syntax Trees](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/document-processing-conversion/document-processing/format-specific-parsers/markdown-abstract-syntax-trees.md) — Generates an abstract syntax tree with precise source locations to power external analysis tools and highlighters. ([source](https://xoofx.github.io/markdig))
- [Tree-to-Text Serializers](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/document-processing-conversion/document-processing/format-specific-parsers/markdown-abstract-syntax-trees/tree-to-text-serializers.md) — Implements a mechanism to serialize the abstract syntax tree back into various text formats. ([source](https://xoofx.github.io/markdig/docs/usage))
- [Markdown Parsers](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/markdown-markup-tools/markdown-processors/markdown-parsers.md) — Supports extending standard markdown syntax through a pluggable pipeline of custom block and inline parsers.
- [Custom Format Renderers](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/markdown-markup-tools/markdown-tools/markdown-renderers/custom-format-renderers.md) — Transforms parsed markdown into alternative output formats such as LaTeX or XAML.
- [Markdown Parsing Pipelines](https://awesome-repositories.com/f/content-management-publishing/markdown-parsing-pipelines.md) — Converts markdown text into structured HTML or other formats using a configurable pipeline of extensions. ([source](https://xoofx.github.io/markdig/docs/extensions))
- [Markdown Renderers](https://awesome-repositories.com/f/content-management-publishing/markdown-renderers.md) — Provides a flexible rendering system to transform parsed markdown into multiple target formats. ([source](https://xoofx.github.io/markdig/docs/getting-started))
- [Non-HTML Renderers](https://awesome-repositories.com/f/content-management-publishing/markdown-renderers/non-html-renderers.md) — Enables transformation of markdown into alternative formats like LaTeX and XAML via a decoupled architecture. ([source](https://xoofx.github.io/markdig/docs/getting-started/))
- [Markdown to Plain Text Converters](https://awesome-repositories.com/f/content-management-publishing/markdown-to-plain-text-converters.md) — Strips all formatting and HTML tags from a document to produce a clean, text-only version of content. ([source](https://xoofx.github.io/markdig/docs/getting-started))
- [Markdown Processors](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/markdown-markup-tools/markdown-processors.md) — Acts as a lossless processor by tracking non-semantic whitespace and trivia for exact re-rendering.
- [Technical Content Renderers](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/markdown-markup-tools/markdown-tools/technical-content-renderers.md) — Provides rendering for advanced technical elements including mathematics, tables, and footnotes. ([source](https://xoofx.github.io/markdig/docs/))
- [Document Metadata Extraction](https://awesome-repositories.com/f/content-management-publishing/document-metadata-extraction.md) — Extracts YAML front matter and manages pragma lines to enrich document metadata. ([source](https://xoofx.github.io/markdig/docs/extensions))
- [Code Display & Snippets](https://awesome-repositories.com/f/content-management-publishing/documentation-knowledge-management/code-display-snippets.md) — Supports the rendering of inline and block code snippets with language identifiers. ([source](https://xoofx.github.io/markdig/docs/commonmark))
- [Plain Text Converters](https://awesome-repositories.com/f/content-management-publishing/markdown-to-rich-text-parsers/plain-text-converters.md) — Provides the ability to strip all formatting and tags to output plain-text content.

### Data & Databases

- [Trivia Tracking](https://awesome-repositories.com/f/data-databases/data-transcoders/lossless/trivia-tracking.md) — Ensures lossless processing by tracking whitespace and trivia, allowing the source to be re-rendered exactly.
- [Markdown Roundtrips](https://awesome-repositories.com/f/data-databases/data-transcoders/lossless/markdown-roundtrips.md) — Parses trivia characters like whitespace to allow documents to be modified and rendered without losing original formatting. ([source](https://cdn.jsdelivr.net/gh/xoofx/markdig@master/README.md))

### Development Tools & Productivity

- [Source Text Mapping](https://awesome-repositories.com/f/development-tools-productivity/ast-transformation-tools/ast-node-location/source-text-mapping.md) — Maps every node in the parsed syntax tree to its precise character offsets in the source text. ([source](https://xoofx.github.io/markdig/docs/advanced/ast))
- [AST Node Location Mapping](https://awesome-repositories.com/f/development-tools-productivity/source-map-generators/ast-node-location-mapping.md) — Maps every node in the parsed syntax tree back to its exact character offsets and line positions.
- [Parsing Rule Configurations](https://awesome-repositories.com/f/development-tools-productivity/configuration-extensions/parsing-rule-configurations.md) — Allows users to toggle specific syntax extensions and parsing rules through a configuration pipeline. ([source](https://xoofx.github.io/markdig/docs/usage))

### Software Engineering & Architecture

- [Abstract Syntax Tree Parsing](https://awesome-repositories.com/f/software-engineering-architecture/abstract-syntax-tree-parsing.md) — Provides the ability to parse markdown into a structured abstract syntax tree for further analysis and rendering.
- [Parser Rule Extensions](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/extensibility/plugin-architectures/developer-authoring-interfaces/custom-module-implementations/module-functionality-extenders/plugin-extenders/parser-rule-extensions.md) — Provides a pluggable system for adding custom block and inline parsing rules to the markdown processor.
- [Markdown Block Formatting](https://awesome-repositories.com/f/software-engineering-architecture/string-formatting-utilities/content-format-transformers/text-block-formatting/markdown-block-formatting.md) — Produces structured components such as blockquotes and thematic breaks based on markdown markers. ([source](https://xoofx.github.io/markdig/docs/commonmark))
- [Character-Level Parser Entry Points](https://awesome-repositories.com/f/software-engineering-architecture/character-level-parser-entry-points.md) — Allows registering pluggable entry points at the character level to add parsing logic for new syntax elements. ([source](https://xoofx.github.io/blog/2016/06/13/implementing-a-markdown-processor-for-dotnet/))
- [Logic-Rendering Decouplers](https://awesome-repositories.com/f/software-engineering-architecture/headless-logic-decoupling/logic-rendering-decouplers.md) — Separates the markdown parsing logic from the rendering stage to allow for multiple output formats.
- [Two-Stage Parsing](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/reactive-messaging/pipeline-processing-architectures/two-stage-parsing.md) — Utilizes a two-stage parsing process that separates block-level structure scanning from inline value extraction.
- [Document Tree Traversers](https://awesome-repositories.com/f/software-engineering-architecture/tree-traversal-algorithms/document-tree-traversers.md) — Implements depth-first search traversal of the document tree for analysis and modification. ([source](https://xoofx.github.io/markdig/docs/advanced/ast))
- [Syntax Tree Construction](https://awesome-repositories.com/f/software-engineering-architecture/trees/syntax-tree-construction.md) — Provides the ability to traverse and programmatically modify the syntax tree before rendering. ([source](https://xoofx.github.io/markdig/docs/advanced))
- [Markdown AST Manipulation](https://awesome-repositories.com/f/software-engineering-architecture/trees/syntax-tree-construction/markdown-ast-manipulation.md) — Performs structural changes to the document tree while preserving parent-child relationships. ([source](https://xoofx.github.io/markdig/docs/advanced/ast))

### User Interface & Experience

- [Text Formatting Tools](https://awesome-repositories.com/f/user-interface-experience/text-formatting-tools.md) — Applies bold and italic styling to text using standard markdown emphasis markers. ([source](https://xoofx.github.io/markdig/docs/commonmark))

### Web Development

- [Markdown](https://awesome-repositories.com/f/web-development/syntax-extensions/markdown.md) — Supports custom markers and structural elements through a pluggable processing pipeline. ([source](https://xoofx.github.io/markdig/docs/))
- [Unordered Lists](https://awesome-repositories.com/f/web-development/unordered-lists.md) — Generates structured ordered and unordered lists, including support for nested items. ([source](https://xoofx.github.io/markdig/docs/commonmark))
- [Markdown Parser Extensions](https://awesome-repositories.com/f/web-development/web-standards/typography-systems/inline-text-styles/markdown-parser-extensions.md) — Supports the registration of custom block and inline parsers to expand supported markdown syntax. ([source](https://xoofx.github.io/markdig/docs/advanced))
- [Streaming Rendering](https://awesome-repositories.com/f/web-development/streaming-rendering.md) — Writes converted markdown content directly to a text stream to minimize memory usage for large documents.

### Programming Languages & Runtimes

- [Format-Preserving Printing](https://awesome-repositories.com/f/programming-languages-runtimes/format-preserving-printing.md) — Tracks non-semantic elements and whitespace during parsing to ensure the document can be re-rendered exactly. ([source](https://xoofx.github.io/markdig/docs/advanced/pipeline))
- [Stream-Based Rendering](https://awesome-repositories.com/f/programming-languages-runtimes/stream-based-rendering.md) — Writes rendered content directly to a text stream to reduce memory overhead for large documents. ([source](https://xoofx.github.io/markdig/docs/usage))
- [International Markdown Formatting](https://awesome-repositories.com/f/programming-languages-runtimes/unicode-text-handling/international-markdown-formatting.md) — Supports right-to-left text layouts and applies specialized emphasis delimiter rules for CJK languages. ([source](https://xoofx.github.io/markdig/docs/extensions))
