cipemotion / commonmark
A League CommonMark extension.
Installs: 20 477
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
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>
![link](https://url)
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_!');