diff --git a/include/html2text.php b/include/html2text.php
index c4499761467e9d8a100dd9fb2302644cafb9bf2f..0e11869916393508c9ed8e327c31d5ff917f035c 100644
--- a/include/html2text.php
+++ b/include/html2text.php
@@ -218,8 +218,9 @@ class HtmlInlineElement {
         }
         if ($this->footnotes) {
             $output .= "\n\n" . str_repeat('-', $width/2) . "\n";
+            $id = 1;
             foreach ($this->footnotes as $name=>$content)
-                $output .= "[$name] ".$content."\n";
+                $output .= sprintf("[%d] %s\n", $id++, $content);
         }
         return $output;
     }
@@ -277,6 +278,7 @@ class HtmlInlineElement {
 
     function addFootNote($name, $content) {
         $this->footnotes[$name] = $content;
+        return count($this->footnotes);
     }
 }
 
@@ -447,8 +449,8 @@ class HtmlAElement extends HtmlInlineElement {
             $output = (($href != $output) ? "$href " : '') . "<$output>";
         } elseif (mb_strwidth($href) > $width / 2) {
             if ($href != $output)
-                $this->getRoot()->addFootnote($output, $href);
-            $output = "[$output]";
+                $id = $this->getRoot()->addFootnote($output, $href);
+            $output = "[$output][$id]";
         } elseif ($href != $output) {
             $output = "[$output]($href)";
         }