. */ declare(strict_types=1); namespace Fisharebest\Webtrees\CommonMark; use League\CommonMark\Parser\Block\BlockStart; use League\CommonMark\Parser\Block\BlockStartParserInterface; use League\CommonMark\Parser\Cursor; use League\CommonMark\Parser\MarkdownParserStateInterface; /** * Convert webtrees 1.x census-assistant markup into tables. * Note that webtrees 2.0 generates markdown tables directly. */ class CensusTableStartParser implements BlockStartParserInterface { /** * @param Cursor $cursor * @param MarkdownParserStateInterface $parserState * * @return BlockStart|null */ public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart { if ($cursor->getLine() === CensusTableExtension::CA_PREFIX) { return BlockStart::of(new CensusTableContinueParser()) ->at($cursor); } return BlockStart::none(); } }