. */ declare(strict_types=1); namespace Fisharebest\Webtrees\CommonMark; use Fisharebest\Webtrees\Tree; use League\CommonMark\ConfigurableEnvironmentInterface; use League\CommonMark\Extension\ExtensionInterface; /** * Convert XREFs within markdown text to links */ class XrefExtension implements ExtensionInterface { /** @var Tree - match XREFs in this tree */ private $tree; /** * MarkdownXrefParser constructor. * * @param Tree $tree */ public function __construct(Tree $tree) { $this->tree = $tree; } public function register(ConfigurableEnvironmentInterface $environment): void { $environment ->addInlineParser(new XrefParser($this->tree)); } }