cipemotion / commonmark
A League CommonMark extension.
v3.0.0
2021-07-26 12:17 UTC
Requires
- php: ^7.4 || ^8.0
- league/commonmark: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^9.5
README
Inline converter
The inline syntax is meant for using quick markup in text settings like comments where it doesn't make sense to have a full wysiwig editor but you do want to provide some formatting options to the user using markdown syntax.
Supports the following inline syntax:
_emphasis_to<em>emphasis</em>*bold*to<strong>bold</strong>~deleted~to<del>deleted</del>`code`to<code>code</code>[link](https://url)to<a href="https://url">link</a>to!<a href="https://url">link</a>(images are disabled)- newlines to paragraphs
- stripping of html (can be disabled to allow HTML)
Usage
// When `$allowHtml` is `true` HTML is _not_ removed in the output, default is false $converter = \CipeMotion\CommonMark\Markdown::getInlineConverter($allowHtml); $html = $converter->convertToHtml('This is _awesome_!')->getContent(); // or $html = (string)$converter->convertToHtml('This is _awesome_!');