kramdown is a Ruby library that parses a strict Markdown superset and converts documents to HTML and other formats. It builds an internal AST for flexible input and output pipelines.
Overview
kramdown is a fast, pure Ruby converter for a Markdown superset defined by a strict syntax specification. It is positioned primarily for kramdown-to-HTML workflows but uses an internal abstract syntax tree so other parsers and writers can plug in.
Supported inputs include kramdown, standard Markdown, GFM, and HTML. Outputs include HTML, kramdown, LaTeX, PDF via LaTeX, and PDF via Prawn. Syntax and quick-reference documentation describe the format and extensions influenced by PHP Markdown Extra and Maruku.
The public API centers on Kramdown::Document for parsing and conversion in a few lines of Ruby. Third-party extensions are collected on a community wiki. The project site notes comparative speed among pure-Ruby Markdown implementations and describes installation steps for deploying kramdown on a system.
Licensing is MIT, enabling use in commercial projects; sponsorship and patron support are mentioned on the site. Bug reports and a user mailing list are the stated support channels.
Key features
- Markdown superset syntax
- HTML, LaTeX, and PDF output
- GFM and HTML input support
- Internal AST for conversions
- Pure Ruby implementation
- Document-level Ruby API
- Syntax quick reference
- Community extension ecosystem
Use cases
- Static site Markdown rendering
- Ruby app HTML generation
- PDF export from Markdown
- Custom converters via AST