parsedown/README.md

62 lines
2.9 KiB
Markdown
Raw Normal View History

2018-01-29 21:55:30 +03:00
> I also make [Caret](https://caret.io?ref=parsedown) - a Markdown editor for Mac and PC.
2015-10-31 01:33:11 +03:00
2013-11-16 11:51:01 +04:00
## Parsedown
2013-07-24 00:32:45 +04:00
2015-03-18 17:16:51 +03:00
[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown)
2015-03-18 21:41:23 +03:00
<!--[![Total Downloads](http://img.shields.io/packagist/dt/erusev/parsedown.svg?style=flat-square)](https://packagist.org/packages/erusev/parsedown)-->
2015-03-18 21:43:30 +03:00
Better Markdown Parser in PHP
2015-07-03 16:46:25 +03:00
[Demo](http://parsedown.org/demo) |
[Benchmarks](http://parsedown.org/speed) |
2015-07-03 17:11:23 +03:00
[Tests](http://parsedown.org/tests/) |
2015-07-15 11:57:45 +03:00
[Documentation](https://github.com/erusev/parsedown/wiki/)
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
2016-07-27 11:05:24 +03:00
* One File
2017-11-06 17:54:00 +03:00
* No Dependencies
2015-07-15 09:21:38 +03:00
* Super Fast
* Extensible
2016-07-27 11:05:24 +03:00
* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown)
2016-10-09 02:58:47 +03:00
* Tested in 5.3 to 7.1 and in HHVM
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
2016-01-07 20:36:51 +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
2015-07-03 17:06:52 +03:00
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
2014-05-17 18:13:00 +04:00
2017-10-22 16:00:43 +03:00
### Security
2017-11-15 01:13:31 +03:00
Parsedown does not sanitize the HTML that it generates. When you deal with untrusted content (ex: user comments) you should also use a HTML sanitizer like [HTML Purifier](http://htmlpurifier.org/).
2017-10-22 16:00:43 +03:00
2014-05-16 02:15:21 +04:00
### Questions
2015-01-13 16:18:35 +03:00
**How does Parsedown work?**
2016-10-25 17:22:17 +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 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).
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
2015-01-24 02:26:59 +03:00
**Is it compliant with CommonMark?**
2014-05-16 02:15:21 +04:00
2015-01-24 05:54:01 +03:00
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.
2014-09-09 15:30:17 +04:00
2015-01-24 02:26:59 +03:00
**Who uses it?**
2015-01-13 16:18:35 +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/), [Herbie CMS](http://www.getherbie.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony demo](https://github.com/symfony/symfony-demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents).
2014-12-10 18:19:05 +03:00
2015-01-24 02:27:48 +03:00
**How can I help?**
2015-01-13 16:18:35 +03:00
2015-06-15 00:10:09 +03:00
Use it, star it, share it and if you feel generous, [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).