You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
861 B
27 lines
861 B
<?php |
|
|
|
namespace App\Util\CommonMark\NostrSchemeExtension; |
|
|
|
use App\Service\CacheService; |
|
use League\CommonMark\Environment\EnvironmentBuilderInterface; |
|
use League\CommonMark\Extension\ExtensionInterface; |
|
|
|
class NostrSchemeExtension implements ExtensionInterface |
|
{ |
|
|
|
public function __construct(private readonly CacheService $cacheService) |
|
{ |
|
} |
|
|
|
public function register(EnvironmentBuilderInterface $environment): void |
|
{ |
|
$environment |
|
->addInlineParser(new NostrMentionParser($this->cacheService), 200) |
|
->addInlineParser(new NostrSchemeParser(), 199) |
|
->addInlineParser(new NostrRawNpubParser($this->cacheService), 198) |
|
|
|
->addRenderer(NostrSchemeData::class, new NostrEventRenderer(), 2) |
|
->addRenderer(NostrMentionLink::class, new NostrMentionRenderer(), 1) |
|
; |
|
} |
|
}
|
|
|