Skip to content

Commit

Permalink
feat: allow AnchorNavigation class to be overriden
Browse files Browse the repository at this point in the history
  • Loading branch information
juliawarnke committed Jul 19, 2023
1 parent 3fa683c commit 91745f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Tags/AnchorNavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public function index(): ?array
return null;
}

$this->augmentor = self::defineAugmentor();
$this->augmentor = $this->defineAugmentor();

return self::collectHeadings();
return $this->collectHeadings();
}

public function count(): int
{
$headings = self::index() ?? [];
$headings = $this->index() ?? [];

return count($headings);
}
Expand Down Expand Up @@ -79,19 +79,19 @@ protected function collectHeadings(): array
return [];
}

if (! in_array($item['attrs']['level'], self::allowedHeadingLevels())) {
if (! in_array($item['attrs']['level'], $this->allowedHeadingLevels())) {
return [];
}

$htmlHeading = $this->augmentor->convertToHtml([$item]);

if (! $id = self::getId($htmlHeading)) {
if (! $id = $this->getId($htmlHeading)) {
return [];
}

return [
'id' => $id,
'headline' => self::sanitize($item['content'][0]['text']),
'headline' => $this->sanitize($item['content'][0]['text']),
'level' => $item['attrs']['level'],
];
})
Expand Down

0 comments on commit 91745f7

Please sign in to comment.