fdekker / commonmark-ext-emoji
league/commonmark 的表情符号扩展
v1.1.2
2023-04-26 17:48 UTC
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
CommonMark 表情符号扩展
PHPLeague/CommonMark 的表情符号支持扩展。
支持表情符号
安装
通过以下方式将库作为依赖项包含到您的项目中:
composer require "fdekker/commonmark-ext-emoji"
使用方法
// 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)');
输出
Works 👍 👍 👍
要了解更多关于配置扩展的信息,请访问: https://commonmark.thephpleague.com/2.4/extensions/github-flavored-markdown/
自定义
您可以通过实现 EmojiDataProviderInterface
来提供您自己的表情符号列表。