Parsedown
Fast, single-class Markdown parser for PHP with no dependencies beyond mbstring.
Repository Health
Technical Analysis
Parsedown converts Markdown to HTML in PHP using a single class with no dependencies beyond the mbstring extension, making it one of the easiest Markdown libraries to drop into any PHP project — install it and call (new Parsedown())->text($markdown). It became one of the most widely used PHP Markdown parsers largely because of that simplicity plus its speed: Parsedown avoids full tokenization passes in favor of an optimized line-based parsing approach that benchmarks faster than several alternative PHP Markdown libraries.
Beyond core Markdown, it supports a practical superset of GitHub-flavored features (tables, fenced code blocks, autolinks, strikethrough) and is commonly extended via subclassing — the companion erusev/parsedown-extra package builds Markdown Extra support (footnotes, definition lists, attributes) directly on top of it.
What You Get
Parsedown::text()for full document-to-HTML conversion andParsedown::line()for inline-only parsing- GitHub-flavored extras beyond core Markdown: tables, fenced code blocks, autolinks, strikethrough
setSafeMode()to strip raw HTML/scripts for parsing untrusted user inputsetBreaksEnabled()for GFM-style single-newline-to-<br>behavior- A subclassing-friendly architecture used by
parsedown-extrato add footnotes, definition lists, and attributes
Common Use Cases
- Rendering user-submitted comments, wiki pages, or README-style content to HTML in a PHP app
- Powering flat-file and static-site CMS content pipelines (Grav, Kirby-style tools) that store content as Markdown
- Safely rendering untrusted Markdown input via
setSafeMode(true) - Extending via subclass to add custom Markdown syntax specific to an application
Under The Hood
Architecture: The entire library is one ~2,000-line Parsedown.php file defining a single Parsedown class; block-level constructs (headers, lists, code blocks, tables, quotes) are matched by their leading character via a dispatch table built in the constructor, then handled by paired block*()/block*Continue()/block*Complete() methods, while inline constructs (emphasis, links, code spans) are similarly dispatched by trigger character through inline*() methods — a deliberate single-pass, line-oriented design rather than a full tokenizer/AST. Tech Stack: Plain PHP with ext-mbstring as the only extension dependency, no other runtime dependencies, targeting PHP 7.2+; distributed via a PSR-0 autoload mapping (predating the now-standard PSR-4) reflecting the project’s long history. Code Quality: Despite living in a single file, the codebase is organized into clearly delimited Setup, Block Elements, Inline Elements, Handlers, and Deprecated sections with a comment banner between each; it’s tested with PHPUnit against both its own test suite and the CommonMark conformance test suite (test/CommonMarkTest), giving objective coverage of spec compliance despite the codebase’s compact single-class shape. API Design: The public surface is deliberately tiny — text(), line(), and a handful of set*() toggles — which is precisely why it became a common building block: consuming code rarely needs more than (new Parsedown())->text($input), and the class is easy to subclass for the rare case that needs more.
Used by 3 apps in this directory
FreeScout
Customer Support
Run your own help desk and shared inbox — a fully self-hosted, open-source alternative to Zendesk and Help Scout with no per-agent fees.
Kimai
Invoicing Finance · Project Management
Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.
Typemill
CMS
Open-source flat-file CMS for publishing Markdown-based documentation, manuals, and eBooks without a database.