def get_markdown_toc(markdown_source):
    """Return TOC generated by Markdown parser from Markdown source text."""
    md = markdown.Markdown(extensions=['toc'])
    md.convert(markdown_source)
    return md.toc_tokens
Return TOC generated by Markdown parser from Markdown source text.
mkdocs/tests/base.py