/** * @param string $tag * @param int $lineNumber * @param int $offset * * @return BlockElement */ protected function addChild($tag, $lineNumber, $offset) { while (!$this->tip->canContain($tag)) { $this->finalize($this->tip, $lineNumber); } $columnNumber = $offset + 1; // offset 0 = column 1 $newBlock = new CommonMark_Element_BlockElement($tag, $lineNumber, $columnNumber); $this->tip->getChildren()->add($newBlock); $newBlock->setParent($this->tip); $this->tip = $newBlock; return $newBlock; }