1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00
parsedown/README.md

49 lines
2.4 KiB
Markdown
Raw Normal View History

2013-11-16 11:51:01 +04:00
## Parsedown
2013-07-24 00:32:45 +04:00
2014-11-12 23:27:29 +03:00
Better Markdown Parser in PHP
2013-07-11 00:22:16 +04:00
2014-09-13 01:11:56 +04:00
[[ demo ]](http://parsedown.org/demo)
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)
2014-11-12 04:36:17 +03:00
* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown)
2014-09-14 02:14:40 +04:00
* [Tested](http://parsedown.org/tests/) in PHP 5.2, 5.3, 5.4, 5.5, 5.6 and [hhvm](http://www.hhvm.com/)
2015-01-15 19:28:11 +03:00
* [Extensible](https://github.com/erusev/parsedown/wiki/Writing-Extensions)
2015-01-10 15:53:08 +03:00
* [Markdown Extra extension](https://github.com/erusev/parsedown-extra)
2013-07-23 11:36:28 +04:00
2013-07-24 00:32:45 +04:00
### Installation
2014-11-12 04:37:36 +03:00
Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown).
2013-07-24 00:32:45 +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-09-13 00:52:06 +04:00
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/Usage) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
2014-05-17 18:13:00 +04:00
2014-05-16 02:15:21 +04:00
### Questions
2015-01-13 16:18:35 +03:00
**How does Parsedown work?**
2015-01-10 04:41:29 +03:00
It tries to read Markdown like a human. First, it looks at the lines. Its interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line start with a `-` then it perhaps belong 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).
2014-05-16 02:15:21 +04:00
2015-01-13 16:28:18 +03:00
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.
2015-01-13 16:18:35 +03:00
**Is Parsedown compliant with CommonMark?**
2014-05-16 02:15:21 +04:00
2015-01-10 04:41:29 +03:00
The majority of the CommonMark tests pass. Most of the tests that don't pass deal with cases that are quite extreme. Yet, we are working on them. As CommonMark matures, compliance should improve.
2014-09-09 15:30:17 +04:00
2015-01-13 16:18:35 +03:00
**Who uses Parsedown?**
2015-01-11 17:23:43 +03:00
[phpDocumentor](http://www.phpdoc.org/), [October CMS](http://octobercms.com/), [Bolt CMS](http://bolt.cm/), [Kirby CMS](http://getkirby.com/), [Grav CMS](http://getgrav.org/), [Statamic CMS](http://www.statamic.com/), [RaspberryPi.org](http://www.raspberrypi.org/) and [more](https://www.versioneye.com/php/erusev:parsedown/references).
2014-12-10 18:19:05 +03:00
2015-01-13 16:18:35 +03:00
**How can I help?**
2014-12-11 15:34:58 +03:00
Use the project, tell friends about it and if you feel generous, [donate some money](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).