PHPackages                             erusev/parsedown - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. erusev/parsedown

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

erusev/parsedown
================

Parser for Markdown.

1.8.0(3mo ago)15.0k151.8M—1.2%1.1k[119 issues](https://github.com/erusev/parsedown/issues)[53 PRs](https://github.com/erusev/parsedown/pulls)20MITPHPPHP &gt;=7.1CI passing

Since Jul 10Pushed 2mo ago215 watchersCompare

[ Source](https://github.com/erusev/parsedown)[ Packagist](https://packagist.org/packages/erusev/parsedown)[ Docs](http://parsedown.org)[ GitHub Sponsors](https://github.com/erusev)[ RSS](/packages/erusev-parsedown/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (85)Used By (20)Security (2)

Parsedown
=========

[](#parsedown)

[![Total Downloads](https://camo.githubusercontent.com/7fbd5577cd30cfce0ea7be45527e09f8db39d51ea2a0abf71d44cc75e20f8d5f/68747470733a2f2f706f7365722e707567782e6f72672f6572757365762f7061727365646f776e2f642f746f74616c2e737667)](https://packagist.org/packages/erusev/parsedown)[![Version](https://camo.githubusercontent.com/f7e33f485d54f52a0810a2c358b33bcc407de7af2bf2a4e9d9c6eb63af71e868/68747470733a2f2f706f7365722e707567782e6f72672f6572757365762f7061727365646f776e2f762f737461626c652e737667)](https://packagist.org/packages/erusev/parsedown)[![License](https://camo.githubusercontent.com/1c5b3950317fc0497f57db428341a203a5e97cc729353e4cae2a49190e6b735e/68747470733a2f2f706f7365722e707567782e6f72672f6572757365762f7061727365646f776e2f6c6963656e73652e737667)](https://packagist.org/packages/erusev/parsedown)

Better Markdown Parser in PHP — [demo](https://parsedown.org/demo)

Features
--------

[](#features)

- One file
- No dependencies
- [Super fast](http://parsedown.org/speed)
- Extensible
- [GitHub flavored](https://github.github.com/gfm)
- [Tested](http://parsedown.org/tests/) in PHP 7.1+
- [Markdown Extra extension](https://github.com/erusev/parsedown-extra)

Installation
------------

[](#installation)

Install the [composer package](https://packagist.org/packages/erusev/parsedown "The Parsedown package on packagist.org"):

```
composer require erusev/parsedown
```

Or download the [latest release](https://github.com/erusev/parsedown/releases/latest "The latest release of Parsedown") and include `Parsedown.php`

Example
-------

[](#example)

```
$Parsedown = new Parsedown();

echo $Parsedown->text('Hello _Parsedown_!'); # prints: Hello Parsedown!
```

You can also parse inline markdown only:

```
echo $Parsedown->line('Hello _Parsedown_!'); # prints: Hello Parsedown!
```

More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).

Security
--------

[](#security)

Parsedown is capable of escaping user-input within the HTML that it generates. Additionally Parsedown will apply sanitisation to additional scripting vectors (such as scripting link destinations) that are introduced by the markdown syntax itself.

To tell Parsedown that it is processing untrusted user-input, use the following:

```
$Parsedown->setSafeMode(true);
```

If instead, you wish to allow HTML within untrusted user-input, but still want output to be free from XSS it is recommended that you make use of a HTML sanitiser that allows HTML tags to be whitelisted, like [HTML Purifier](http://htmlpurifier.org/).

In both cases you should strongly consider employing defence-in-depth measures, like [deploying a Content-Security-Policy](https://scotthelme.co.uk/content-security-policy-an-introduction/) (a browser security feature) so that your page is likely to be safe even if an attacker finds a vulnerability in one of the first lines of defence above.

Safe mode does not necessarily yield safe results when using extensions to Parsedown. Extensions should be evaluated on their own to determine their specific safety against XSS.

Escaping HTML
-------------

[](#escaping-html)

> WARNING: This method is not safe from XSS!

If you wish to escape HTML in trusted input, you can use the following:

```
$Parsedown->setMarkupEscaped(true);
```

Beware that this still allows users to insert unsafe scripting vectors, ex: `[xss](javascript:alert%281%29)`.

Questions
---------

[](#questions)

**How does Parsedown work?**

It tries to read Markdown like a human. First, it looks at the lines. It’s interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines).

We call this approach "line based". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages.

**Is it compliant with CommonMark?**

It passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve.

**Who uses it?**

[Laravel Framework](https://laravel.com/), [Bolt CMS](http://bolt.cm/), [Grav CMS](http://getgrav.org/), [Herbie CMS](http://www.getherbie.org/), [Kirby CMS](http://getkirby.com/), [October CMS](http://octobercms.com/), [Pico CMS](http://picocms.org), [Statamic CMS](http://www.statamic.com/), [phpDocumentor](http://www.phpdoc.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony Demo](https://github.com/symfony/demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents).

**How can I help?**

Use it, star it, share it and if you feel generous, [sponsor me](https://github.com/sponsors/erusev).

**What else should I know?**

I also make [Nota](https://nota.md/) — a notes app designed for local Markdown files.

###  Health Score

79

—

ExcellentBetter than 100% of packages

Maintenance82

Actively maintained with recent releases

Popularity88

Widely adopted with strong download metrics

Community63

Healthy contributor diversity

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 59.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~56 days

Recently: every ~559 days

Total

83

Last Release

91d ago

Major Versions

0.9.4 → 1.0.0-rc.12014-04-17

1.7.4 → 2.0.x-dev2022-05-21

PHP version history (3 changes)1.6.1PHP &gt;=5.3.0

2.0.x-devPHP ^7.1||^8.0

1.8.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1342a4632975df49238fe2575a17c1494d5176b03c894075bd0c973730bcfc33?d=identicon)[erusev](/maintainers/erusev)

---

Top Contributors

[![erusev](https://avatars.githubusercontent.com/u/184170?v=4)](https://github.com/erusev "erusev (516 commits)")[![aidantwoods](https://avatars.githubusercontent.com/u/3288888?v=4)](https://github.com/aidantwoods "aidantwoods (235 commits)")[![PhrozenByte](https://avatars.githubusercontent.com/u/920356?v=4)](https://github.com/PhrozenByte "PhrozenByte (28 commits)")[![hkdobrev](https://avatars.githubusercontent.com/u/506129?v=4)](https://github.com/hkdobrev "hkdobrev (20 commits)")[![naNuke](https://avatars.githubusercontent.com/u/4591126?v=4)](https://github.com/naNuke "naNuke (7 commits)")[![rhukster](https://avatars.githubusercontent.com/u/1084697?v=4)](https://github.com/rhukster "rhukster (6 commits)")[![wkpark](https://avatars.githubusercontent.com/u/232347?v=4)](https://github.com/wkpark "wkpark (6 commits)")[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (4 commits)")[![Daniel-KM](https://avatars.githubusercontent.com/u/2138485?v=4)](https://github.com/Daniel-KM "Daniel-KM (4 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (4 commits)")[![xPaw](https://avatars.githubusercontent.com/u/613331?v=4)](https://github.com/xPaw "xPaw (3 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (3 commits)")[![jmsv](https://avatars.githubusercontent.com/u/14852491?v=4)](https://github.com/jmsv "jmsv (3 commits)")[![KaneCohen](https://avatars.githubusercontent.com/u/578455?v=4)](https://github.com/KaneCohen "KaneCohen (3 commits)")[![NathanBaulch](https://avatars.githubusercontent.com/u/249604?v=4)](https://github.com/NathanBaulch "NathanBaulch (2 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (2 commits)")[![luizbills](https://avatars.githubusercontent.com/u/1798830?v=4)](https://github.com/luizbills "luizbills (2 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (2 commits)")[![Ayesh](https://avatars.githubusercontent.com/u/811553?v=4)](https://github.com/Ayesh "Ayesh (2 commits)")[![grogy](https://avatars.githubusercontent.com/u/1322983?v=4)](https://github.com/grogy "grogy (2 commits)")

---

Tags

markdownmarkdown-parserparserphpparsermarkdown

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/erusev-parsedown/health.svg)

```
[![Health](https://phpackages.com/badges/erusev-parsedown/health.svg)](https://phpackages.com/packages/erusev-parsedown)
```

###  Alternatives

[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M702](/packages/league-commonmark)[erusev/parsedown-extra

An extension of Parsedown that adds support for Markdown Extra.

84314.8M192](/packages/erusev-parsedown-extra)[parsedown/parsedown

Parser for Markdown.

21342.8k3](/packages/parsedown-parsedown)[tovic/parsedown-extra-plugin

Configurable Markdown to HTML converter with Parsedown Extra.

5933.7k](/packages/tovic-parsedown-extra-plugin)[taufik-nurrohman/parsedown-extra-plugin

Configurable Markdown to HTML converter with Parsedown Extra.

5932.3k](/packages/taufik-nurrohman-parsedown-extra-plugin)[benjaminhoegh/parsedown-toc

Table of Contents Extension for Parsedown.

2133.6k4](/packages/benjaminhoegh-parsedown-toc)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
