originphp / markdown
OriginPHP Markdown
2.0.0
2021-01-04 10:26 UTC
Requires
- php: >=7.3.0
- originphp/html: ^2.0
Requires (Dev)
- phpstan/phpstan: ^0.12.64
- phpunit/phpunit: ^9.2
This package is auto-updated.
Last update: 2025-02-04 19:24:25 UTC
README
The Markdown utility gives you useful functions for converting to and from markdown.
Installation
To install this package
$ composer require originphp/markdown
Convert markdown To HTML
To convert HTML to markdown
$html = Markdown::toHtml($markdown);
By default markdown is escaped before converting to HTML this prevents people putting malicious HTML code. You can disable this by passing the options array with escape
set to false.
Markdown::toHtml($markdown,['escape'=>false]);
Convert markdown To Text
To convert markdown to text:
$text = Markdown::toText($markdown);
Convert to markdown From HTML
To convert HTML to markdown.
$markdown = Markdown::fromHtml($html);