jgm/peg-markdown
FreeAn implementation of markdown in C, using a PEG grammar
FreeFree tier
About jgm/peg-markdown
peg-markdown is an implementation of John Gruber's Markdown in C, using a parsing expression grammar (PEG) to define syntax. It supports output in HTML, LaTeX, ODF, and groff_mm formats, and is designed to be fast and easily modifiable. Both a library and a standalone program are provided. It is released under GPL and MIT licenses. Note: this package is unmaintained.
Key Features
Parsing expression grammar (PEG) for syntax definition
Fast performance: parses a 179KB file in less than 0.2 seconds
Multiple output formats: HTML, LaTeX, ODF, groff_mm
Library and standalone program included
Portable ANSI C with glib2 dependency
Test suite for Markdown 1.0.3 compatibility
Easy to modify and extend due to PEG grammar
Cross-compilable for Windows via MinGW
Pros & Cons
Pros
- Extremely fast compared to Perl-based Markdown.pl
- Supports multiple output formats from a single parser
- Customizable grammar allows easy syntax extension
- Dual license (GPL and MIT) provides flexibility
- Includes both library and command-line tool
- Test suite available for checking correctness
Cons
- No longer maintained (unmaintained as per repository)
- High memory usage (up to 4MB heap for a 179KB file)
- Requires glib2 as a system dependency
- Build requires GNU make and gcc for the bundled peg generator
- One list test fails due to differing interpretation of Markdown spec
Best For
Converting Markdown to HTML for web publishingConverting Markdown to LaTeX for academic documentsConverting Markdown to ODF for office suitesConverting Markdown to groff_mm for Unix manual pagesEmbedding Markdown parsing in C applicationsBuilding custom Markdown processors with modified syntax
FAQ
What is peg-markdown?
It is a C implementation of John Gruber's Markdown using a parsing expression grammar (PEG) to define the syntax. It supports output in HTML, LaTeX, ODF, or groff_mm formats.
Is peg-markdown still maintained?
No. The repository notes explicitly that the package is unmaintained.
What licenses does peg-markdown use?
It is released under both the GPL and MIT licenses; details are in the LICENSE file.
How fast is peg-markdown compared to Markdown.pl?
peg-markdown is significantly faster. It parses a 179K text file in less than 0.2 seconds, whereas Markdown.pl (v. 1.0.1) takes about 5.7 seconds.
What are the dependencies for building peg-markdown?
It requires glib2, GNU make, and a C compiler (gcc recommended). The peg/leg PEG parser generator is included and built automatically.