prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Unable to add Table of Contents to docs
  When I build a markdown file containing the following information with, `mkdocs build --clean`, mkdocs throws:  `AttributeError: 'Markdown' object has no attribute 'toc'`. Adding `[TOC]` like this was working before, but for some reason its throwing an exception now. I'm running version `0.11.1`.
  
  Markdown file:
  
  ``` markdown
  For api overview and usages, check out [this page](overview.md).
  
  [TOC]
  
  Auth
  =================================================
  
  ## Check if user is registered
  
  `POST` `/auth/is_registered`
  
  **paramaters**
  
  - `email`
  
  ## Login
  
  `POST` `/auth`
  
  **Parameters**
  
  - `email`
  - `password`
  
  **Response**
  
  The response will be something like this:
  ```
  
  Stack Trace:
  
  ``` bash
  Traceback (most recent call last):
  "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
      self.run()
    File "/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/watchdog/observers/api.py", line 199, in run
      self.dispatch_events(self.event_queue, self.timeout)
    File "/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/watchdog/observers/api.py", line 368, in dispatch_events
      handler.dispatch(event)
    File "/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/watchdog/events.py", line 322, in dispatch
      self.on_any_event(event)
    File "/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/serve.py", line 28, in on_any_event
      build(config, live_server=True)
    File "/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/build.py", line 223, in build
      build_pages(config)
    File "/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/build.py", line 170, in build_pages
      extensions=config['markdown_extensions'], strict=config['strict']
    File "/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/build.py", line 36, in convert_markdown
      toc_html = md.toc
  AttributeError: 'Markdown' object has no attribute 'toc'
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 
  4 from __future__ import print_function
  5 from setuptools import setup
  6 import re
  7 import os
  8 import sys
  9 
  10 
  11 name = 'mkdocs'
  12 package = 'mkdocs'
  13 description = 'Project documentation with Markdown.'
  14 url = 'http://www.mkdocs.org'
  15 author = 'Tom Christie'
  16 author_email = 'tom@tomchristie.com'
  17 license = 'BSD'
  18 install_requires = [
  19     'Jinja2>=2.7.1',
  20     'Markdown>=2.3.1,<2.5',
  21     'PyYAML>=3.10',
  22     'watchdog>=0.7.0',
  23     'ghp-import>=0.4.1'
  24 ]
  25 
  26 long_description = (
  27     "MkDocs is a fast, simple and downright gorgeous static site generator "
  28     "that's geared towards building project documentation. Documentation "
  29     "source files are written in Markdown, and configured with a single YAML "
  30     "configuration file."
  31 )
  32 
  33 
  34 def get_version(package):
  35     """
  36     Return package version as listed in `__version__` in `init.py`.
  37     """
  38     init_py = open(os.path.join(package, '__init__.py')).read()
  39     return re.search("^__version__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1)
  40 
  41 
  42 def get_packages(package):
  43     """
  44     Return root package and all sub-packages.
  45     """
  46     return [dirpath
  47             for dirpath, dirnames, filenames in os.walk(package)
  48             if os.path.exists(os.path.join(dirpath, '__init__.py'))]
  49 
  50 
  51 def get_package_data(package):
  52     """
  53     Return all files under the root package, that are not in a
  54     package themselves.
  55     """
  56     walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
  57             for dirpath, dirnames, filenames in os.walk(package)
  58             if not os.path.exists(os.path.join(dirpath, '__init__.py'))]
  59 
  60     filepaths = []
  61     for base, filenames in walk:
  62         filepaths.extend([os.path.join(base, filename)
  63                           for filename in filenames])
  64     return {package: filepaths}
  65 
  66 
  67 if sys.argv[-1] == 'publish':
  68     os.system("python setup.py sdist upload")
  69     args = {'version': get_version(package)}
  70     print("You probably want to also tag the version now:")
  71     print("  git tag -a %(version)s -m 'version %(version)s'" % args)
  72     print("  git push --tags")
  73     sys.exit()
  74 
  75 
  76 setup(
  77     name=name,
  78     version=get_version(package),
  79     url=url,
  80     license=license,
  81     description=description,
  82     long_description=long_description,
  83     author=author,
  84     author_email=author_email,
  85     packages=get_packages(package),
  86     package_data=get_package_data(package),
  87     install_requires=install_requires,
  88     entry_points={
  89         'console_scripts': [
  90             'mkdocs = mkdocs.main:run_main',
  91             ],
  92         },
  93     classifiers=[
  94         'Development Status :: 5 - Production/Stable',
  95         'Environment :: Console',
  96         'Environment :: Web Environment',
  97         'Intended Audience :: Developers',
  98         'License :: OSI Approved :: BSD License',
  99         'Operating System :: OS Independent',
  100         'Programming Language :: Python',
  101         'Programming Language :: Python :: 2',
  102         'Programming Language :: Python :: 2.6',
  103         'Programming Language :: Python :: 2.7',
  104         'Programming Language :: Python :: 3',
  105         'Programming Language :: Python :: 3.3',
  106         'Programming Language :: Python :: 3.4',
  107         'Topic :: Documentation',
  108         'Topic :: Text Processing',
  109     ]
  110 )
  111
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -7,6 +7,8 @@
   import os
   import sys
   
  +PY26 = sys.version_info[:2] == (2, 6)
  +
   
   name = 'mkdocs'
   package = 'mkdocs'
  @@ -16,11 +18,11 @@
   author_email = 'tom@tomchristie.com'
   license = 'BSD'
   install_requires = [
  +    'ghp-import>=0.4.1',
       'Jinja2>=2.7.1',
  -    'Markdown>=2.3.1,<2.5',
  +    'Markdown>=2.3.1,<2.5' if PY26 else 'Markdown>=2.3.1',
       'PyYAML>=3.10',
       'watchdog>=0.7.0',
  -    'ghp-import>=0.4.1'
   ]
   
   long_description = (
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -7,6 +7,8 @@\n import os\n import sys\n \n+PY26 = sys.version_info[:2] == (2, 6)\n+\n \n name = 'mkdocs'\n package = 'mkdocs'\n@@ -16,11 +18,11 @@\n author_email = 'tom@tomchristie.com'\n license = 'BSD'\n install_requires = [\n+    'ghp-import>=0.4.1',\n     'Jinja2>=2.7.1',\n-    'Markdown>=2.3.1,<2.5',\n+    'Markdown>=2.3.1,<2.5' if PY26 else 'Markdown>=2.3.1',\n     'PyYAML>=3.10',\n     'watchdog>=0.7.0',\n-    'ghp-import>=0.4.1'\n ]\n \n long_description = (\n", "issue": "Unable to add Table of Contents to docs\nWhen I build a markdown file containing the following information with, `mkdocs build --clean`, mkdocs throws:  `AttributeError: 'Markdown' object has no attribute 'toc'`. Adding `[TOC]` like this was working before, but for some reason its throwing an exception now. I'm running version `0.11.1`.\n\nMarkdown file:\n\n``` markdown\nFor api overview and usages, check out [this page](overview.md).\n\n[TOC]\n\nAuth\n=================================================\n\n## Check if user is registered\n\n`POST` `/auth/is_registered`\n\n**paramaters**\n\n- `email`\n\n## Login\n\n`POST` `/auth`\n\n**Parameters**\n\n- `email`\n- `password`\n\n**Response**\n\nThe response will be something like this:\n```\n\nStack Trace:\n\n``` bash\nTraceback (most recent call last):\n\"/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py\", line 810, in __bootstrap_inner\n    self.run()\n  File \"/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/watchdog/observers/api.py\", line 199, in run\n    self.dispatch_events(self.event_queue, self.timeout)\n  File \"/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/watchdog/observers/api.py\", line 368, in dispatch_events\n    handler.dispatch(event)\n  File \"/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/watchdog/events.py\", line 322, in dispatch\n    self.on_any_event(event)\n  File \"/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/serve.py\", line 28, in on_any_event\n    build(config, live_server=True)\n  File \"/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/build.py\", line 223, in build\n    build_pages(config)\n  File \"/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/build.py\", line 170, in build_pages\n    extensions=config['markdown_extensions'], strict=config['strict']\n  File \"/Users/administrator/dev/meet-web/venv/lib/python2.7/site-packages/mkdocs/build.py\", line 36, in convert_markdown\n    toc_html = md.toc\nAttributeError: 'Markdown' object has no attribute 'toc'\n```\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nfrom setuptools import setup\nimport re\nimport os\nimport sys\n\n\nname = 'mkdocs'\npackage = 'mkdocs'\ndescription = 'Project documentation with Markdown.'\nurl = 'http://www.mkdocs.org'\nauthor = 'Tom Christie'\nauthor_email = 'tom@tomchristie.com'\nlicense = 'BSD'\ninstall_requires = [\n    'Jinja2>=2.7.1',\n    'Markdown>=2.3.1,<2.5',\n    'PyYAML>=3.10',\n    'watchdog>=0.7.0',\n    'ghp-import>=0.4.1'\n]\n\nlong_description = (\n    \"MkDocs is a fast, simple and downright gorgeous static site generator \"\n    \"that's geared towards building project documentation. Documentation \"\n    \"source files are written in Markdown, and configured with a single YAML \"\n    \"configuration file.\"\n)\n\n\ndef get_version(package):\n    \"\"\"\n    Return package version as listed in `__version__` in `init.py`.\n    \"\"\"\n    init_py = open(os.path.join(package, '__init__.py')).read()\n    return re.search(\"^__version__ = ['\\\"]([^'\\\"]+)['\\\"]\", init_py, re.MULTILINE).group(1)\n\n\ndef get_packages(package):\n    \"\"\"\n    Return root package and all sub-packages.\n    \"\"\"\n    return [dirpath\n            for dirpath, dirnames, filenames in os.walk(package)\n            if os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n\ndef get_package_data(package):\n    \"\"\"\n    Return all files under the root package, that are not in a\n    package themselves.\n    \"\"\"\n    walk = [(dirpath.replace(package + os.sep, '', 1), filenames)\n            for dirpath, dirnames, filenames in os.walk(package)\n            if not os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n    filepaths = []\n    for base, filenames in walk:\n        filepaths.extend([os.path.join(base, filename)\n                          for filename in filenames])\n    return {package: filepaths}\n\n\nif sys.argv[-1] == 'publish':\n    os.system(\"python setup.py sdist upload\")\n    args = {'version': get_version(package)}\n    print(\"You probably want to also tag the version now:\")\n    print(\"  git tag -a %(version)s -m 'version %(version)s'\" % args)\n    print(\"  git push --tags\")\n    sys.exit()\n\n\nsetup(\n    name=name,\n    version=get_version(package),\n    url=url,\n    license=license,\n    description=description,\n    long_description=long_description,\n    author=author,\n    author_email=author_email,\n    packages=get_packages(package),\n    package_data=get_package_data(package),\n    install_requires=install_requires,\n    entry_points={\n        'console_scripts': [\n            'mkdocs = mkdocs.main:run_main',\n            ],\n        },\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Console',\n        'Environment :: Web Environment',\n        'Intended Audience :: Developers',\n        'License :: OSI Approved :: BSD License',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.6',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Topic :: Documentation',\n        'Topic :: Text Processing',\n    ]\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nfrom setuptools import setup\nimport re\nimport os\nimport sys\n\nPY26 = sys.version_info[:2] == (2, 6)\n\n\nname = 'mkdocs'\npackage = 'mkdocs'\ndescription = 'Project documentation with Markdown.'\nurl = 'http://www.mkdocs.org'\nauthor = 'Tom Christie'\nauthor_email = 'tom@tomchristie.com'\nlicense = 'BSD'\ninstall_requires = [\n    'ghp-import>=0.4.1',\n    'Jinja2>=2.7.1',\n    'Markdown>=2.3.1,<2.5' if PY26 else 'Markdown>=2.3.1',\n    'PyYAML>=3.10',\n    'watchdog>=0.7.0',\n]\n\nlong_description = (\n    \"MkDocs is a fast, simple and downright gorgeous static site generator \"\n    \"that's geared towards building project documentation. Documentation \"\n    \"source files are written in Markdown, and configured with a single YAML \"\n    \"configuration file.\"\n)\n\n\ndef get_version(package):\n    \"\"\"\n    Return package version as listed in `__version__` in `init.py`.\n    \"\"\"\n    init_py = open(os.path.join(package, '__init__.py')).read()\n    return re.search(\"^__version__ = ['\\\"]([^'\\\"]+)['\\\"]\", init_py, re.MULTILINE).group(1)\n\n\ndef get_packages(package):\n    \"\"\"\n    Return root package and all sub-packages.\n    \"\"\"\n    return [dirpath\n            for dirpath, dirnames, filenames in os.walk(package)\n            if os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n\ndef get_package_data(package):\n    \"\"\"\n    Return all files under the root package, that are not in a\n    package themselves.\n    \"\"\"\n    walk = [(dirpath.replace(package + os.sep, '', 1), filenames)\n            for dirpath, dirnames, filenames in os.walk(package)\n            if not os.path.exists(os.path.join(dirpath, '__init__.py'))]\n\n    filepaths = []\n    for base, filenames in walk:\n        filepaths.extend([os.path.join(base, filename)\n                          for filename in filenames])\n    return {package: filepaths}\n\n\nif sys.argv[-1] == 'publish':\n    os.system(\"python setup.py sdist upload\")\n    args = {'version': get_version(package)}\n    print(\"You probably want to also tag the version now:\")\n    print(\"  git tag -a %(version)s -m 'version %(version)s'\" % args)\n    print(\"  git push --tags\")\n    sys.exit()\n\n\nsetup(\n    name=name,\n    version=get_version(package),\n    url=url,\n    license=license,\n    description=description,\n    long_description=long_description,\n    author=author,\n    author_email=author_email,\n    packages=get_packages(package),\n    package_data=get_package_data(package),\n    install_requires=install_requires,\n    entry_points={\n        'console_scripts': [\n            'mkdocs = mkdocs.main:run_main',\n            ],\n        },\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Console',\n        'Environment :: Web Environment',\n        'Intended Audience :: Developers',\n        'License :: OSI Approved :: BSD License',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.6',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Topic :: Documentation',\n        'Topic :: Text Processing',\n    ]\n)\n", "path": "setup.py"}]}