Skip to content

Parsedown

A Markdown-to-HTML parser for PHP, packaged as a single file with no dependencies.

Stars
15k
Forks
1.1k
Licence
MIT
Language
PHP
Last update
9 months ago
Type
Library

What it is

Parsedown is a PHP library that converts Markdown text into HTML. Markdown is a simple plain-text format for headings, lists, links and emphasis. Developers use Parsedown to show formatted text on websites, such as user comments or content pages, without writing HTML by hand.

  • Render a Markdown blog post or documentation page to HTML in a PHP site
  • Convert user comments written in Markdown into HTML, using safe mode for untrusted input
  • Parse only inline Markdown, such as a single line of formatted text, with the line() method
  • Add custom syntax through the parser's extensibility, or use the separate Markdown Extra extension

Great for

  • PHP developers who need to render Markdown inside a PHP web application
  • Projects that want a small parser with no external dependencies
  • Sites that display user-written Markdown and can enable its safe mode
  • Developers who want to extend the parser with their own syntax

Not ideal for

  • Non-PHP projects, since the library is written only for PHP
  • Teams that need full CommonMark compliance, because the README says it passes most but not all CommonMark tests
  • Anyone who wants a finished end-user app rather than code to integrate
Step-by-step guide: how to use ParsedownInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: PHP 7.1+

    Install with Composer

    composer require erusev/parsedown
  2. 2

    Run it

    • Install the package with Composer, or download Parsedown.php and include it
    • Create a parser object with new Parsedown()
    • Call $Parsedown->text() with your Markdown string and echo the result
  3. 3

    Get the most out of it

    • Call setSafeMode(true) when rendering untrusted user input
    • Use line() to parse inline Markdown without wrapping paragraphs
    • Pair untrusted-content output with an HTML sanitiser such as HTML Purifier, as the README recommends
    • Add a Content-Security-Policy as defence in depth, per the README
    • Use the Markdown Extra extension if you need extra syntax

Downloads

Strengths

  • Ships as one file with no dependencies, so it is simple to include
  • The README lists security options, including safe mode and escaping HTML, for untrusted input
  • Installable via Composer or by downloading a single file, with MIT licensing

Trade-offs

  • The README says it passes most CommonMark tests but not all, so output may differ from other CommonMark tools
  • The README warns that the markup-escaping option is not safe from XSS and that extensions need their own safety review
  • The README describes the release only as 1.8.0 and gives no detailed changelog, so update details are unclear

How it compares

ProjectStarsTypeLevelUpdatedBest for
parsedown (this)15kLibrarybeginner9 months agoPHP developers who need to render Markdown inside a PHP web application
showdown14.9kLibrarybeginner8 days agoJavaScript developers adding Markdown rendering to a web page
tree-sitter27.4kLibraryadvanced4 days agoDevelopers building code editors or IDE features that need to understand source code as it changes
markdown-it22kLibraryintermediate14 days agoJavaScript or TypeScript developers who need to render Markdown in a Node.js or browser project
mdx19.8kLibraryintermediate8 days agoDevelopers building documentation or content sites in React, Preact, or Vue
tui.editor18kLibraryintermediate2.3 years agoWeb developers who want an embeddable Markdown editor in their own site or app

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.