Skip to content

Commit

Permalink
Render markdown :emoji: as inline node
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Dec 20, 2023
1 parent 53ed8cf commit 860c036
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/Services/Parser/Extensions/EmojiNode.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Coyote\Services\Parser\Extensions;

use League\CommonMark\Node\Block\AbstractBlock;
use League\CommonMark\Node\Inline\AbstractInline;

class EmojiNode extends AbstractBlock
class EmojiNode extends AbstractInline
{
public function __construct(public string $code)
{
Expand Down
10 changes: 9 additions & 1 deletion tests/Unit/Services/Parser/Parsers/MarkdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,20 @@ public function testParseInternalAccessors()
$this->assertMatchesRegularExpression("~<a href=\".*" . preg_quote($path) . "\">" . preg_quote($title) . "</a>~", $input);
}

/**
* @test
* @doesNotPerformAssertions
*/
public function inlineEmoji()
{
$this->markdown->parse('*:emoji:*');
}

private function createPage($title, $path)
{
$now = new \DateTime('now');
Page::forceCreate([
'title' => $title, 'path' => $path, 'created_at' => $now, 'updated_at' => $now,
]);
}

}

0 comments on commit 860c036

Please sign in to comment.