2017 © Pedro Peláez
 

library parsedown

Parser for Markdown.

image

erusev/parsedown

Parser for Markdown.

  • Monday, June 11, 2018
  • by erusev
  • Repository
  • 208 Watchers
  • 8142 Stars
  • 21,115,618 Installations
  • PHP
  • 445 Dependents
  • 26 Suggesters
  • 784 Forks
  • 59 Open issues
  • 76 Versions
  • 15 % Grown

The README.md

Parsedown

Total Downloads Version License, (*1)

Better Markdown Parser in PHP — demo, (*2)

Features

Installation

Install the composer package:, (*3)

composer require erusev/parsedown

Or download the latest release and include Parsedown.php, (*4)

Example

$Parsedown = new Parsedown();

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

Hello Parsedown!, (*5)

You can also parse inline markdown only:, (*6)

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

More examples in the wiki and in this video tutorial., (*7)

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., (*8)

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

$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., (*10)

In both cases you should strongly consider employing defence-in-depth measures, like deploying a Content-Security-Policy (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., (*11)

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., (*12)

Escaping HTML

WARNING: This method is not safe from XSS!, (*13)

If you wish to escape HTML in trusted input, you can use the following:, (*14)

$Parsedown->setMarkupEscaped(true);

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

Questions

How does Parsedown work?, (*16)

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)., (*17)

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., (*18)

Is it compliant with CommonMark?, (*19)

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., (*20)

Who uses it?, (*21)

Laravel Framework, Bolt CMS, Grav CMS, Herbie CMS, Kirby CMS, October CMS, Pico CMS, Statamic CMS, phpDocumentor, RaspberryPi.org, Symfony Demo and more., (*22)

How can I help?, (*23)

Use it, star it, share it and if you feel generous, donate., (*24)

What else should I know?, (*25)

I also make Nota — a notes app designed for local Markdown files., (*26)

The Versions

11/06 2018

dev-master

9999999-dev http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

11/06 2018

2.0.x-dev

2.0.9999999.9999999-dev http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

11/06 2018

1.8.0-beta-5

1.8.0.0-beta5 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

08/05 2018

1.8.0-beta-4

1.8.0.0-beta4 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

07/05 2018

1.8.0-beta-3

1.8.0.0-beta3 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

07/05 2018

1.8.0-beta-2

1.8.0.0-beta2 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

08/04 2018

1.8.0-beta-1

1.8.0.0-beta1 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

08/03 2018

1.7.1

1.7.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mbstring *

 

The Development Requires

parser markdown

28/02 2018

1.7.0

1.7.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

parser markdown

14/11 2017

1.6.4

1.6.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

parser markdown

14/05 2017

1.6.3

1.6.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

parser markdown

29/03 2017

1.6.2

1.6.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

parser markdown

02/11 2016

1.6.1

1.6.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

parser markdown

04/10 2015

1.6.0

1.6.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

03/08 2015

1.5.4

1.5.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

29/04 2015

1.5.3

1.5.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

18/03 2015

1.5.2

1.5.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

24/01 2015

1.5.1

1.5.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

19/01 2015

1.5.0

1.5.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

15/01 2015

1.4.5

1.4.5.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

15/01 2015

1.4.4

1.4.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

15/01 2015

1.4.3

1.4.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

15/01 2015

1.4.2

1.4.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

14/01 2015

1.4.1

1.4.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

12/01 2015

1.4.0

1.4.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

12/01 2015

1.3.0

1.3.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

10/01 2015

1.2.0

1.2.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

29/11 2014

1.1.4

1.1.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

28/11 2014

1.1.3

1.1.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

19/11 2014

1.1.2

1.1.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

29/10 2014

1.1.1

1.1.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

26/09 2014

1.1.0

1.1.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

21/05 2014

1.0.1

1.0.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

14/05 2014

1.0.0

1.0.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

12/05 2014

1.0.0-rc.5

1.0.0.0-RC5 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

01/05 2014

1.0.0-rc.4

1.0.0.0-RC4 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

01/05 2014

1.0.0-rc.3

1.0.0.0-RC3 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

28/04 2014

1.0.0-rc.2

1.0.0.0-RC2 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

17/04 2014

1.0.0-rc.1

1.0.0.0-RC1 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

06/02 2014

0.9.4

0.9.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

06/02 2014

0.9.3

0.9.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

05/02 2014

0.9.2

0.9.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

02/02 2014

0.9.1

0.9.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

22/01 2014

0.9.0

0.9.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

20/01 2014

0.8.3

0.8.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

18/01 2014

0.8.2

0.8.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

17/01 2014

0.8.1

0.8.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

26/12 2013

0.8.0

0.8.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

18/12 2013

0.7.7

0.7.7.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

07/12 2013

0.7.6

0.7.6.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

06/12 2013

0.7.5

0.7.5.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

02/12 2013

0.7.4

0.7.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

23/11 2013

0.7.3

0.7.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

23/11 2013

0.7.2

0.7.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

22/11 2013

0.7.1

0.7.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

21/11 2013

0.7.0

0.7.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

18/11 2013

0.6.0

0.6.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

17/11 2013

0.5.0

0.5.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

16/11 2013

0.4.8

0.4.8.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

13/11 2013

0.4.7

0.4.7.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

10/11 2013

0.4.6

0.4.6.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

08/11 2013

0.4.5

0.4.5.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

07/11 2013

0.4.4

0.4.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

05/11 2013

0.4.3

0.4.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

05/11 2013

0.4.2

0.4.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

04/11 2013

0.4.1

0.4.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

04/11 2013

0.4.0

0.4.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

02/11 2013

0.3.0

0.3.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

22/10 2013

0.2.1

0.2.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

24/09 2013

0.2.0

0.2.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

31/08 2013

0.1.5

0.1.5.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

31/08 2013

0.1.4

0.1.4.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

25/07 2013

0.1.3

0.1.3.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

25/07 2013

0.1.2

0.1.2.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

23/07 2013

0.1.1

0.1.1.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown

10/07 2013

0.1.0

0.1.0.0 http://parsedown.org

Parser for Markdown.

  Sources   Download

MIT

parser markdown