originphp/markdown

OriginPHP Markdown

2.0.0 2021-01-04 10:26 UTC

This package is auto-updated.

Last update: 2024-04-04 17:30:07 UTC


README

license build coverage

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);