--- Toc.php	2007-01-11 09:41:18.000000000 +0100
+++ Toc.php2	2007-01-11 09:10:03.000000000 +0100
@@ -50,7 +50,8 @@
 
     function token($options)
     {
-        // type, id, level, count, attr
+        static $headingIndexToc;
+    	// type, id, level, count, attr
         extract($options);
 
         switch ($type) {
@@ -92,6 +93,24 @@
             break;
 
         case 'item_start':
+        	$headingPrefix = "";
+
+        	if($this->getConf('headingIndexes')){
+	        	if (!isset($headingIndexToc[$level])){
+		        	$headingIndexToc[$level] = 1;
+		        } else {
+		        	$headingIndexToc[$level]++;
+		        	for ($i = $level + 1; $i <= 6; $i ++){
+		        		$headingIndexToc[$i] = 0;
+		        	}
+		        }
+	            foreach ($headingIndexToc as $value){
+	            	if ($value > 0){
+	            		$headingPrefix .= "{$value}.";
+	            	}
+	            }
+        	}
+
             $html = "\n\t<div";
 
             $css = $this->getConf('css_item');
@@ -102,7 +121,7 @@
             $pad = ($level - $this->min);
             $html .= " style=\"margin-left: {$pad}em;\">";
 
-            $html .= "<a href=\"#$id\">";
+            $html .= "<a href=\"#$id\">".$headingPrefix . " ";
             return $html;
             break;
 
