From 91745f7aa7743ee8cefaf74dcdca28c30436e183 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 19 Jul 2023 14:42:00 +0200 Subject: [PATCH] feat: allow AnchorNavigation class to be overriden --- src/Tags/AnchorNavigation.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Tags/AnchorNavigation.php b/src/Tags/AnchorNavigation.php index f4f0c5a..a3a5482 100644 --- a/src/Tags/AnchorNavigation.php +++ b/src/Tags/AnchorNavigation.php @@ -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); } @@ -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'], ]; })