Example #1
0
 /**
  * Add a header while keeping track of duplicate texts for unique anchor links.
  *
  * @param \nochso\WriteMe\Markdown\Header $header
  */
 public function add(Header $header)
 {
     if (!isset($this->uniqueTextCount[$header->getText()])) {
         $this->uniqueTextCount[$header->getText()] = -1;
     }
     $this->uniqueTextCount[$header->getText()]++;
     $header->setUniqueCounter($this->uniqueTextCount[$header->getText()]);
     $this->headers[] = $header;
 }
Example #2
0
 /**
  * @param \nochso\WriteMe\Markdown\Header $header
  *
  * @return \nochso\WriteMe\Markdown\HeaderContent
  */
 public static function fromHeader(Header $header)
 {
     return new self($header->getLevel(), $header->getText());
 }