diff --git a/TableOfContents.php b/TableOfContents.php index 1fc5f2c..68b1abc 100644 --- a/TableOfContents.php +++ b/TableOfContents.php @@ -222,7 +222,7 @@ private function getList($document, $headers, &$index = 0) // Add missing id's to the h tags $id = $curr_header->getAttribute('id'); if ($id === "") { - $id = $this->slugify($curr_header->nodeValue); + $id = $this->slugify($curr_header->nodeValue) . '-' . $index; $curr_header->setAttribute('id', $id); }