diff --git a/docs/NODE_API.md b/docs/NODE_API.md
index 96110e806..e509a838c 100644
--- a/docs/NODE_API.md
+++ b/docs/NODE_API.md
@@ -1,5 +1,15 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [build](#build)
+-   [buildSync](#buildsync)
+-   [lint](#lint)
+-   [formats](#formats)
+-   [formats.html](#formatshtml)
+-   [formats.markdown](#formatsmarkdown)
+-   [formats.json](#formatsjson)
+
 ## build
 
 Generate JavaScript documentation as a list of parsed JSDoc
diff --git a/lib/commands/build.js b/lib/commands/build.js
index 4fd6fe74c..c7757a4b3 100644
--- a/lib/commands/build.js
+++ b/lib/commands/build.js
@@ -26,6 +26,11 @@ module.exports.builder = extend({},
       default: 'json',
       choices: ['json', 'md', 'remark', 'html']
     },
+    'no-markdown-toc': {
+      describe: 'include a table of contents in markdown output',
+      default: 'stdout',
+      type: 'boolean'
+    },
     output: {
       describe: 'output location. omit for stdout, otherwise is a filename ' +
       'for single-file outputs and a directory name for multi-file outputs like html',
@@ -66,6 +71,7 @@ module.exports.handler = function build(argv, callback) {
       version: argv['project-version'] || (argv.package || {}).version,
       theme: argv.theme,
       paths: argv.paths,
+      'no-markdown-toc': argv['no-markdown-toc'],
       hljs: argv.hljs || {}
     };
 
diff --git a/lib/commands/readme.js b/lib/commands/readme.js
index 32bd80326..7c4986709 100644
--- a/lib/commands/readme.js
+++ b/lib/commands/readme.js
@@ -42,6 +42,8 @@ module.exports.builder = {
   example: 'documentation readme index.js -s "API Docs" --github'
 };
 
+function noop() {}
+
 /**
  * Insert API documentation into a Markdown readme
  * @private
@@ -53,8 +55,7 @@ module.exports.handler = function readme(argv) {
   argv = sharedOptions.expandInputs(argv);
   argv.format = 'remark';
   /* eslint no-console: 0 */
-  var log = argv.q ? function () {}
-  : console.log.bind(console, '[documentation-readme] ');
+  var log = argv.q ? noop : console.log.bind(console, '[documentation-readme] ');
   var readmeFile = argv['readme-file'];
 
   build.handler(argv, onAst);
diff --git a/lib/output/markdown.js b/lib/output/markdown.js
index cf890296a..b2b29bf10 100644
--- a/lib/output/markdown.js
+++ b/lib/output/markdown.js
@@ -1,7 +1,6 @@
 'use strict';
 
 var remark = require('remark'),
-  toc = require('remark-toc'),
   markdownAST = require('./markdown_ast');
 
 /**
@@ -26,9 +25,7 @@ var remark = require('remark'),
  * });
  */
 module.exports = function (comments, options, callback) {
-  var processor = remark().use(toc);
   markdownAST(comments, options, function (err, ast) {
-    var processedAST = processor.run(ast);
-    return callback(null, processor.stringify(processedAST));
+    return callback(null, remark().stringify(ast));
   });
 };
diff --git a/lib/output/markdown_ast.js b/lib/output/markdown_ast.js
index 10c202387..2b37c80a0 100644
--- a/lib/output/markdown_ast.js
+++ b/lib/output/markdown_ast.js
@@ -1,4 +1,6 @@
 var u = require('unist-builder'),
+  remark = require('remark'),
+  toc = require('remark-toc'),
   hljs = require('highlight.js'),
   GithubSlugger = require('github-slugger'),
   createLinkerStack = require('./util/linker_stack'),
@@ -14,7 +16,7 @@ var u = require('unist-builder'),
  * @param {Function} callback called with AST
  * @returns {undefined} calls callback
  */
-function commentsToAST(comments, options, callback) {
+function markdownAST(comments, options, callback) {
 
   // Configure code highlighting
   var hljsOptions = (options || {}).hljs || {},
@@ -33,6 +35,10 @@ function commentsToAST(comments, options, callback) {
     u('html', '<!-- Generated by documentation.js. Update this documentation by updating the source code. -->')
   ];
 
+  var tableOfContentsHeading = [
+    u('heading', { depth: 3 }, [u('text', 'Table of Contents')])
+  ];
+
   /**
    * Generate an AST chunk for a comment at a given depth: this is
    * split from the main function to handle hierarchially nested comments
@@ -202,10 +208,20 @@ function commentsToAST(comments, options, callback) {
     .filter(Boolean);
   }
 
-  return callback(null, rerouteLinks(linkerStack.link,
-    u('root', generatorComment.concat(comments.reduce(function (memo, comment) {
-      return memo.concat(generate(2, comment));
-    }, [])))));
+  var root = rerouteLinks(linkerStack.link,
+    u('root', generatorComment
+      .concat(options['no-markdown-toc'] ? [] : tableOfContentsHeading)
+      .concat(comments.reduce(function (memo, comment) {
+        return memo.concat(generate(2, comment));
+      }, []))));
+
+  if (!options['no-markdown-toc']) {
+    return remark().use(toc, {
+      tight: true
+    }).run(root, callback);
+  }
+
+  return callback(null, root);
 }
 
-module.exports = commentsToAST;
+module.exports = markdownAST;
diff --git a/test/fixture/auto_lang_hljs/multilanguage.output.md b/test/fixture/auto_lang_hljs/multilanguage.output.md
index e648388cc..c7c1fe56c 100644
--- a/test/fixture/auto_lang_hljs/multilanguage.output.md
+++ b/test/fixture/auto_lang_hljs/multilanguage.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [multilanguage.input](#multilanguageinput)
+
 ## multilanguage.input
 
 **Extends Foo, Bar**
diff --git a/test/fixture/boolean-literal-type.output.md b/test/fixture/boolean-literal-type.output.md
index 08591845f..da400ec81 100644
--- a/test/fixture/boolean-literal-type.output.md
+++ b/test/fixture/boolean-literal-type.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [f](#f)
+
 ## f
 
 **Parameters**
diff --git a/test/fixture/boolean-literal-type.output.md.json b/test/fixture/boolean-literal-type.output.md.json
index c6e85d7d4..c59ae7bb8 100644
--- a/test/fixture/boolean-literal-type.output.md.json
+++ b/test/fixture/boolean-literal-type.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#f",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "f"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "f"
         }
-      ]
+      ],
+      "data": {
+        "id": "f",
+        "htmlAttributes": {
+          "id": "f"
+        },
+        "hProperties": {
+          "id": "f"
+        }
+      }
     },
     {
       "type": "strong",
diff --git a/test/fixture/class.config.output.md b/test/fixture/class.config.output.md
index 5f0f252c7..ed2aaa9e1 100644
--- a/test/fixture/class.config.output.md
+++ b/test/fixture/class.config.output.md
@@ -1,5 +1,12 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [MyClass](#myclass)
+    -   [getFoo](#getfoo)
+    -   [getUndefined](#getundefined)
+-   [Hello](#hello)
+
 ## MyClass
 
 This is my class, a demo thing.
diff --git a/test/fixture/class.output.md b/test/fixture/class.output.md
index df8a9e126..0c88fe44d 100644
--- a/test/fixture/class.output.md
+++ b/test/fixture/class.output.md
@@ -1,5 +1,11 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [MyClass](#myclass)
+    -   [getFoo](#getfoo)
+    -   [getUndefined](#getundefined)
+
 ## MyClass
 
 This is my class, a demo thing.
diff --git a/test/fixture/class.output.md.json b/test/fixture/class.output.md.json
index 4292255b6..8efdb7a4f 100644
--- a/test/fixture/class.output.md.json
+++ b/test/fixture/class.output.md.json
@@ -5,6 +5,103 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#myclass",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "MyClass"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#getfoo",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "getFoo"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#getundefined",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "getUndefined"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +110,16 @@
           "type": "text",
           "value": "MyClass"
         }
-      ]
+      ],
+      "data": {
+        "id": "myclass",
+        "htmlAttributes": {
+          "id": "myclass"
+        },
+        "hProperties": {
+          "id": "myclass"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -146,7 +252,16 @@
           "type": "text",
           "value": "getFoo"
         }
-      ]
+      ],
+      "data": {
+        "id": "getfoo",
+        "htmlAttributes": {
+          "id": "getfoo"
+        },
+        "hProperties": {
+          "id": "getfoo"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -343,7 +458,16 @@
           "type": "text",
           "value": "getUndefined"
         }
-      ]
+      ],
+      "data": {
+        "id": "getundefined",
+        "htmlAttributes": {
+          "id": "getundefined"
+        },
+        "hProperties": {
+          "id": "getundefined"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/document-exported-export-default-object.output.md b/test/fixture/document-exported-export-default-object.output.md
index fa48d7363..b2ffbf9a7 100644
--- a/test/fixture/document-exported-export-default-object.output.md
+++ b/test/fixture/document-exported-export-default-object.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [document-exported-export-default-object.input](#document-exported-export-default-objectinput)
+-   [x](#x)
+
 ## document-exported-export-default-object.input
 
 ## x
diff --git a/test/fixture/document-exported-export-default-object.output.md.json b/test/fixture/document-exported-export-default-object.output.md.json
index c79cb8e64..1bb59256b 100644
--- a/test/fixture/document-exported-export-default-object.output.md.json
+++ b/test/fixture/document-exported-export-default-object.output.md.json
@@ -5,6 +5,75 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#document-exported-export-default-objectinput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "document-exported-export-default-object.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#x",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "x"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +82,16 @@
           "type": "text",
           "value": "document-exported-export-default-object.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "document-exported-export-default-objectinput",
+        "htmlAttributes": {
+          "id": "document-exported-export-default-objectinput"
+        },
+        "hProperties": {
+          "id": "document-exported-export-default-objectinput"
+        }
+      }
     },
     {
       "depth": 2,
@@ -23,7 +101,16 @@
           "type": "text",
           "value": "x"
         }
-      ]
+      ],
+      "data": {
+        "id": "x",
+        "htmlAttributes": {
+          "id": "x"
+        },
+        "hProperties": {
+          "id": "x"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/document-exported-export-default-value.output.md b/test/fixture/document-exported-export-default-value.output.md
index e0d96cfbd..f003118a1 100644
--- a/test/fixture/document-exported-export-default-value.output.md
+++ b/test/fixture/document-exported-export-default-value.output.md
@@ -1,3 +1,7 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [document-exported-export-default-value.input](#document-exported-export-default-valueinput)
+
 ## document-exported-export-default-value.input
diff --git a/test/fixture/document-exported-export-default-value.output.md.json b/test/fixture/document-exported-export-default-value.output.md.json
index 686f080df..fb2e8877e 100644
--- a/test/fixture/document-exported-export-default-value.output.md.json
+++ b/test/fixture/document-exported-export-default-value.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#document-exported-export-default-valueinput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "document-exported-export-default-value.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "document-exported-export-default-value.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "document-exported-export-default-valueinput",
+        "htmlAttributes": {
+          "id": "document-exported-export-default-valueinput"
+        },
+        "hProperties": {
+          "id": "document-exported-export-default-valueinput"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/document-exported.output.md b/test/fixture/document-exported.output.md
index 5c032f9d1..c87825624 100644
--- a/test/fixture/document-exported.output.md
+++ b/test/fixture/document-exported.output.md
@@ -1,5 +1,38 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [z](#z)
+    -   [zMethod](#zmethod)
+-   [x](#x)
+-   [Class](#class)
+    -   [classMethod](#classmethod)
+    -   [classGetter](#classgetter)
+    -   [classSetter](#classsetter)
+    -   [staticMethod](#staticmethod)
+    -   [staticGetter](#staticgetter)
+    -   [staticSetter](#staticsetter)
+-   [T5](#t5)
+-   [y2Default](#y2default)
+-   [y4](#y4)
+-   [object](#object)
+    -   [prop](#prop)
+    -   [func](#func)
+-   [method](#method)
+-   [getter](#getter)
+-   [setter](#setter)
+-   [f1](#f1)
+-   [f3](#f3)
+-   [T](#t)
+-   [T2](#t2)
+-   [T4](#t4)
+-   [f4](#f4)
+-   [o1](#o1)
+-   [om1](#om1)
+-   [f5](#f5)
+-   [o2](#o2)
+-   [om2](#om2)
+
 ## z
 
 ### zMethod
diff --git a/test/fixture/document-exported.output.md.json b/test/fixture/document-exported.output.md.json
index ad889a0a2..7a602f739 100644
--- a/test/fixture/document-exported.output.md.json
+++ b/test/fixture/document-exported.output.md.json
@@ -5,6 +5,709 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#z",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "z"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#zmethod",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "zMethod"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#x",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "x"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#class",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Class"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#classmethod",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "classMethod"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#classgetter",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "classGetter"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#classsetter",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "classSetter"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#staticmethod",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "staticMethod"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#staticgetter",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "staticGetter"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#staticsetter",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "staticSetter"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#t5",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "T5"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#y2default",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "y2Default"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#y4",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "y4"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#object",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "object"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#prop",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "prop"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#func",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "func"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#method",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "method"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#getter",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "getter"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#setter",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "setter"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#f1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "f1"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#f3",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "f3"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#t",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "T"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#t2",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "T2"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#t4",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "T4"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#f4",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "f4"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#o1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "o1"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#om1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "om1"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#f5",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "f5"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#o2",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "o2"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#om2",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "om2"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +716,16 @@
           "type": "text",
           "value": "z"
         }
-      ]
+      ],
+      "data": {
+        "id": "z",
+        "htmlAttributes": {
+          "id": "z"
+        },
+        "hProperties": {
+          "id": "z"
+        }
+      }
     },
     {
       "depth": 3,
@@ -23,7 +735,16 @@
           "type": "text",
           "value": "zMethod"
         }
-      ]
+      ],
+      "data": {
+        "id": "zmethod",
+        "htmlAttributes": {
+          "id": "zmethod"
+        },
+        "hProperties": {
+          "id": "zmethod"
+        }
+      }
     },
     {
       "depth": 2,
@@ -33,7 +754,16 @@
           "type": "text",
           "value": "x"
         }
-      ]
+      ],
+      "data": {
+        "id": "x",
+        "htmlAttributes": {
+          "id": "x"
+        },
+        "hProperties": {
+          "id": "x"
+        }
+      }
     },
     {
       "type": "strong",
@@ -80,7 +810,16 @@
           "type": "text",
           "value": "Class"
         }
-      ]
+      ],
+      "data": {
+        "id": "class",
+        "htmlAttributes": {
+          "id": "class"
+        },
+        "hProperties": {
+          "id": "class"
+        }
+      }
     },
     {
       "depth": 3,
@@ -90,7 +829,16 @@
           "type": "text",
           "value": "classMethod"
         }
-      ]
+      ],
+      "data": {
+        "id": "classmethod",
+        "htmlAttributes": {
+          "id": "classmethod"
+        },
+        "hProperties": {
+          "id": "classmethod"
+        }
+      }
     },
     {
       "depth": 3,
@@ -100,7 +848,16 @@
           "type": "text",
           "value": "classGetter"
         }
-      ]
+      ],
+      "data": {
+        "id": "classgetter",
+        "htmlAttributes": {
+          "id": "classgetter"
+        },
+        "hProperties": {
+          "id": "classgetter"
+        }
+      }
     },
     {
       "depth": 3,
@@ -110,7 +867,16 @@
           "type": "text",
           "value": "classSetter"
         }
-      ]
+      ],
+      "data": {
+        "id": "classsetter",
+        "htmlAttributes": {
+          "id": "classsetter"
+        },
+        "hProperties": {
+          "id": "classsetter"
+        }
+      }
     },
     {
       "type": "strong",
@@ -157,7 +923,16 @@
           "type": "text",
           "value": "staticMethod"
         }
-      ]
+      ],
+      "data": {
+        "id": "staticmethod",
+        "htmlAttributes": {
+          "id": "staticmethod"
+        },
+        "hProperties": {
+          "id": "staticmethod"
+        }
+      }
     },
     {
       "depth": 3,
@@ -167,7 +942,16 @@
           "type": "text",
           "value": "staticGetter"
         }
-      ]
+      ],
+      "data": {
+        "id": "staticgetter",
+        "htmlAttributes": {
+          "id": "staticgetter"
+        },
+        "hProperties": {
+          "id": "staticgetter"
+        }
+      }
     },
     {
       "depth": 3,
@@ -177,7 +961,16 @@
           "type": "text",
           "value": "staticSetter"
         }
-      ]
+      ],
+      "data": {
+        "id": "staticsetter",
+        "htmlAttributes": {
+          "id": "staticsetter"
+        },
+        "hProperties": {
+          "id": "staticsetter"
+        }
+      }
     },
     {
       "type": "strong",
@@ -224,7 +1017,16 @@
           "type": "text",
           "value": "T5"
         }
-      ]
+      ],
+      "data": {
+        "id": "t5",
+        "htmlAttributes": {
+          "id": "t5"
+        },
+        "hProperties": {
+          "id": "t5"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -254,7 +1056,16 @@
           "type": "text",
           "value": "y2Default"
         }
-      ]
+      ],
+      "data": {
+        "id": "y2default",
+        "htmlAttributes": {
+          "id": "y2default"
+        },
+        "hProperties": {
+          "id": "y2default"
+        }
+      }
     },
     {
       "depth": 2,
@@ -264,7 +1075,16 @@
           "type": "text",
           "value": "y4"
         }
-      ]
+      ],
+      "data": {
+        "id": "y4",
+        "htmlAttributes": {
+          "id": "y4"
+        },
+        "hProperties": {
+          "id": "y4"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -384,7 +1204,16 @@
           "type": "text",
           "value": "object"
         }
-      ]
+      ],
+      "data": {
+        "id": "object",
+        "htmlAttributes": {
+          "id": "object"
+        },
+        "hProperties": {
+          "id": "object"
+        }
+      }
     },
     {
       "depth": 3,
@@ -394,7 +1223,16 @@
           "type": "text",
           "value": "prop"
         }
-      ]
+      ],
+      "data": {
+        "id": "prop",
+        "htmlAttributes": {
+          "id": "prop"
+        },
+        "hProperties": {
+          "id": "prop"
+        }
+      }
     },
     {
       "depth": 3,
@@ -404,7 +1242,16 @@
           "type": "text",
           "value": "func"
         }
-      ]
+      ],
+      "data": {
+        "id": "func",
+        "htmlAttributes": {
+          "id": "func"
+        },
+        "hProperties": {
+          "id": "func"
+        }
+      }
     },
     {
       "depth": 2,
@@ -414,7 +1261,16 @@
           "type": "text",
           "value": "method"
         }
-      ]
+      ],
+      "data": {
+        "id": "method",
+        "htmlAttributes": {
+          "id": "method"
+        },
+        "hProperties": {
+          "id": "method"
+        }
+      }
     },
     {
       "depth": 2,
@@ -424,7 +1280,16 @@
           "type": "text",
           "value": "getter"
         }
-      ]
+      ],
+      "data": {
+        "id": "getter",
+        "htmlAttributes": {
+          "id": "getter"
+        },
+        "hProperties": {
+          "id": "getter"
+        }
+      }
     },
     {
       "depth": 2,
@@ -434,7 +1299,16 @@
           "type": "text",
           "value": "setter"
         }
-      ]
+      ],
+      "data": {
+        "id": "setter",
+        "htmlAttributes": {
+          "id": "setter"
+        },
+        "hProperties": {
+          "id": "setter"
+        }
+      }
     },
     {
       "type": "strong",
@@ -481,7 +1355,16 @@
           "type": "text",
           "value": "f1"
         }
-      ]
+      ],
+      "data": {
+        "id": "f1",
+        "htmlAttributes": {
+          "id": "f1"
+        },
+        "hProperties": {
+          "id": "f1"
+        }
+      }
     },
     {
       "depth": 2,
@@ -491,7 +1374,16 @@
           "type": "text",
           "value": "f3"
         }
-      ]
+      ],
+      "data": {
+        "id": "f3",
+        "htmlAttributes": {
+          "id": "f3"
+        },
+        "hProperties": {
+          "id": "f3"
+        }
+      }
     },
     {
       "depth": 2,
@@ -501,7 +1393,16 @@
           "type": "text",
           "value": "T"
         }
-      ]
+      ],
+      "data": {
+        "id": "t",
+        "htmlAttributes": {
+          "id": "t"
+        },
+        "hProperties": {
+          "id": "t"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -531,7 +1432,16 @@
           "type": "text",
           "value": "T2"
         }
-      ]
+      ],
+      "data": {
+        "id": "t2",
+        "htmlAttributes": {
+          "id": "t2"
+        },
+        "hProperties": {
+          "id": "t2"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -561,7 +1471,16 @@
           "type": "text",
           "value": "T4"
         }
-      ]
+      ],
+      "data": {
+        "id": "t4",
+        "htmlAttributes": {
+          "id": "t4"
+        },
+        "hProperties": {
+          "id": "t4"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -591,7 +1510,16 @@
           "type": "text",
           "value": "f4"
         }
-      ]
+      ],
+      "data": {
+        "id": "f4",
+        "htmlAttributes": {
+          "id": "f4"
+        },
+        "hProperties": {
+          "id": "f4"
+        }
+      }
     },
     {
       "type": "strong",
@@ -647,7 +1575,16 @@
           "type": "text",
           "value": "o1"
         }
-      ]
+      ],
+      "data": {
+        "id": "o1",
+        "htmlAttributes": {
+          "id": "o1"
+        },
+        "hProperties": {
+          "id": "o1"
+        }
+      }
     },
     {
       "depth": 2,
@@ -657,7 +1594,16 @@
           "type": "text",
           "value": "om1"
         }
-      ]
+      ],
+      "data": {
+        "id": "om1",
+        "htmlAttributes": {
+          "id": "om1"
+        },
+        "hProperties": {
+          "id": "om1"
+        }
+      }
     },
     {
       "depth": 2,
@@ -667,7 +1613,16 @@
           "type": "text",
           "value": "f5"
         }
-      ]
+      ],
+      "data": {
+        "id": "f5",
+        "htmlAttributes": {
+          "id": "f5"
+        },
+        "hProperties": {
+          "id": "f5"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -758,7 +1713,16 @@
           "type": "text",
           "value": "o2"
         }
-      ]
+      ],
+      "data": {
+        "id": "o2",
+        "htmlAttributes": {
+          "id": "o2"
+        },
+        "hProperties": {
+          "id": "o2"
+        }
+      }
     },
     {
       "depth": 2,
@@ -768,7 +1732,16 @@
           "type": "text",
           "value": "om2"
         }
-      ]
+      ],
+      "data": {
+        "id": "om2",
+        "htmlAttributes": {
+          "id": "om2"
+        },
+        "hProperties": {
+          "id": "om2"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/es6-class.output.md b/test/fixture/es6-class.output.md
index 720845afc..e19e05243 100644
--- a/test/fixture/es6-class.output.md
+++ b/test/fixture/es6-class.output.md
@@ -1,5 +1,12 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [Foo](#foo)
+-   [Bar](#bar)
+    -   [constructor](#constructor)
+    -   [bar](#bar-1)
+
 ## Foo
 
 **Extends React.Component**
diff --git a/test/fixture/es6-class.output.md.json b/test/fixture/es6-class.output.md.json
index be9e2c03f..30e48a47d 100644
--- a/test/fixture/es6-class.output.md.json
+++ b/test/fixture/es6-class.output.md.json
@@ -5,6 +5,125 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#bar",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Bar"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#constructor",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "constructor"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#bar-1",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "bar"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +132,16 @@
           "type": "text",
           "value": "Foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -76,7 +204,16 @@
           "type": "text",
           "value": "Bar"
         }
-      ]
+      ],
+      "data": {
+        "id": "bar",
+        "htmlAttributes": {
+          "id": "bar"
+        },
+        "hProperties": {
+          "id": "bar"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -121,7 +258,16 @@
           "type": "text",
           "value": "constructor"
         }
-      ]
+      ],
+      "data": {
+        "id": "constructor",
+        "htmlAttributes": {
+          "id": "constructor"
+        },
+        "hProperties": {
+          "id": "constructor"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -219,7 +365,16 @@
           "type": "text",
           "value": "bar"
         }
-      ]
+      ],
+      "data": {
+        "id": "bar-1",
+        "htmlAttributes": {
+          "id": "bar-1"
+        },
+        "hProperties": {
+          "id": "bar-1"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/es6-default2.output.md b/test/fixture/es6-default2.output.md
index 45a08c991..9cb89de6e 100644
--- a/test/fixture/es6-default2.output.md
+++ b/test/fixture/es6-default2.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [es6-default2.input](#es6-default2input)
+
 ## es6-default2.input
 
 **Parameters**
diff --git a/test/fixture/es6-default2.output.md.json b/test/fixture/es6-default2.output.md.json
index 3e6561ebd..5b20bb0bc 100644
--- a/test/fixture/es6-default2.output.md.json
+++ b/test/fixture/es6-default2.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#es6-default2input",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "es6-default2.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "es6-default2.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "es6-default2input",
+        "htmlAttributes": {
+          "id": "es6-default2input"
+        },
+        "hProperties": {
+          "id": "es6-default2input"
+        }
+      }
     },
     {
       "type": "strong",
diff --git a/test/fixture/es6-import.output.md b/test/fixture/es6-import.output.md
index 1fd7d3985..9ca299da6 100644
--- a/test/fixture/es6-import.output.md
+++ b/test/fixture/es6-import.output.md
@@ -1,5 +1,11 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [multiplyTwice](#multiplytwice)
+-   [es6-ext](#es6-ext)
+-   [simple.input](#simpleinput)
+
 ## multiplyTwice
 
 This function returns the number one.
diff --git a/test/fixture/es6-import.output.md.json b/test/fixture/es6-import.output.md.json
index a07e50523..b4142afb6 100644
--- a/test/fixture/es6-import.output.md.json
+++ b/test/fixture/es6-import.output.md.json
@@ -5,6 +5,97 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#multiplytwice",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "multiplyTwice"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#es6-ext",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "es6-ext"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#simpleinput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "simple.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +104,16 @@
           "type": "text",
           "value": "multiplyTwice"
         }
-      ]
+      ],
+      "data": {
+        "id": "multiplytwice",
+        "htmlAttributes": {
+          "id": "multiplytwice"
+        },
+        "hProperties": {
+          "id": "multiplytwice"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -159,7 +259,16 @@
           "type": "text",
           "value": "es6-ext"
         }
-      ]
+      ],
+      "data": {
+        "id": "es6-ext",
+        "htmlAttributes": {
+          "id": "es6-ext"
+        },
+        "hProperties": {
+          "id": "es6-ext"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -204,7 +313,16 @@
           "type": "text",
           "value": "simple.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "simpleinput",
+        "htmlAttributes": {
+          "id": "simpleinput"
+        },
+        "hProperties": {
+          "id": "simpleinput"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/es6.output-toc.md b/test/fixture/es6.output-toc.md
new file mode 100644
index 000000000..6a3d7ffa7
--- /dev/null
+++ b/test/fixture/es6.output-toc.md
@@ -0,0 +1,140 @@
+<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
+
+## destructure
+
+This function destructures with defaults. It should not
+have any parameter descriptions.
+
+**Parameters**
+
+-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)
+    -   `$0.phoneNumbers`   (optional, default `[]`)
+    -   `$0.emailAddresses`   (optional, default `[]`)
+    -   `$0.params` **...any** 
+
+## destructure
+
+Similar, but with an array
+
+**Parameters**
+
+-   `$0` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** 
+    -   `$0.a`  
+    -   `$0.b`  
+    -   `$0.c`  
+
+**Examples**
+
+```javascript
+destructure([1, 2, 3])
+```
+
+## multiply
+
+This function returns the number one.
+
+**Parameters**
+
+-   `a` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** an array of numbers
+-   `b`  
+
+Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone
+
+## Sink
+
+This is a sink
+
+### staticProp
+
+This is a property of the sink.
+
+### empty
+
+Is it empty
+
+### aGetter
+
+This is a getter method: it should be documented
+as a property.
+
+### constructor
+
+**Parameters**
+
+-   `height` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the height of the thing
+-   `width` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the width of the thing
+
+### hello
+
+This method says hello
+
+## makeABasket
+
+This method returns a basket. The type should not be linked.
+
+Returns **Basket** a basket
+
+## makeASink
+
+This method returns a [sink](#sink). The type should be linked.
+It takes a [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) which should also be linked.
+
+Returns **[Sink](#sink)** a sink
+
+## functionWithRest
+
+This function takes rest params
+
+**Parameters**
+
+-   `someParams` **...any** 
+
+## functionWithRestAndType
+
+So does this one, with types
+
+**Parameters**
+
+-   `someParams` **...[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** 
+
+## foo
+
+This is an async method
+
+## es6.input
+
+This function returns the number one.
+
+Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone
+
+## veryImportantTransform
+
+This tests our support of optional parameters in ES6
+
+**Parameters**
+
+-   `foo`   (optional, default `'bar'`)
+
+## iAmProtected
+
+A protected function
+
+## iAmPublic
+
+A public function
+
+## execute
+
+This is re-exported
+
+## isArrayEqualWith
+
+Regression check for #498
+
+**Parameters**
+
+-   `array1` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;T>** 
+-   `array2` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;T>** 
+-   `compareFunction` **function (a: T, b: T): [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**  (optional, default `(a: T, b: T): boolean => a === b`)
+
+Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
diff --git a/test/fixture/es6.output.md b/test/fixture/es6.output.md
index 6a3d7ffa7..3aeec16ce 100644
--- a/test/fixture/es6.output.md
+++ b/test/fixture/es6.output.md
@@ -1,5 +1,28 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [destructure](#destructure)
+-   [destructure](#destructure-1)
+-   [multiply](#multiply)
+-   [Sink](#sink)
+    -   [staticProp](#staticprop)
+    -   [empty](#empty)
+    -   [aGetter](#agetter)
+    -   [constructor](#constructor)
+    -   [hello](#hello)
+-   [makeABasket](#makeabasket)
+-   [makeASink](#makeasink)
+-   [functionWithRest](#functionwithrest)
+-   [functionWithRestAndType](#functionwithrestandtype)
+-   [foo](#foo)
+-   [es6.input](#es6input)
+-   [veryImportantTransform](#veryimportanttransform)
+-   [iAmProtected](#iamprotected)
+-   [iAmPublic](#iampublic)
+-   [execute](#execute)
+-   [isArrayEqualWith](#isarrayequalwith)
+
 ## destructure
 
 This function destructures with defaults. It should not
diff --git a/test/fixture/es6.output.md.json b/test/fixture/es6.output.md.json
index 0d8b336a2..3a7a26f49 100644
--- a/test/fixture/es6.output.md.json
+++ b/test/fixture/es6.output.md.json
@@ -5,6 +5,477 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#destructure",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "destructure"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#destructure-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "destructure"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#multiply",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "multiply"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#sink",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Sink"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#staticprop",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "staticProp"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#empty",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "empty"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#agetter",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "aGetter"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#constructor",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "constructor"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#hello",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "hello"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#makeabasket",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "makeABasket"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#makeasink",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "makeASink"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#functionwithrest",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "functionWithRest"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#functionwithrestandtype",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "functionWithRestAndType"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#es6input",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "es6.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#veryimportanttransform",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "veryImportantTransform"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#iamprotected",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "iAmProtected"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#iampublic",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "iAmPublic"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#execute",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "execute"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#isarrayequalwith",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "isArrayEqualWith"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +484,16 @@
           "type": "text",
           "value": "destructure"
         }
-      ]
+      ],
+      "data": {
+        "id": "destructure",
+        "htmlAttributes": {
+          "id": "destructure"
+        },
+        "hProperties": {
+          "id": "destructure"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -251,7 +731,16 @@
           "type": "text",
           "value": "destructure"
         }
-      ]
+      ],
+      "data": {
+        "id": "destructure-1",
+        "htmlAttributes": {
+          "id": "destructure-1"
+        },
+        "hProperties": {
+          "id": "destructure-1"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -435,7 +924,16 @@
           "type": "text",
           "value": "multiply"
         }
-      ]
+      ],
+      "data": {
+        "id": "multiply",
+        "htmlAttributes": {
+          "id": "multiply"
+        },
+        "hProperties": {
+          "id": "multiply"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -673,7 +1171,16 @@
           "type": "text",
           "value": "Sink"
         }
-      ]
+      ],
+      "data": {
+        "id": "sink",
+        "htmlAttributes": {
+          "id": "sink"
+        },
+        "hProperties": {
+          "id": "sink"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -718,7 +1225,16 @@
           "type": "text",
           "value": "staticProp"
         }
-      ]
+      ],
+      "data": {
+        "id": "staticprop",
+        "htmlAttributes": {
+          "id": "staticprop"
+        },
+        "hProperties": {
+          "id": "staticprop"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -763,7 +1279,16 @@
           "type": "text",
           "value": "empty"
         }
-      ]
+      ],
+      "data": {
+        "id": "empty",
+        "htmlAttributes": {
+          "id": "empty"
+        },
+        "hProperties": {
+          "id": "empty"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -808,7 +1333,16 @@
           "type": "text",
           "value": "aGetter"
         }
-      ]
+      ],
+      "data": {
+        "id": "agetter",
+        "htmlAttributes": {
+          "id": "agetter"
+        },
+        "hProperties": {
+          "id": "agetter"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -857,7 +1391,16 @@
           "type": "text",
           "value": "constructor"
         }
-      ]
+      ],
+      "data": {
+        "id": "constructor",
+        "htmlAttributes": {
+          "id": "constructor"
+        },
+        "hProperties": {
+          "id": "constructor"
+        }
+      }
     },
     {
       "type": "strong",
@@ -1028,7 +1571,16 @@
           "type": "text",
           "value": "hello"
         }
-      ]
+      ],
+      "data": {
+        "id": "hello",
+        "htmlAttributes": {
+          "id": "hello"
+        },
+        "hProperties": {
+          "id": "hello"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1073,7 +1625,16 @@
           "type": "text",
           "value": "makeABasket"
         }
-      ]
+      ],
+      "data": {
+        "id": "makeabasket",
+        "htmlAttributes": {
+          "id": "makeabasket"
+        },
+        "hProperties": {
+          "id": "makeabasket"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1175,7 +1736,16 @@
           "type": "text",
           "value": "makeASink"
         }
-      ]
+      ],
+      "data": {
+        "id": "makeasink",
+        "htmlAttributes": {
+          "id": "makeasink"
+        },
+        "hProperties": {
+          "id": "makeasink"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1372,7 +1942,16 @@
           "type": "text",
           "value": "functionWithRest"
         }
-      ]
+      ],
+      "data": {
+        "id": "functionwithrest",
+        "htmlAttributes": {
+          "id": "functionwithrest"
+        },
+        "hProperties": {
+          "id": "functionwithrest"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1467,7 +2046,16 @@
           "type": "text",
           "value": "functionWithRestAndType"
         }
-      ]
+      ],
+      "data": {
+        "id": "functionwithrestandtype",
+        "htmlAttributes": {
+          "id": "functionwithrestandtype"
+        },
+        "hProperties": {
+          "id": "functionwithrestandtype"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1569,7 +2157,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1614,7 +2211,16 @@
           "type": "text",
           "value": "es6.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "es6input",
+        "htmlAttributes": {
+          "id": "es6input"
+        },
+        "hProperties": {
+          "id": "es6input"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1723,7 +2329,16 @@
           "type": "text",
           "value": "veryImportantTransform"
         }
-      ]
+      ],
+      "data": {
+        "id": "veryimportanttransform",
+        "htmlAttributes": {
+          "id": "veryimportanttransform"
+        },
+        "hProperties": {
+          "id": "veryimportanttransform"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1822,7 +2437,16 @@
           "type": "text",
           "value": "iAmProtected"
         }
-      ]
+      ],
+      "data": {
+        "id": "iamprotected",
+        "htmlAttributes": {
+          "id": "iamprotected"
+        },
+        "hProperties": {
+          "id": "iamprotected"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1867,7 +2491,16 @@
           "type": "text",
           "value": "iAmPublic"
         }
-      ]
+      ],
+      "data": {
+        "id": "iampublic",
+        "htmlAttributes": {
+          "id": "iampublic"
+        },
+        "hProperties": {
+          "id": "iampublic"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1912,7 +2545,16 @@
           "type": "text",
           "value": "execute"
         }
-      ]
+      ],
+      "data": {
+        "id": "execute",
+        "htmlAttributes": {
+          "id": "execute"
+        },
+        "hProperties": {
+          "id": "execute"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1957,7 +2599,16 @@
           "type": "text",
           "value": "isArrayEqualWith"
         }
-      ]
+      ],
+      "data": {
+        "id": "isarrayequalwith",
+        "htmlAttributes": {
+          "id": "isarrayequalwith"
+        },
+        "hProperties": {
+          "id": "isarrayequalwith"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/event.output.md b/test/fixture/event.output.md
index 60a2dcf3f..5ce6a3127 100644
--- a/test/fixture/event.output.md
+++ b/test/fixture/event.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [Map#mousemove](#mapmousemove)
+
 ## Map#mousemove
 
 Mouse event
diff --git a/test/fixture/event.output.md.json b/test/fixture/event.output.md.json
index 4d7dc7416..c64707a0c 100644
--- a/test/fixture/event.output.md.json
+++ b/test/fixture/event.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#mapmousemove",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Map#mousemove"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "Map#mousemove"
         }
-      ]
+      ],
+      "data": {
+        "id": "mapmousemove",
+        "htmlAttributes": {
+          "id": "mapmousemove"
+        },
+        "hProperties": {
+          "id": "mapmousemove"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/example-caption.output.md b/test/fixture/example-caption.output.md
index 0bf5853b2..6d7d56769 100644
--- a/test/fixture/example-caption.output.md
+++ b/test/fixture/example-caption.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [foo](#foo)
+
 ## foo
 
 This function returns the number one.
diff --git a/test/fixture/example-caption.output.md.json b/test/fixture/example-caption.output.md.json
index fa77489fc..2f174b755 100644
--- a/test/fixture/example-caption.output.md.json
+++ b/test/fixture/example-caption.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/external.output.md b/test/fixture/external.output.md
index c0b4a06ef..d037ab42c 100644
--- a/test/fixture/external.output.md
+++ b/test/fixture/external.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [foo](#foo)
+
 ## foo
 
 I am in `external.input.js`.
diff --git a/test/fixture/external.output.md.json b/test/fixture/external.output.md.json
index fcd4812e8..908a79f52 100644
--- a/test/fixture/external.output.md.json
+++ b/test/fixture/external.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/factory.output.md b/test/fixture/factory.output.md
index 5986399ca..b403983f3 100644
--- a/test/fixture/factory.output.md
+++ b/test/fixture/factory.output.md
@@ -1,5 +1,11 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [area](#area)
+-   [area](#area-1)
+-   [data](#data)
+
 ## area
 
 an area chart generator
diff --git a/test/fixture/factory.output.md.json b/test/fixture/factory.output.md.json
index a4ac3c232..30277976a 100644
--- a/test/fixture/factory.output.md.json
+++ b/test/fixture/factory.output.md.json
@@ -5,6 +5,97 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#area",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "area"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#area-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "area"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#data",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "data"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +104,16 @@
           "type": "text",
           "value": "area"
         }
-      ]
+      ],
+      "data": {
+        "id": "area",
+        "htmlAttributes": {
+          "id": "area"
+        },
+        "hProperties": {
+          "id": "area"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -122,7 +222,16 @@
           "type": "text",
           "value": "area"
         }
-      ]
+      ],
+      "data": {
+        "id": "area-1",
+        "htmlAttributes": {
+          "id": "area-1"
+        },
+        "hProperties": {
+          "id": "area-1"
+        }
+      }
     },
     {
       "type": "strong",
@@ -169,7 +278,16 @@
           "type": "text",
           "value": "data"
         }
-      ]
+      ],
+      "data": {
+        "id": "data",
+        "htmlAttributes": {
+          "id": "data"
+        },
+        "hProperties": {
+          "id": "data"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/infer-private.output.md b/test/fixture/infer-private.output.md
index 463f6165f..be8571cd7 100644
--- a/test/fixture/infer-private.output.md
+++ b/test/fixture/infer-private.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [C](#c)
+    -   [m](#m)
+
 ## C
 
 C description
diff --git a/test/fixture/infer-private.output.md.json b/test/fixture/infer-private.output.md.json
index 38cfecf2a..2ec83e5be 100644
--- a/test/fixture/infer-private.output.md.json
+++ b/test/fixture/infer-private.output.md.json
@@ -5,6 +5,81 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#c",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "C"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#m",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "m"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +88,16 @@
           "type": "text",
           "value": "C"
         }
-      ]
+      ],
+      "data": {
+        "id": "c",
+        "htmlAttributes": {
+          "id": "c"
+        },
+        "hProperties": {
+          "id": "c"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -58,7 +142,16 @@
           "type": "text",
           "value": "m"
         }
-      ]
+      ],
+      "data": {
+        "id": "m",
+        "htmlAttributes": {
+          "id": "m"
+        },
+        "hProperties": {
+          "id": "m"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/inheritance.output.md b/test/fixture/inheritance.output.md
index 80af4fa7e..897dad182 100644
--- a/test/fixture/inheritance.output.md
+++ b/test/fixture/inheritance.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [SpecialArray](#specialarray)
+-   [Foo](#foo)
+
 ## SpecialArray
 
 **Extends Array**
diff --git a/test/fixture/inheritance.output.md.json b/test/fixture/inheritance.output.md.json
index 944577a5f..f3f66f27b 100644
--- a/test/fixture/inheritance.output.md.json
+++ b/test/fixture/inheritance.output.md.json
@@ -5,6 +5,75 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#specialarray",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "SpecialArray"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +82,16 @@
           "type": "text",
           "value": "SpecialArray"
         }
-      ]
+      ],
+      "data": {
+        "id": "specialarray",
+        "htmlAttributes": {
+          "id": "specialarray"
+        },
+        "hProperties": {
+          "id": "specialarray"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -76,7 +154,16 @@
           "type": "text",
           "value": "Foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/inline-link.output.md b/test/fixture/inline-link.output.md
index ca214404b..86d415599 100644
--- a/test/fixture/inline-link.output.md
+++ b/test/fixture/inline-link.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [addOne](#addone)
+-   [inline-link.input](#inline-linkinput)
+
 ## addOne
 
 Adds one to a number
diff --git a/test/fixture/inline-link.output.md.json b/test/fixture/inline-link.output.md.json
index 4d2f11ca5..5556d69d7 100644
--- a/test/fixture/inline-link.output.md.json
+++ b/test/fixture/inline-link.output.md.json
@@ -5,6 +5,75 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#addone",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "addOne"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#inline-linkinput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "inline-link.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +82,16 @@
           "type": "text",
           "value": "addOne"
         }
-      ]
+      ],
+      "data": {
+        "id": "addone",
+        "htmlAttributes": {
+          "id": "addone"
+        },
+        "hProperties": {
+          "id": "addone"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -210,7 +288,16 @@
           "type": "text",
           "value": "inline-link.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "inline-linkinput",
+        "htmlAttributes": {
+          "id": "inline-linkinput"
+        },
+        "hProperties": {
+          "id": "inline-linkinput"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/internal.output.md b/test/fixture/internal.output.md
index c0b4a06ef..d037ab42c 100644
--- a/test/fixture/internal.output.md
+++ b/test/fixture/internal.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [foo](#foo)
+
 ## foo
 
 I am in `external.input.js`.
diff --git a/test/fixture/internal.output.md.json b/test/fixture/internal.output.md.json
index fcd4812e8..908a79f52 100644
--- a/test/fixture/internal.output.md.json
+++ b/test/fixture/internal.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/literal_types.output.md b/test/fixture/literal_types.output.md
index 335decc09..57190ea7f 100644
--- a/test/fixture/literal_types.output.md
+++ b/test/fixture/literal_types.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [f](#f)
+-   [g](#g)
+
 ## f
 
 **Parameters**
diff --git a/test/fixture/literal_types.output.md.json b/test/fixture/literal_types.output.md.json
index 623c139b3..5c37008f5 100644
--- a/test/fixture/literal_types.output.md.json
+++ b/test/fixture/literal_types.output.md.json
@@ -5,6 +5,75 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#f",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "f"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#g",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "g"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +82,16 @@
           "type": "text",
           "value": "f"
         }
-      ]
+      ],
+      "data": {
+        "id": "f",
+        "htmlAttributes": {
+          "id": "f"
+        },
+        "hProperties": {
+          "id": "f"
+        }
+      }
     },
     {
       "type": "strong",
@@ -117,7 +195,16 @@
           "type": "text",
           "value": "g"
         }
-      ]
+      ],
+      "data": {
+        "id": "g",
+        "htmlAttributes": {
+          "id": "g"
+        },
+        "hProperties": {
+          "id": "g"
+        }
+      }
     },
     {
       "type": "strong",
diff --git a/test/fixture/memberedclass.output.md b/test/fixture/memberedclass.output.md
index b52e48e44..1b0ad3188 100644
--- a/test/fixture/memberedclass.output.md
+++ b/test/fixture/memberedclass.output.md
@@ -1,5 +1,11 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [MyClass](#myclass)
+    -   [getFoo](#getfoo)
+    -   [getUndefined](#getundefined)
+
 ## MyClass
 
 This is my class, a demo thing.
diff --git a/test/fixture/memberedclass.output.md.json b/test/fixture/memberedclass.output.md.json
index 6f4748b88..af39eb75c 100644
--- a/test/fixture/memberedclass.output.md.json
+++ b/test/fixture/memberedclass.output.md.json
@@ -5,6 +5,103 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#myclass",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "MyClass"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#getfoo",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "getFoo"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#getundefined",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "getUndefined"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +110,16 @@
           "type": "text",
           "value": "MyClass"
         }
-      ]
+      ],
+      "data": {
+        "id": "myclass",
+        "htmlAttributes": {
+          "id": "myclass"
+        },
+        "hProperties": {
+          "id": "myclass"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -58,7 +164,16 @@
           "type": "text",
           "value": "getFoo"
         }
-      ]
+      ],
+      "data": {
+        "id": "getfoo",
+        "htmlAttributes": {
+          "id": "getfoo"
+        },
+        "hProperties": {
+          "id": "getfoo"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -255,7 +370,16 @@
           "type": "text",
           "value": "getUndefined"
         }
-      ]
+      ],
+      "data": {
+        "id": "getundefined",
+        "htmlAttributes": {
+          "id": "getundefined"
+        },
+        "hProperties": {
+          "id": "getundefined"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/merge-infered-type.output.md b/test/fixture/merge-infered-type.output.md
index 15973c29c..1a497d63a 100644
--- a/test/fixture/merge-infered-type.output.md
+++ b/test/fixture/merge-infered-type.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [addFive](#addfive)
+
 ## addFive
 
 Add five to `x`.
diff --git a/test/fixture/merge-infered-type.output.md.json b/test/fixture/merge-infered-type.output.md.json
index ae3c81fa8..8915db6f7 100644
--- a/test/fixture/merge-infered-type.output.md.json
+++ b/test/fixture/merge-infered-type.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#addfive",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "addFive"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "addFive"
         }
-      ]
+      ],
+      "data": {
+        "id": "addfive",
+        "htmlAttributes": {
+          "id": "addfive"
+        },
+        "hProperties": {
+          "id": "addfive"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/multisignature.output.md b/test/fixture/multisignature.output.md
index d476577a1..70cc5c797 100644
--- a/test/fixture/multisignature.output.md
+++ b/test/fixture/multisignature.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [getTheTime](#getthetime)
+-   [getTheTime](#getthetime-1)
+
 ## getTheTime
 
 Get the time
diff --git a/test/fixture/multisignature.output.md.json b/test/fixture/multisignature.output.md.json
index a6c7ccbc2..09f8f0f14 100644
--- a/test/fixture/multisignature.output.md.json
+++ b/test/fixture/multisignature.output.md.json
@@ -5,6 +5,75 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#getthetime",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "getTheTime"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#getthetime-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "getTheTime"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +82,16 @@
           "type": "text",
           "value": "getTheTime"
         }
-      ]
+      ],
+      "data": {
+        "id": "getthetime",
+        "htmlAttributes": {
+          "id": "getthetime"
+        },
+        "hProperties": {
+          "id": "getthetime"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -159,7 +237,16 @@
           "type": "text",
           "value": "getTheTime"
         }
-      ]
+      ],
+      "data": {
+        "id": "getthetime-1",
+        "htmlAttributes": {
+          "id": "getthetime-1"
+        },
+        "hProperties": {
+          "id": "getthetime-1"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/nearby_params.output.md b/test/fixture/nearby_params.output.md
index ef7144c86..2b01f3bab 100644
--- a/test/fixture/nearby_params.output.md
+++ b/test/fixture/nearby_params.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [sessions.create](#sessionscreate)
+
 ## sessions.create
 
 Attempt to establish a cookie-based session in exchange for credentials.
diff --git a/test/fixture/nearby_params.output.md.json b/test/fixture/nearby_params.output.md.json
index 72fa32537..e8c53bed5 100644
--- a/test/fixture/nearby_params.output.md.json
+++ b/test/fixture/nearby_params.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#sessionscreate",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "sessions.create"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "sessions.create"
         }
-      ]
+      ],
+      "data": {
+        "id": "sessionscreate",
+        "htmlAttributes": {
+          "id": "sessionscreate"
+        },
+        "hProperties": {
+          "id": "sessionscreate"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/nest_params.output.md b/test/fixture/nest_params.output.md
index b282e6f7a..d1cacd1ed 100644
--- a/test/fixture/nest_params.output.md
+++ b/test/fixture/nest_params.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [foo](#foo)
+-   [foo](#foo-1)
+
 ## foo
 
 **Parameters**
diff --git a/test/fixture/nest_params.output.md.json b/test/fixture/nest_params.output.md.json
index 56ea626be..58ed827d6 100644
--- a/test/fixture/nest_params.output.md.json
+++ b/test/fixture/nest_params.output.md.json
@@ -5,6 +5,75 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +82,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "strong",
@@ -376,7 +454,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo-1",
+        "htmlAttributes": {
+          "id": "foo-1"
+        },
+        "hProperties": {
+          "id": "foo-1"
+        }
+      }
     },
     {
       "type": "strong",
diff --git a/test/fixture/newline-in-description.output.md b/test/fixture/newline-in-description.output.md
index ca0ae75f9..6b7dc0a64 100644
--- a/test/fixture/newline-in-description.output.md
+++ b/test/fixture/newline-in-description.output.md
@@ -1,5 +1,7 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
 ## 
 
 A function.
diff --git a/test/fixture/newline-in-description.output.md.json b/test/fixture/newline-in-description.output.md.json
index 8d79efda6..bd94fd323 100644
--- a/test/fixture/newline-in-description.output.md.json
+++ b/test/fixture/newline-in-description.output.md.json
@@ -5,6 +5,25 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +32,16 @@
           "type": "text",
           "value": ""
         }
-      ]
+      ],
+      "data": {
+        "id": "",
+        "htmlAttributes": {
+          "id": ""
+        },
+        "hProperties": {
+          "id": ""
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/no-name.output.md b/test/fixture/no-name.output.md
index e6cda5c60..6bfd3fb28 100644
--- a/test/fixture/no-name.output.md
+++ b/test/fixture/no-name.output.md
@@ -1,5 +1,7 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
 ## 
 
 Set the time
diff --git a/test/fixture/no-name.output.md.json b/test/fixture/no-name.output.md.json
index fb1772a02..d706040de 100644
--- a/test/fixture/no-name.output.md.json
+++ b/test/fixture/no-name.output.md.json
@@ -5,6 +5,25 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +32,16 @@
           "type": "text",
           "value": ""
         }
-      ]
+      ],
+      "data": {
+        "id": "",
+        "htmlAttributes": {
+          "id": ""
+        },
+        "hProperties": {
+          "id": ""
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/optional-record-field-type.output.md b/test/fixture/optional-record-field-type.output.md
index 295779b18..b3a410e63 100644
--- a/test/fixture/optional-record-field-type.output.md
+++ b/test/fixture/optional-record-field-type.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [Record](#record)
+
 ## Record
 
 Type: {opt: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?, req: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)}
diff --git a/test/fixture/optional-record-field-type.output.md.json b/test/fixture/optional-record-field-type.output.md.json
index bb20925b8..e51b7ad5c 100644
--- a/test/fixture/optional-record-field-type.output.md.json
+++ b/test/fixture/optional-record-field-type.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#record",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Record"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "Record"
         }
-      ]
+      ],
+      "data": {
+        "id": "record",
+        "htmlAttributes": {
+          "id": "record"
+        },
+        "hProperties": {
+          "id": "record"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/params.output.md b/test/fixture/params.output.md
index b3e8c8e95..eb13ec7c8 100644
--- a/test/fixture/params.output.md
+++ b/test/fixture/params.output.md
@@ -1,5 +1,17 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [addThem](#addthem)
+-   [fishesAndFoxes](#fishesandfoxes)
+-   [withDefault](#withdefault)
+-   [Foo](#foo)
+    -   [method](#method)
+-   [Address6](#address6)
+-   [GeoJSONSource](#geojsonsource)
+-   [myfunc](#myfunc)
+-   [foo](#foo-1)
+
 ## addThem
 
 This function returns the number one.
diff --git a/test/fixture/params.output.md.json b/test/fixture/params.output.md.json
index 1e135e54a..dd2461e77 100644
--- a/test/fixture/params.output.md.json
+++ b/test/fixture/params.output.md.json
@@ -5,6 +5,235 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#addthem",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "addThem"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#fishesandfoxes",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "fishesAndFoxes"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#withdefault",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "withDefault"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Foo"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#method",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "method"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#address6",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Address6"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#geojsonsource",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "GeoJSONSource"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#myfunc",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "myfunc"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +242,16 @@
           "type": "text",
           "value": "addThem"
         }
-      ]
+      ],
+      "data": {
+        "id": "addthem",
+        "htmlAttributes": {
+          "id": "addthem"
+        },
+        "hProperties": {
+          "id": "addthem"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -300,7 +538,16 @@
           "type": "text",
           "value": "fishesAndFoxes"
         }
-      ]
+      ],
+      "data": {
+        "id": "fishesandfoxes",
+        "htmlAttributes": {
+          "id": "fishesandfoxes"
+        },
+        "hProperties": {
+          "id": "fishesandfoxes"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -499,7 +746,16 @@
           "type": "text",
           "value": "withDefault"
         }
-      ]
+      ],
+      "data": {
+        "id": "withdefault",
+        "htmlAttributes": {
+          "id": "withdefault"
+        },
+        "hProperties": {
+          "id": "withdefault"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -605,7 +861,16 @@
           "type": "text",
           "value": "Foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -650,7 +915,16 @@
           "type": "text",
           "value": "method"
         }
-      ]
+      ],
+      "data": {
+        "id": "method",
+        "htmlAttributes": {
+          "id": "method"
+        },
+        "hProperties": {
+          "id": "method"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -783,7 +1057,16 @@
           "type": "text",
           "value": "Address6"
         }
-      ]
+      ],
+      "data": {
+        "id": "address6",
+        "htmlAttributes": {
+          "id": "address6"
+        },
+        "hProperties": {
+          "id": "address6"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1230,7 +1513,16 @@
           "type": "text",
           "value": "GeoJSONSource"
         }
-      ]
+      ],
+      "data": {
+        "id": "geojsonsource",
+        "htmlAttributes": {
+          "id": "geojsonsource"
+        },
+        "hProperties": {
+          "id": "geojsonsource"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1756,7 +2048,16 @@
           "type": "text",
           "value": "myfunc"
         }
-      ]
+      ],
+      "data": {
+        "id": "myfunc",
+        "htmlAttributes": {
+          "id": "myfunc"
+        },
+        "hProperties": {
+          "id": "myfunc"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1965,7 +2266,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo-1",
+        "htmlAttributes": {
+          "id": "foo-1"
+        },
+        "hProperties": {
+          "id": "foo-1"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/react-jsx.output.md b/test/fixture/react-jsx.output.md
index 4f10678a2..96878014b 100644
--- a/test/fixture/react-jsx.output.md
+++ b/test/fixture/react-jsx.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [apples](#apples)
+
 ## apples
 
 apples
diff --git a/test/fixture/react-jsx.output.md.json b/test/fixture/react-jsx.output.md.json
index 7ebe87a39..aa13aef9d 100644
--- a/test/fixture/react-jsx.output.md.json
+++ b/test/fixture/react-jsx.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#apples",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "apples"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "apples"
         }
-      ]
+      ],
+      "data": {
+        "id": "apples",
+        "htmlAttributes": {
+          "id": "apples"
+        },
+        "hProperties": {
+          "id": "apples"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/readme/README.output.md b/test/fixture/readme/README.output.md
index 54991d56e..88b395ed1 100644
--- a/test/fixture/readme/README.output.md
+++ b/test/fixture/readme/README.output.md
@@ -4,6 +4,11 @@
 
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [foo](#foo)
+-   [bar](#bar)
+
 ## foo
 
 A function with documentation.
diff --git a/test/fixture/require-json-no-extension.output.md b/test/fixture/require-json-no-extension.output.md
index 1fcb902bc..aedd5447d 100644
--- a/test/fixture/require-json-no-extension.output.md
+++ b/test/fixture/require-json-no-extension.output.md
@@ -1 +1,3 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
+
+### Table of Contents
diff --git a/test/fixture/require-json-no-extension.output.md.json b/test/fixture/require-json-no-extension.output.md.json
index c4109240d..558078620 100644
--- a/test/fixture/require-json-no-extension.output.md.json
+++ b/test/fixture/require-json-no-extension.output.md.json
@@ -4,6 +4,25 @@
     {
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
+    },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/require-json.output.md b/test/fixture/require-json.output.md
index 1fcb902bc..aedd5447d 100644
--- a/test/fixture/require-json.output.md
+++ b/test/fixture/require-json.output.md
@@ -1 +1,3 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
+
+### Table of Contents
diff --git a/test/fixture/require-json.output.md.json b/test/fixture/require-json.output.md.json
index c4109240d..558078620 100644
--- a/test/fixture/require-json.output.md.json
+++ b/test/fixture/require-json.output.md.json
@@ -4,6 +4,25 @@
     {
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
+    },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/simple-hashbang.output.md b/test/fixture/simple-hashbang.output.md
index d4aab1e9e..362645dc1 100644
--- a/test/fixture/simple-hashbang.output.md
+++ b/test/fixture/simple-hashbang.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [simple-hashbang.input](#simple-hashbanginput)
+
 ## simple-hashbang.input
 
 This function returns the number one.
diff --git a/test/fixture/simple-hashbang.output.md.json b/test/fixture/simple-hashbang.output.md.json
index eea85db79..1a68a45e4 100644
--- a/test/fixture/simple-hashbang.output.md.json
+++ b/test/fixture/simple-hashbang.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#simple-hashbanginput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "simple-hashbang.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "simple-hashbang.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "simple-hashbanginput",
+        "htmlAttributes": {
+          "id": "simple-hashbanginput"
+        },
+        "hProperties": {
+          "id": "simple-hashbanginput"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/simple-private.output.md b/test/fixture/simple-private.output.md
index 1fcb902bc..aedd5447d 100644
--- a/test/fixture/simple-private.output.md
+++ b/test/fixture/simple-private.output.md
@@ -1 +1,3 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
+
+### Table of Contents
diff --git a/test/fixture/simple-private.output.md.json b/test/fixture/simple-private.output.md.json
index c4109240d..558078620 100644
--- a/test/fixture/simple-private.output.md.json
+++ b/test/fixture/simple-private.output.md.json
@@ -4,6 +4,25 @@
     {
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
+    },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/simple-singlestar.output.md b/test/fixture/simple-singlestar.output.md
index 1fcb902bc..aedd5447d 100644
--- a/test/fixture/simple-singlestar.output.md
+++ b/test/fixture/simple-singlestar.output.md
@@ -1 +1,3 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
+
+### Table of Contents
diff --git a/test/fixture/simple-singlestar.output.md.json b/test/fixture/simple-singlestar.output.md.json
index c4109240d..558078620 100644
--- a/test/fixture/simple-singlestar.output.md.json
+++ b/test/fixture/simple-singlestar.output.md.json
@@ -4,6 +4,25 @@
     {
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
+    },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/simple-triplestar.output.md b/test/fixture/simple-triplestar.output.md
index 1fcb902bc..aedd5447d 100644
--- a/test/fixture/simple-triplestar.output.md
+++ b/test/fixture/simple-triplestar.output.md
@@ -1 +1,3 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
+
+### Table of Contents
diff --git a/test/fixture/simple-triplestar.output.md.json b/test/fixture/simple-triplestar.output.md.json
index c4109240d..558078620 100644
--- a/test/fixture/simple-triplestar.output.md.json
+++ b/test/fixture/simple-triplestar.output.md.json
@@ -4,6 +4,25 @@
     {
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
+    },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/simple-two.output.md b/test/fixture/simple-two.output.md
index c37103e4b..31f744ae3 100644
--- a/test/fixture/simple-two.output.md
+++ b/test/fixture/simple-two.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [returnTwo](#returntwo)
+
 ## returnTwo
 
 This function returns the number plus two.
diff --git a/test/fixture/simple-two.output.md.json b/test/fixture/simple-two.output.md.json
index 87999cf26..998d6d4be 100644
--- a/test/fixture/simple-two.output.md.json
+++ b/test/fixture/simple-two.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#returntwo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "returnTwo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "returnTwo"
         }
-      ]
+      ],
+      "data": {
+        "id": "returntwo",
+        "htmlAttributes": {
+          "id": "returntwo"
+        },
+        "hProperties": {
+          "id": "returntwo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/simple.output.github.md b/test/fixture/simple.output.github.md
index 43aadcbc9..7dfae4d52 100644
--- a/test/fixture/simple.output.github.md
+++ b/test/fixture/simple.output.github.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [simple.input](#simpleinput)
+
 ## simple.input
 
 [test/fixture/simple.input.js:5-8]([github] "Source code on GitHub")
diff --git a/test/fixture/simple.output.md b/test/fixture/simple.output.md
index f428519d0..c2c8c1ec9 100644
--- a/test/fixture/simple.output.md
+++ b/test/fixture/simple.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [simple.input](#simpleinput)
+
 ## simple.input
 
 This function returns the number one.
diff --git a/test/fixture/simple.output.md.json b/test/fixture/simple.output.md.json
index 6ef343f9a..fe341876a 100644
--- a/test/fixture/simple.output.md.json
+++ b/test/fixture/simple.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#simpleinput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "simple.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "simple.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "simpleinput",
+        "htmlAttributes": {
+          "id": "simpleinput"
+        },
+        "hProperties": {
+          "id": "simpleinput"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sort-order-alpha.output.md b/test/fixture/sort-order-alpha.output.md
index 79a56a960..e89a98eb7 100644
--- a/test/fixture/sort-order-alpha.output.md
+++ b/test/fixture/sort-order-alpha.output.md
@@ -1,5 +1,20 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [a](#a)
+-   [b](#b)
+-   [C](#c)
+    -   [A](#a-1)
+    -   [a](#a-2)
+    -   [B](#b-1)
+    -   [b](#b-2)
+-   [D](#d)
+    -   [A](#a-3)
+    -   [a](#a-4)
+    -   [B](#b-3)
+    -   [b](#b-4)
+
 ## a
 
 ## b
diff --git a/test/fixture/sort-order-alpha.output.md.json b/test/fixture/sort-order-alpha.output.md.json
index 68823dd25..b7157fd48 100644
--- a/test/fixture/sort-order-alpha.output.md.json
+++ b/test/fixture/sort-order-alpha.output.md.json
@@ -5,6 +5,307 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#a",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "a"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#b",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "b"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#c",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "C"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#a-1",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "A"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#a-2",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "a"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#b-1",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "B"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#b-2",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "b"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#d",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "D"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#a-3",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "A"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#a-4",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "a"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#b-3",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "B"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#b-4",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "b"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +314,16 @@
           "type": "text",
           "value": "a"
         }
-      ]
+      ],
+      "data": {
+        "id": "a",
+        "htmlAttributes": {
+          "id": "a"
+        },
+        "hProperties": {
+          "id": "a"
+        }
+      }
     },
     {
       "depth": 2,
@@ -23,7 +333,16 @@
           "type": "text",
           "value": "b"
         }
-      ]
+      ],
+      "data": {
+        "id": "b",
+        "htmlAttributes": {
+          "id": "b"
+        },
+        "hProperties": {
+          "id": "b"
+        }
+      }
     },
     {
       "depth": 2,
@@ -33,7 +352,16 @@
           "type": "text",
           "value": "C"
         }
-      ]
+      ],
+      "data": {
+        "id": "c",
+        "htmlAttributes": {
+          "id": "c"
+        },
+        "hProperties": {
+          "id": "c"
+        }
+      }
     },
     {
       "depth": 3,
@@ -43,7 +371,16 @@
           "type": "text",
           "value": "A"
         }
-      ]
+      ],
+      "data": {
+        "id": "a-1",
+        "htmlAttributes": {
+          "id": "a-1"
+        },
+        "hProperties": {
+          "id": "a-1"
+        }
+      }
     },
     {
       "depth": 3,
@@ -53,7 +390,16 @@
           "type": "text",
           "value": "a"
         }
-      ]
+      ],
+      "data": {
+        "id": "a-2",
+        "htmlAttributes": {
+          "id": "a-2"
+        },
+        "hProperties": {
+          "id": "a-2"
+        }
+      }
     },
     {
       "depth": 3,
@@ -63,7 +409,16 @@
           "type": "text",
           "value": "B"
         }
-      ]
+      ],
+      "data": {
+        "id": "b-1",
+        "htmlAttributes": {
+          "id": "b-1"
+        },
+        "hProperties": {
+          "id": "b-1"
+        }
+      }
     },
     {
       "depth": 3,
@@ -73,7 +428,16 @@
           "type": "text",
           "value": "b"
         }
-      ]
+      ],
+      "data": {
+        "id": "b-2",
+        "htmlAttributes": {
+          "id": "b-2"
+        },
+        "hProperties": {
+          "id": "b-2"
+        }
+      }
     },
     {
       "depth": 2,
@@ -83,7 +447,16 @@
           "type": "text",
           "value": "D"
         }
-      ]
+      ],
+      "data": {
+        "id": "d",
+        "htmlAttributes": {
+          "id": "d"
+        },
+        "hProperties": {
+          "id": "d"
+        }
+      }
     },
     {
       "depth": 3,
@@ -93,7 +466,16 @@
           "type": "text",
           "value": "A"
         }
-      ]
+      ],
+      "data": {
+        "id": "a-3",
+        "htmlAttributes": {
+          "id": "a-3"
+        },
+        "hProperties": {
+          "id": "a-3"
+        }
+      }
     },
     {
       "depth": 3,
@@ -103,7 +485,16 @@
           "type": "text",
           "value": "a"
         }
-      ]
+      ],
+      "data": {
+        "id": "a-4",
+        "htmlAttributes": {
+          "id": "a-4"
+        },
+        "hProperties": {
+          "id": "a-4"
+        }
+      }
     },
     {
       "depth": 3,
@@ -113,7 +504,16 @@
           "type": "text",
           "value": "B"
         }
-      ]
+      ],
+      "data": {
+        "id": "b-3",
+        "htmlAttributes": {
+          "id": "b-3"
+        },
+        "hProperties": {
+          "id": "b-3"
+        }
+      }
     },
     {
       "depth": 3,
@@ -123,7 +523,16 @@
           "type": "text",
           "value": "b"
         }
-      ]
+      ],
+      "data": {
+        "id": "b-4",
+        "htmlAttributes": {
+          "id": "b-4"
+        },
+        "hProperties": {
+          "id": "b-4"
+        }
+      }
     }
   ]
 }
\ No newline at end of file
diff --git a/test/fixture/string-literal-key.output.md b/test/fixture/string-literal-key.output.md
index ca0924384..a704fb0f8 100644
--- a/test/fixture/string-literal-key.output.md
+++ b/test/fixture/string-literal-key.output.md
@@ -1,5 +1,10 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [MyContainerObject](#mycontainerobject)
+-   [foo](#foo)
+
 ## MyContainerObject
 
 ## foo
diff --git a/test/fixture/string-literal-key.output.md.json b/test/fixture/string-literal-key.output.md.json
index c0bd30afe..c202a7cb5 100644
--- a/test/fixture/string-literal-key.output.md.json
+++ b/test/fixture/string-literal-key.output.md.json
@@ -5,6 +5,75 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#mycontainerobject",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "MyContainerObject"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "foo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +82,16 @@
           "type": "text",
           "value": "MyContainerObject"
         }
-      ]
+      ],
+      "data": {
+        "id": "mycontainerobject",
+        "htmlAttributes": {
+          "id": "mycontainerobject"
+        },
+        "hProperties": {
+          "id": "mycontainerobject"
+        }
+      }
     },
     {
       "depth": 2,
@@ -23,7 +101,16 @@
           "type": "text",
           "value": "foo"
         }
-      ]
+      ],
+      "data": {
+        "id": "foo",
+        "htmlAttributes": {
+          "id": "foo"
+        },
+        "hProperties": {
+          "id": "foo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/alias.output.md b/test/fixture/sync/alias.output.md
index e4be23d9b..a79e8dd2a 100644
--- a/test/fixture/sync/alias.output.md
+++ b/test/fixture/sync/alias.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [nixon](#nixon)
+
 ## nixon
 
 This is a method that has an alias tag: so it should
diff --git a/test/fixture/sync/alias.output.md.json b/test/fixture/sync/alias.output.md.json
index e66cb90d7..c3a231df3 100644
--- a/test/fixture/sync/alias.output.md.json
+++ b/test/fixture/sync/alias.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#nixon",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "nixon"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "nixon"
         }
-      ]
+      ],
+      "data": {
+        "id": "nixon",
+        "htmlAttributes": {
+          "id": "nixon"
+        },
+        "hProperties": {
+          "id": "nixon"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/empty-example.output.md b/test/fixture/sync/empty-example.output.md
index 59418f38f..c5495a091 100644
--- a/test/fixture/sync/empty-example.output.md
+++ b/test/fixture/sync/empty-example.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [returnTwo](#returntwo)
+
 ## returnTwo
 
 This function returns the number plus two.
diff --git a/test/fixture/sync/empty-example.output.md.json b/test/fixture/sync/empty-example.output.md.json
index f83249dbf..648bab584 100644
--- a/test/fixture/sync/empty-example.output.md.json
+++ b/test/fixture/sync/empty-example.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#returntwo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "returnTwo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "returnTwo"
         }
-      ]
+      ],
+      "data": {
+        "id": "returntwo",
+        "htmlAttributes": {
+          "id": "returntwo"
+        },
+        "hProperties": {
+          "id": "returntwo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/flow-types.output.md b/test/fixture/sync/flow-types.output.md
index 470e0e501..3bd1e27db 100644
--- a/test/fixture/sync/flow-types.output.md
+++ b/test/fixture/sync/flow-types.output.md
@@ -1,5 +1,18 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [addThem](#addthem)
+-   [Point](#point)
+-   [Two](#two)
+-   [T](#t)
+-   [T](#t-1)
+-   [veryImportantTransform](#veryimportanttransform)
+-   [optionalFunc](#optionalfunc)
+-   [objectParamFn](#objectparamfn)
+-   [objectParamFn](#objectparamfn-1)
+-   [SomeObjectAPI](#someobjectapi)
+
 ## addThem
 
 This function returns the number one.
diff --git a/test/fixture/sync/flow-types.output.md.json b/test/fixture/sync/flow-types.output.md.json
index ab82f46ce..88f1517bd 100644
--- a/test/fixture/sync/flow-types.output.md.json
+++ b/test/fixture/sync/flow-types.output.md.json
@@ -5,6 +5,251 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#addthem",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "addThem"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#point",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Point"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#two",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Two"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#t",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "T"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#t-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "T"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#veryimportanttransform",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "veryImportantTransform"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#optionalfunc",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "optionalFunc"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#objectparamfn",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "objectParamFn"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#objectparamfn-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "objectParamFn"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#someobjectapi",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "SomeObjectAPI"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +258,16 @@
           "type": "text",
           "value": "addThem"
         }
-      ]
+      ],
+      "data": {
+        "id": "addthem",
+        "htmlAttributes": {
+          "id": "addthem"
+        },
+        "hProperties": {
+          "id": "addthem"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -346,7 +600,16 @@
           "type": "text",
           "value": "Point"
         }
-      ]
+      ],
+      "data": {
+        "id": "point",
+        "htmlAttributes": {
+          "id": "point"
+        },
+        "hProperties": {
+          "id": "point"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -898,7 +1161,16 @@
           "type": "text",
           "value": "Two"
         }
-      ]
+      ],
+      "data": {
+        "id": "two",
+        "htmlAttributes": {
+          "id": "two"
+        },
+        "hProperties": {
+          "id": "two"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1150,7 +1422,16 @@
           "type": "text",
           "value": "T"
         }
-      ]
+      ],
+      "data": {
+        "id": "t",
+        "htmlAttributes": {
+          "id": "t"
+        },
+        "hProperties": {
+          "id": "t"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1234,7 +1515,16 @@
           "type": "text",
           "value": "T"
         }
-      ]
+      ],
+      "data": {
+        "id": "t-1",
+        "htmlAttributes": {
+          "id": "t-1"
+        },
+        "hProperties": {
+          "id": "t-1"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1299,7 +1589,16 @@
           "type": "text",
           "value": "veryImportantTransform"
         }
-      ]
+      ],
+      "data": {
+        "id": "veryimportanttransform",
+        "htmlAttributes": {
+          "id": "veryimportanttransform"
+        },
+        "hProperties": {
+          "id": "veryimportanttransform"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1504,7 +1803,16 @@
           "type": "text",
           "value": "optionalFunc"
         }
-      ]
+      ],
+      "data": {
+        "id": "optionalfunc",
+        "htmlAttributes": {
+          "id": "optionalfunc"
+        },
+        "hProperties": {
+          "id": "optionalfunc"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1623,7 +1931,16 @@
           "type": "text",
           "value": "objectParamFn"
         }
-      ]
+      ],
+      "data": {
+        "id": "objectparamfn",
+        "htmlAttributes": {
+          "id": "objectparamfn"
+        },
+        "hProperties": {
+          "id": "objectparamfn"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1733,7 +2050,16 @@
           "type": "text",
           "value": "objectParamFn"
         }
-      ]
+      ],
+      "data": {
+        "id": "objectparamfn-1",
+        "htmlAttributes": {
+          "id": "objectparamfn-1"
+        },
+        "hProperties": {
+          "id": "objectparamfn-1"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -1844,7 +2170,16 @@
           "type": "text",
           "value": "SomeObjectAPI"
         }
-      ]
+      ],
+      "data": {
+        "id": "someobjectapi",
+        "htmlAttributes": {
+          "id": "someobjectapi"
+        },
+        "hProperties": {
+          "id": "someobjectapi"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/lots-of-options.output.md b/test/fixture/sync/lots-of-options.output.md
index 014f72bda..11594ccc3 100644
--- a/test/fixture/sync/lots-of-options.output.md
+++ b/test/fixture/sync/lots-of-options.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [gsd](#gsd)
+
 ## gsd
 
 Global spectra deconvolution
diff --git a/test/fixture/sync/lots-of-options.output.md.json b/test/fixture/sync/lots-of-options.output.md.json
index 3548d2ca9..9b821762f 100644
--- a/test/fixture/sync/lots-of-options.output.md.json
+++ b/test/fixture/sync/lots-of-options.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#gsd",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "gsd"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "gsd"
         }
-      ]
+      ],
+      "data": {
+        "id": "gsd",
+        "htmlAttributes": {
+          "id": "gsd"
+        },
+        "hProperties": {
+          "id": "gsd"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/meta.output.md b/test/fixture/sync/meta.output.md
index 1845faf0f..817bb6a52 100644
--- a/test/fixture/sync/meta.output.md
+++ b/test/fixture/sync/meta.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [dewey](#dewey)
+
 ## dewey
 
 This function has a lot of metadata
diff --git a/test/fixture/sync/meta.output.md.json b/test/fixture/sync/meta.output.md.json
index c7ce42220..ff65e9111 100644
--- a/test/fixture/sync/meta.output.md.json
+++ b/test/fixture/sync/meta.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#dewey",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "dewey"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "dewey"
         }
-      ]
+      ],
+      "data": {
+        "id": "dewey",
+        "htmlAttributes": {
+          "id": "dewey"
+        },
+        "hProperties": {
+          "id": "dewey"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/multiexample.output.md b/test/fixture/sync/multiexample.output.md
index caff6189a..01a6fe6db 100644
--- a/test/fixture/sync/multiexample.output.md
+++ b/test/fixture/sync/multiexample.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [multiexample.input](#multiexampleinput)
+
 ## multiexample.input
 
 **Extends Foo, Bar**
diff --git a/test/fixture/sync/multiexample.output.md.json b/test/fixture/sync/multiexample.output.md.json
index eed8b0606..a59b2610a 100644
--- a/test/fixture/sync/multiexample.output.md.json
+++ b/test/fixture/sync/multiexample.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#multiexampleinput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "multiexample.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "multiexample.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "multiexampleinput",
+        "htmlAttributes": {
+          "id": "multiexampleinput"
+        },
+        "hProperties": {
+          "id": "multiexampleinput"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/rename.output.md b/test/fixture/sync/rename.output.md
index 2da5756bf..9e9ce7fc2 100644
--- a/test/fixture/sync/rename.output.md
+++ b/test/fixture/sync/rename.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [cheese](#cheese)
+
 ## cheese
 
 Cheesoid!
diff --git a/test/fixture/sync/rename.output.md.json b/test/fixture/sync/rename.output.md.json
index b43c1b194..1c39e40c0 100644
--- a/test/fixture/sync/rename.output.md.json
+++ b/test/fixture/sync/rename.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#cheese",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "cheese"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "cheese"
         }
-      ]
+      ],
+      "data": {
+        "id": "cheese",
+        "htmlAttributes": {
+          "id": "cheese"
+        },
+        "hProperties": {
+          "id": "cheese"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/throws.output.md b/test/fixture/sync/throws.output.md
index 18a960f06..379677656 100644
--- a/test/fixture/sync/throws.output.md
+++ b/test/fixture/sync/throws.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [returnTwo](#returntwo)
+
 ## returnTwo
 
 This function returns the number plus two.
diff --git a/test/fixture/sync/throws.output.md.json b/test/fixture/sync/throws.output.md.json
index bd52a315a..c272dd736 100644
--- a/test/fixture/sync/throws.output.md.json
+++ b/test/fixture/sync/throws.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#returntwo",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "returnTwo"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "returnTwo"
         }
-      ]
+      ],
+      "data": {
+        "id": "returntwo",
+        "htmlAttributes": {
+          "id": "returntwo"
+        },
+        "hProperties": {
+          "id": "returntwo"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/trailing-only.output.md b/test/fixture/sync/trailing-only.output.md
index a464834b2..63511b984 100644
--- a/test/fixture/sync/trailing-only.output.md
+++ b/test/fixture/sync/trailing-only.output.md
@@ -1,5 +1,7 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
 ## 
 
 this is a type
diff --git a/test/fixture/sync/trailing-only.output.md.json b/test/fixture/sync/trailing-only.output.md.json
index 7dc0f561f..d92da51a1 100644
--- a/test/fixture/sync/trailing-only.output.md.json
+++ b/test/fixture/sync/trailing-only.output.md.json
@@ -5,6 +5,25 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +32,16 @@
           "type": "text",
           "value": ""
         }
-      ]
+      ],
+      "data": {
+        "id": "",
+        "htmlAttributes": {
+          "id": ""
+        },
+        "hProperties": {
+          "id": ""
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/trailing.output.md b/test/fixture/sync/trailing.output.md
index 33d39203b..1848b96a3 100644
--- a/test/fixture/sync/trailing.output.md
+++ b/test/fixture/sync/trailing.output.md
@@ -1,5 +1,11 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [fooBar](#foobar)
+-   [fooBaz](#foobaz)
+-   [Something](#something)
+
 ## fooBar
 
 ONE
diff --git a/test/fixture/sync/trailing.output.md.json b/test/fixture/sync/trailing.output.md.json
index 655ed545a..749cbe98d 100644
--- a/test/fixture/sync/trailing.output.md.json
+++ b/test/fixture/sync/trailing.output.md.json
@@ -5,6 +5,97 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foobar",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "fooBar"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#foobaz",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "fooBaz"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#something",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Something"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +104,16 @@
           "type": "text",
           "value": "fooBar"
         }
-      ]
+      ],
+      "data": {
+        "id": "foobar",
+        "htmlAttributes": {
+          "id": "foobar"
+        },
+        "hProperties": {
+          "id": "foobar"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -122,7 +222,16 @@
           "type": "text",
           "value": "fooBaz"
         }
-      ]
+      ],
+      "data": {
+        "id": "foobaz",
+        "htmlAttributes": {
+          "id": "foobaz"
+        },
+        "hProperties": {
+          "id": "foobaz"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -231,7 +340,16 @@
           "type": "text",
           "value": "Something"
         }
-      ]
+      ],
+      "data": {
+        "id": "something",
+        "htmlAttributes": {
+          "id": "something"
+        },
+        "hProperties": {
+          "id": "something"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/sync/typedef.output.md b/test/fixture/sync/typedef.output.md
index 90a5d5c5d..01f5eede6 100644
--- a/test/fixture/sync/typedef.output.md
+++ b/test/fixture/sync/typedef.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [MyType](#mytype)
+
 ## MyType
 
 A type definition.
diff --git a/test/fixture/sync/typedef.output.md.json b/test/fixture/sync/typedef.output.md.json
index 8fc8da623..b900c6215 100644
--- a/test/fixture/sync/typedef.output.md.json
+++ b/test/fixture/sync/typedef.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#mytype",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "MyType"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "MyType"
         }
-      ]
+      ],
+      "data": {
+        "id": "mytype",
+        "htmlAttributes": {
+          "id": "mytype"
+        },
+        "hProperties": {
+          "id": "mytype"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/system-import.output.md b/test/fixture/system-import.output.md
index f428519d0..c2c8c1ec9 100644
--- a/test/fixture/system-import.output.md
+++ b/test/fixture/system-import.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [simple.input](#simpleinput)
+
 ## simple.input
 
 This function returns the number one.
diff --git a/test/fixture/system-import.output.md.json b/test/fixture/system-import.output.md.json
index 6ef343f9a..fe341876a 100644
--- a/test/fixture/system-import.output.md.json
+++ b/test/fixture/system-import.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#simpleinput",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "simple.input"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "simple.input"
         }
-      ]
+      ],
+      "data": {
+        "id": "simpleinput",
+        "htmlAttributes": {
+          "id": "simpleinput"
+        },
+        "hProperties": {
+          "id": "simpleinput"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/this-class.output.md b/test/fixture/this-class.output.md
index 68e637245..ea20b2510 100644
--- a/test/fixture/this-class.output.md
+++ b/test/fixture/this-class.output.md
@@ -1,5 +1,13 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [bookshelf](#bookshelf)
+-   [Book](#book)
+    -   [title](#title)
+-   [BookShelf](#bookshelf-1)
+    -   [title](#title-1)
+
 ## bookshelf
 
 **Parameters**
diff --git a/test/fixture/this-class.output.md.json b/test/fixture/this-class.output.md.json
index e7b15ff40..d8f4d6bc9 100644
--- a/test/fixture/this-class.output.md.json
+++ b/test/fixture/this-class.output.md.json
@@ -5,6 +5,153 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#bookshelf",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "bookshelf"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#book",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Book"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#title",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "title"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#bookshelf-1",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "BookShelf"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "type": "list",
+              "ordered": false,
+              "children": [
+                {
+                  "type": "listItem",
+                  "loose": false,
+                  "children": [
+                    {
+                      "type": "paragraph",
+                      "children": [
+                        {
+                          "type": "link",
+                          "title": null,
+                          "url": "#title-1",
+                          "children": [
+                            {
+                              "type": "text",
+                              "value": "title"
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +160,16 @@
           "type": "text",
           "value": "bookshelf"
         }
-      ]
+      ],
+      "data": {
+        "id": "bookshelf",
+        "htmlAttributes": {
+          "id": "bookshelf"
+        },
+        "hProperties": {
+          "id": "bookshelf"
+        }
+      }
     },
     {
       "type": "strong",
@@ -60,7 +216,16 @@
           "type": "text",
           "value": "Book"
         }
-      ]
+      ],
+      "data": {
+        "id": "book",
+        "htmlAttributes": {
+          "id": "book"
+        },
+        "hProperties": {
+          "id": "book"
+        }
+      }
     },
     {
       "type": "strong",
@@ -107,7 +272,16 @@
           "type": "text",
           "value": "title"
         }
-      ]
+      ],
+      "data": {
+        "id": "title",
+        "htmlAttributes": {
+          "id": "title"
+        },
+        "hProperties": {
+          "id": "title"
+        }
+      }
     },
     {
       "type": "paragraph",
@@ -152,7 +326,16 @@
           "type": "text",
           "value": "BookShelf"
         }
-      ]
+      ],
+      "data": {
+        "id": "bookshelf-1",
+        "htmlAttributes": {
+          "id": "bookshelf-1"
+        },
+        "hProperties": {
+          "id": "bookshelf-1"
+        }
+      }
     },
     {
       "type": "strong",
@@ -199,7 +382,16 @@
           "type": "text",
           "value": "title"
         }
-      ]
+      ],
+      "data": {
+        "id": "title-1",
+        "htmlAttributes": {
+          "id": "title-1"
+        },
+        "hProperties": {
+          "id": "title-1"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/type_application.output.md b/test/fixture/type_application.output.md
index b2568c017..15b47e757 100644
--- a/test/fixture/type_application.output.md
+++ b/test/fixture/type_application.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [Address6](#address6)
+
 ## Address6
 
 Represents an IPv6 address
diff --git a/test/fixture/type_application.output.md.json b/test/fixture/type_application.output.md.json
index a77cd28e9..78b569c66 100644
--- a/test/fixture/type_application.output.md.json
+++ b/test/fixture/type_application.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#address6",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "Address6"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "Address6"
         }
-      ]
+      ],
+      "data": {
+        "id": "address6",
+        "htmlAttributes": {
+          "id": "address6"
+        },
+        "hProperties": {
+          "id": "address6"
+        }
+      }
     },
     {
       "type": "paragraph",
diff --git a/test/fixture/var-function-param-return.output.md b/test/fixture/var-function-param-return.output.md
index bfbf02a26..5373d639c 100644
--- a/test/fixture/var-function-param-return.output.md
+++ b/test/fixture/var-function-param-return.output.md
@@ -1,5 +1,9 @@
 <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
 
+### Table of Contents
+
+-   [f](#f)
+
 ## f
 
 **Parameters**
diff --git a/test/fixture/var-function-param-return.output.md.json b/test/fixture/var-function-param-return.output.md.json
index cc30bcd50..1710cfe0a 100644
--- a/test/fixture/var-function-param-return.output.md.json
+++ b/test/fixture/var-function-param-return.output.md.json
@@ -5,6 +5,53 @@
       "type": "html",
       "value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
     },
+    {
+      "depth": 3,
+      "type": "heading",
+      "children": [
+        {
+          "type": "text",
+          "value": "Table of Contents"
+        }
+      ],
+      "data": {
+        "id": "table-of-contents",
+        "htmlAttributes": {
+          "id": "table-of-contents"
+        },
+        "hProperties": {
+          "id": "table-of-contents"
+        }
+      }
+    },
+    {
+      "type": "list",
+      "ordered": false,
+      "children": [
+        {
+          "type": "listItem",
+          "loose": false,
+          "children": [
+            {
+              "type": "paragraph",
+              "children": [
+                {
+                  "type": "link",
+                  "title": null,
+                  "url": "#f",
+                  "children": [
+                    {
+                      "type": "text",
+                      "value": "f"
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
     {
       "depth": 2,
       "type": "heading",
@@ -13,7 +60,16 @@
           "type": "text",
           "value": "f"
         }
-      ]
+      ],
+      "data": {
+        "id": "f",
+        "htmlAttributes": {
+          "id": "f"
+        },
+        "hProperties": {
+          "id": "f"
+        }
+      }
     },
     {
       "type": "strong",
diff --git a/test/test.js b/test/test.js
index a31667f81..8a58a885d 100644
--- a/test/test.js
+++ b/test/test.js
@@ -147,6 +147,21 @@ test('outputs', function (ttt) {
           });
         });
 
+        if (file.match(/es6.input.js/)) {
+          tt.test('no markdown TOC', function (t) {
+            outputMarkdown(_.cloneDeep(result), { 'no-markdown-toc': true }, function (err, result) {
+              t.ifError(err);
+              var outputfile = file.replace('.input.js', '.output-toc.md');
+              if (UPDATE) {
+                fs.writeFileSync(outputfile, result, 'utf8');
+              }
+              var expect = fs.readFileSync(outputfile, 'utf8');
+              t.equal(result.toString(), expect, 'markdown output correct');
+              t.end();
+            });
+          });
+        }
+
         tt.test('markdown AST', function (t) {
           outputMarkdownAST(_.cloneDeep(result), {}, function (err, result) {
             t.ifError(err);