isIndented()) { return false; } $previousState = $cursor->saveState(); $cursor->advanceToNextNonSpaceOrNewline(); $fence = $cursor->match('/^\[TOC\]/'); if (is_null($fence)) { $cursor->restoreState($previousState); return false; } $context->addBlock(new TableOfContents()); return true; } }