erusev/parsedown
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The erusev/parsedown is a highly effective parser for Markdown in PHP. It's renowned for its speed and extensibility, as well as its ability to function without any dependencies. Moreover, the package is fully compatible with GitHub flavored Markdown and can work in PHP 5.5 to 7.3. It conveniently comes in a single file and has a Markdown Extra extension available.
To put erusev/parsedown to use, the first step is to install the composer package by running the command composer require erusev/parsedown
. Alternatively, you can download the latest release and include Parsedown.php
. Once successfully installed, you can easily parse Markdown text as shown in the examples below:
$Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!'); // prints: <p>Hello <em>Parsedown</em>!</p>
And if you wish to parse inline markdown only:
echo $Parsedown->line('Hello _Parsedown_!'); // prints: Hello <em>Parsedown</em>!
For dealing with untrusted user-input, Parsedown provides a safe mode:
$Parsedown->setSafeMode(true);
And to escape HTML in trusted input, use:
$Parsedown->setMarkupEscaped(true);
The comprehensive documentation for erusev/parsedown can be found on its GitHub page (https://github.com/erusev/parsedown). For more usage examples, you can visit the wiki section on the GitHub page or view their video tutorial as linked in the readme file.