A Markdown parser library for C++.
Warning
This library only supports a subset of Markdown as of now.
Parse.mdis small, lightweight and fast.
Parse.mdabides by the CommonMark Spec.
Parse.md's AST allows to write small renderers or format converters.
Benchmark, as run on 12th Gen Intel Core i5-12500H (4.5 GHz max) runnin Arch Linux (kernel 6.16.4), compiled with g++ (15.2.1) after compiler optimizations (Release build)
Throughput: 22 MB/s
| Benchmark | Time | CPU | Iterations |
|---|---|---|---|
| ParseMd Empty String | 0.036 us | 0.036 us | 19429443 |
| ParseMd Simple String | 3.53 us | 3.53 us | 198560 |
| ParseMd 100KB | 4222 us | 4214 us | 166 |
| ParseMd 1MB | 44227 us | 44136 us | 16 |
For an elaborate demo, see demo.cpp
#include <iostream>
#include "parsemd/parser.h"
using namespace markdown;
int main() {
Parser p;
p.Parse("### This is **strong** and *italic*");
Node root = p.GetRoot();
std::cout << Parser::DumpTree(root);
}