vmg/sundown logo

vmg/sundown

Free

Standards compliant, fast, secure markdown processing library in C

FreeFree tier
Type
Open Source

About vmg/sundown

Sundown is a high-performance, security-focused Markdown parsing library written in C, originally based on the Upskirt library by Natacha Porté. It is fully compliant with the official Markdown v1.0.0 and v1.0.3 test suites and offers extensive optional extensions including fenced code blocks, tables, autolinks, and strikethrough. The library is UTF-8 aware, has been rigorously security audited to prevent DOS attacks and malicious HTML, and is used in production to render all Markdown content on GitHub. Sundown's parser is decoupled from its renderer, allowing easy customization and creation of custom renderers. It is optimized for speed, often outperforming other alternatives by up to 40x when wrapped in dynamic languages like Python or Ruby. The library has zero dependencies, consisting of just 3 C source files and headers, and is written in standard C99.

Key Features

Fully standards compliant: passes official Markdown v1.0.0 and v1.0.3 test suites
Extensive extension support: fenced code blocks, tables, autolinks, strikethrough, non-strict emphasis, etc.
UTF-8 aware parsing and XHTML generation
Security hardened: protection against DOS attacks (stack overflow, out-of-memory) and malicious HTML
Customizable renderers: decoupled parser and renderer architecture
Optimized for speed: written in C, up to 40x faster than alternative libraries in dynamic languages
Zero dependencies: only 3 C source files and headers, standard C99

Pros & Cons

Pros
  • Fully standards compliant with official test suites
  • Very high performance due to C implementation
  • Security audited and hardened against attacks
  • Extensible with custom renderers
  • Zero dependencies and easy to integrate
Cons
  • C library, requiring bindings for use from other languages
  • Relatively low-level API, not suitable for end-users directly

Best For

Markdown rendering in web applications (e.g., GitHub)Building custom Markdown-to-HTML tools or renderersHigh-performance Markdown processing in server-side applications

FAQ

Is Sundown production-ready?
Yes, Sundown is used in production to render all Markdown content on GitHub and has been extensively security audited to prevent crashes and vulnerabilities.
Does Sundown support extensions?
Yes, it has optional support for unofficial Markdown extensions such as fenced code blocks, tables, autolinks, strikethrough, and non-strict emphasis.
Can I use Sundown from other programming languages?
Yes, there are bindings for Ruby (Redcarpet), Node.js (RobotSkirt), Python (Misaka), Haskell (Sundown HS), Go (Goskirt, Upskirt.go), .NET (MoonShine, Sundown.net), and PHP (PHP-Sundown).