| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the league/commonmark package.
|
|
|
5 |
*
|
|
|
6 |
* (c) Colin O'Dell <colinodell@gmail.com>
|
|
|
7 |
* (c) 2015 Martin Hasoň <martin.hason@gmail.com>
|
|
|
8 |
*
|
|
|
9 |
* For the full copyright and license information, please view the LICENSE
|
|
|
10 |
* file that was distributed with this source code.
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
declare(strict_types=1);
|
|
|
14 |
|
|
|
15 |
namespace League\CommonMark\Extension\Attributes;
|
|
|
16 |
|
|
|
17 |
use League\CommonMark\Environment\EnvironmentBuilderInterface;
|
|
|
18 |
use League\CommonMark\Event\DocumentParsedEvent;
|
|
|
19 |
use League\CommonMark\Extension\Attributes\Event\AttributesListener;
|
|
|
20 |
use League\CommonMark\Extension\Attributes\Parser\AttributesBlockStartParser;
|
|
|
21 |
use League\CommonMark\Extension\Attributes\Parser\AttributesInlineParser;
|
|
|
22 |
use League\CommonMark\Extension\ExtensionInterface;
|
|
|
23 |
|
|
|
24 |
final class AttributesExtension implements ExtensionInterface
|
|
|
25 |
{
|
|
|
26 |
public function register(EnvironmentBuilderInterface $environment): void
|
|
|
27 |
{
|
|
|
28 |
$environment->addBlockStartParser(new AttributesBlockStartParser());
|
|
|
29 |
$environment->addInlineParser(new AttributesInlineParser());
|
|
|
30 |
$environment->addEventListener(DocumentParsedEvent::class, [new AttributesListener(), 'processDocument']);
|
|
|
31 |
}
|
|
|
32 |
}
|