2013-11-16 11:51:01 +04:00
## Parsedown
2013-07-24 00:32:45 +04:00
2013-12-15 05:32:34 +04:00
Better [Markdown ](http://en.wikipedia.org/wiki/Markdown ) parser for PHP.
2013-07-11 00:22:16 +04:00
2014-05-16 04:34:43 +04:00
* [Demo ](http://parsedown.org/demo )
* [Test Suite ](http://parsedown.org/tests/ )
2013-11-23 17:58:58 +04:00
2013-12-04 00:49:50 +04:00
### Features
2013-11-23 17:58:58 +04:00
2014-04-17 12:22:49 +04:00
* [Fast ](http://parsedown.org/speed )
* [Consistent ](http://parsedown.org/consistency )
2013-12-04 01:19:50 +04:00
* [GitHub Flavored ](https://help.github.com/articles/github-flavored-markdown )
2014-04-17 12:22:49 +04:00
* [Tested ](https://travis-ci.org/erusev/parsedown ) in PHP 5.2, 5.3, 5.4, 5.5, 5.6 and [hhvm ](http://www.hhvm.com/ )
* Extensible
2014-05-14 21:07:52 +04:00
* [Markdown Extra extension ](https://github.com/erusev/parsedown-extra ) < sup > new</ sup >
2014-06-18 13:27:25 +04:00
* [JavaScript port ](https://github.com/hkdobrev/parsedown.js ) under development < sup > new</ sup >
2013-07-23 11:36:28 +04:00
2013-07-24 00:32:45 +04:00
### Installation
Include `Parsedown.php` or install [the composer package ](https://packagist.org/packages/erusev/parsedown ).
2013-07-24 00:54:32 +04:00
### Example
2013-07-24 00:32:45 +04:00
2014-02-21 04:49:59 +04:00
``` php
2014-05-17 18:13:00 +04:00
$Parsedown = new Parsedown();
2013-07-24 00:32:45 +04:00
2014-05-17 18:13:00 +04:00
echo $Parsedown->text('Hello _Parsedown_ !'); # prints: < p > Hello < em > Parsedown</ em > !</ p >
2013-11-13 03:38:29 +04:00
```
2014-05-16 02:15:21 +04:00
2014-05-17 18:13:00 +04:00
More examples in [the wiki ](https://github.com/erusev/parsedown/wiki/Usage ).
2014-05-16 02:15:21 +04:00
### Questions
2014-05-16 02:27:54 +04:00
**How does Parsedown work?**< br / >
Parsedown recognises that the Markdown syntax is optimised for humans so it tries to read like one. It goes through text line by line. It looks at how lines start to identify blocks. It looks for special characters to identify inline elements.
2014-05-16 02:15:21 +04:00
2014-05-16 02:27:54 +04:00
**Why doesn’ t Parsedown use namespaces?**< br / >
Using namespaces would mean dropping support for PHP 5.2. Since Parsedown is a single class with an uncommon name, making this trade wouldn't make much sense.
2014-05-16 02:15:21 +04:00
2014-05-16 02:27:54 +04:00
**Who uses Parsedown?**< br / >
[phpDocumentor ](http://www.phpdoc.org/ ), [Bolt CMS ](http://bolt.cm/ ), [RaspberryPi.org ](http://www.raspberrypi.org/ ) and [more ](https://www.versioneye.com/php/erusev:parsedown/references ).