Skip to content

Commit

Permalink
Add emoji extension to commonmark (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdekker committed Apr 23, 2023
1 parent fbb92d5 commit 2ab8707
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"doctrine/doctrine-bundle": "^2.6",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.12",
"fdekker/commonmark-ext-emoji": "^1.0",
"league/commonmark": "^2.3",
"league/uri": "^6.8",
"nesbot/carbon": "^2.64",
Expand Down
48 changes: 47 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/Service/CodeReview/Comment/CommonMarkdownConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace DR\Review\Service\CodeReview\Comment;

use FD\CommonMarkEmoji\EmojiExtension;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode;
Expand Down Expand Up @@ -46,6 +47,7 @@ public function __construct()
);
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new GithubFlavoredMarkdownExtension());
$environment->addExtension(new EmojiExtension());
$environment->addRenderer(FencedCode::class, new FencedCodeRenderer(self::LANGUAGES));

parent::__construct($environment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testConstruct(): void
$environment = $converter->getEnvironment();

$extension = $environment->getExtensions();
static::assertCount(2, $extension);
static::assertCount(3, $extension);

$renderers = [...$environment->getRenderersForClass(FencedCode::class)];
static::assertCount(2, $renderers);
Expand Down

0 comments on commit 2ab8707

Please sign in to comment.