. */ declare(strict_types=1); namespace Fisharebest\Webtrees\CommonMark; use Fisharebest\Webtrees\Tree; use League\CommonMark\Extension\Extension; use League\CommonMark\Inline\Parser\InlineParserInterface; /** * Convert XREFs within markdown text to links */ class XrefExtension extends Extension { /** @var Tree - match XREFs in this tree */ private $tree; /** * MarkdownXrefParser constructor. * * @param Tree $tree */ public function __construct(Tree $tree) { $this->tree = $tree; } /** * @return InlineParserInterface[] */ public function getInlineParsers(): array { return [ new XrefParser($this->tree), ]; } /** * @return string */ public function getName(): string { return 'xref'; } }