fdekker / commonmark-ext-emoji
An emoji extension for league/commonmark
Installs: 8 072
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- league/commonmark: ^2.4.0
Requires (Dev)
- digitalrevolution/phpunit-file-coverage-inspection: ^v2.0
- phpmd/phpmd: @stable
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpstan/phpstan-phpunit: ^1.3
- phpstan/phpstan-strict-rules: ^1.5
- phpunit/phpunit: 10.1.*
- roave/security-advisories: dev-latest
- squizlabs/php_codesniffer: ^3.7
README
Emoji Extension for CommonMark
The PHPLeague/CommonMark extension for emoji's support.
Support emoji's:
Installation
Include the library as dependency in your own project via:
composer require "fdekker/commonmark-ext-emoji"
Usage:
// Define your configuration, if needed $config = []; // Configure the Environment with all the CommonMark and GFM parsers/renderers $environment = new Environment($config); $environment->addExtension(new CommonMarkCoreExtension()); $environment->addExtension(new GithubFlavoredMarkdownExtension()); $environment->addExtension(new EmojiExtension(EmojiDataProvider::light())); $converter = new MarkdownConverter($environment); echo $converter->convert('Works (y) :thumbsup: (thumbsup)');
Outputs:
Works 👍 👍 👍
To read more about configuring extension visit: https://commonmark.thephpleague.com/2.4/extensions/github-flavored-markdown/
Customization
You can implement EmojiDataProviderInterface
to supply your own emoji's list.