Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias alias alias alias Import alias FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam NameParam defaults ListLoad Dict Str Num body If UnaryOpNot NameLoad body Return TupleLoad ListLoad ListLoad Assign NameStore Call AttributeLoad NameLoad attr Num If UnaryOpNot CompareIn Str Call AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index Str ListLoad If UnaryOpNot NameLoad body Assign TupleStore NameStore NameStore Call NameLoad NameLoad ListLoad NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad Return TupleLoad BinOpAdd ListLoad NameLoad NameLoad ListLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore ListLoad If CompareGt SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad AugAssignAdd NameStore NameLoad AugAssignAdd NameStore NameLoad orelse If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Num NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore NameLoad Return TupleLoad NameLoad NameLoad decorator_list Assign TupleStore NameStore NameStore Call NameLoad NameLoad Return NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body For NameStore Call AttributeLoad NameLoad attr body For NameStore NameLoad body Expr Yield TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str BinOpAdd Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Assign AttributeStore NameLoad attr Str For NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr IfExp CompareIs AttributeLoad NameLoad attr NameLoad BinOpMod Str NameLoad AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str BinOpAdd Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If SubscriptLoad AttributeLoad NameLoad attr Index Str body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str BinOpAdd Str Call AttributeLoad NameLoad attr Str Str If SubscriptLoad NameLoad Index Str body Expr Call NameLoad SubscriptLoad NameLoad Index Str NameLoad Return NameLoad decorator_list Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str Assign NameStore Call NameLoad For NameStore Call AttributeLoad NameLoad attr body If CompareIn Str AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str Assign NameStore ListLoad Assign NameStore NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad Str attr Call NameLoad NameLoad attr If UnaryOpNot NameLoad body Continue If BoolOpAnd AttributeLoad NameLoad attr CompareEq Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Str UnaryOpNot Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareNotIn AttributeLoad NameLoad attr ListLoad Str Str body For NameStore Call NameLoad Call NameLoad NameLoad body If CompareEq SubscriptLoad NameLoad Index NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad Break Assign NameStore NameLoad If Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If UnaryOpNot CompareIn Str AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad Call SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad orelse Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Str Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Str If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam defaults ListLoad body Assign AttributeStore NameLoad attr Dict Str Str Str Str Str ListLoad Str Str ListLoad NameLoad Str ListLoad NameLoad Str ListLoad Num Str ListLoad Num Str Str For TupleStore NameStore NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Str decorator_list decorator_list FunctionDef arguments args NameParam defaults Dict body Return Call NameLoad keyword NameLoad decorator_list
N/A N/A 
Table of Contents Extension for Python-Markdown
* * *

(c) 2008 [Jack Miller](http://codezen.org)

Dependencies:
* [Markdown 2.1+](http://packages.python.org/Markdown/)

 __future__ absolute_import __future__ unicode_literals N/A Extension treeprocessors Treeprocessor util etree parseBoolValue AMP_SUBSTITUTE headerid slugify unique itertext stashedHTML2text N/A re order_toc_list N/A N/A toc_list N/A N/A N/A Given an unsorted list with errors and skips, return a nested one.
    [{'level': 1}, {'level': 2}]
    =>
    [{'level': 1, 'children': [{'level': 2, 'children': []}]}]
    
    A wrong list is also converted:
    [{'level': 2}, {'level': 1}]
    =>
    [{'level': 2, 'children': []}, {'level': 1, 'children': []}]
     build_correct N/A N/A remaining_list prev_elements N/A N/A N/A level 1000 N/A N/A N/A remaining_list N/A N/A N/A N/A N/A N/A current N/A N/A remaining_list pop 0 N/A N/A N/A children N/A N/A current keys N/A N/A N/A current N/A children N/A N/A N/A prev_elements N/A N/A N/A next_elements children N/A build_correct remaining_list N/A current N/A N/A N/A N/A current N/A children append children N/A N/A N/A N/A current next_elements N/A N/A prev_element N/A N/A prev_elements pop N/A children N/A N/A next_elements N/A N/A N/A N/A current N/A level N/A prev_element N/A level N/A N/A N/A N/A prev_elements append prev_element N/A N/A N/A prev_elements append current N/A N/A N/A N/A prev_element N/A children append current N/A N/A next_elements2 children2 N/A build_correct remaining_list prev_elements N/A children children2 N/A next_elements next_elements2 N/A N/A N/A prev_elements N/A N/A N/A N/A next_elements append current N/A prev_elements N/A current N/A N/A next_elements2 children2 N/A build_correct remaining_list prev_elements N/A N/A N/A N/A current N/A children extend children2 N/A N/A N/A N/A remaining_list insert 0 current N/A N/A next_elements2 children2 N/A build_correct remaining_list prev_elements N/A N/A N/A children extend children2 N/A next_elements next_elements2 N/A N/A next_elements children N/A N/A N/A ordered_list __ N/A build_correct toc_list N/A ordered_list N/A TocTreeprocessor N/A Treeprocessor N/A iterparent N/A N/A self root N/A N/A N/A parent N/A N/A root getiterator N/A N/A child parent N/A N/A N/A N/A parent child N/A add_anchor N/A N/A self c elem_id N/A N/A N/A anchor N/A N/A etree Element a N/A N/A anchor text N/A c text N/A N/A N/A anchor attrib N/A href N/A # elem_id N/A N/A N/A anchor attrib N/A class toclink N/A N/A c text N/A elem N/A N/A c getchildren N/A N/A N/A N/A anchor append elem N/A N/A N/A c remove elem N/A N/A N/A c append anchor N/A add_permalink N/A N/A self c elem_id N/A N/A N/A permalink N/A N/A etree Element a N/A N/A permalink text N/A N/A N/A self use_permalinks True N/A %spara; AMP_SUBSTITUTE N/A self use_permalinks N/A N/A N/A permalink attrib N/A href N/A # elem_id N/A N/A N/A permalink attrib N/A class headerlink N/A N/A N/A permalink attrib N/A title Permanent link N/A N/A N/A c append permalink N/A build_toc_etree N/A N/A self div toc_list N/A N/A N/A N/A N/A self config N/A title N/A N/A header N/A N/A etree SubElement div span N/A N/A N/A header attrib N/A class toctitle N/A N/A header text N/A N/A self config N/A title build_etree_ul N/A N/A toc_list parent N/A N/A N/A ul N/A N/A etree SubElement parent ul N/A item toc_list N/A N/A li N/A N/A etree SubElement ul li N/A link N/A N/A etree SubElement li a N/A N/A link text N/A N/A item get name N/A N/A N/A link attrib N/A href N/A # N/A N/A item get id N/A N/A item N/A children N/A N/A N/A build_etree_ul N/A item N/A children li N/A ul N/A N/A N/A build_etree_ul toc_list div N/A run N/A N/A self doc N/A N/A N/A div N/A N/A etree Element div N/A N/A N/A div attrib N/A class toc N/A header_rgx N/A N/A re compile [Hh][123456] N/A N/A self use_anchors N/A parseBoolValue N/A N/A self config N/A anchorlink N/A N/A self use_permalinks N/A parseBoolValue N/A N/A self config N/A permalink False N/A N/A N/A self use_permalinks None N/A N/A N/A self use_permalinks N/A N/A self config N/A permalink N/A used_ids N/A set N/A c N/A N/A doc getiterator N/A N/A N/A id N/A c attrib N/A N/A N/A N/A used_ids add N/A N/A c attrib N/A id N/A toc_list N/A N/A marker_found False N/A N/A p c N/A N/A self iterparent doc N/A N/A text N/A N/A N/A N/A join N/A itertext c strip N/A N/A text N/A N/A N/A N/A N/A c text N/A N/A N/A N/A c text strip N/A N/A self config N/A marker N/A N/A N/A header_rgx match N/A c tag N/A N/A c tag N/A pre code N/A N/A i N/A range N/A len p N/A N/A N/A N/A p N/A i c N/A N/A N/A p N/A i div N/A N/A marker_found True N/A N/A N/A header_rgx match N/A c tag N/A N/A N/A N/A id N/A c attrib N/A N/A elem_id N/A stashedHTML2text text N/A self markdown N/A elem_id N/A unique N/A N/A N/A self config N/A slugify elem_id - used_ids N/A N/A N/A c attrib N/A id elem_id N/A N/A elem_id N/A N/A c attrib N/A id N/A tag_level N/A int N/A N/A c tag N/A -1 N/A N/A N/A toc_list append N/A level id name tag_level elem_id text N/A N/A self use_anchors N/A N/A N/A N/A self add_anchor c elem_id N/A N/A self use_permalinks N/A N/A N/A N/A self add_permalink c elem_id N/A toc_list_nested N/A order_toc_list toc_list N/A N/A N/A self build_toc_etree div toc_list_nested N/A prettify N/A N/A N/A N/A self markdown treeprocessors get prettify N/A prettify N/A N/A N/A N/A prettify run div N/A N/A marker_found N/A N/A toc N/A N/A N/A self markdown serializer div N/A pp N/A N/A N/A N/A self markdown postprocessors values N/A N/A toc N/A N/A pp run toc N/A N/A N/A self markdown toc toc N/A N/A TocExtension N/A Extension N/A N/A TreeProcessorClass TocTreeprocessor __init__ N/A N/A self configs N/A N/A N/A N/A N/A self config N/A marker slugify title anchorlink permalink N/A [TOC] Text to find and replace with Table of Contents -Defaults to "[TOC]" N/A slugify Function to generate anchors based on header text-Defaults to the headerid ext's slugify function. N/A None Title to insert into TOC <div> - Defaults to None N/A 0 1 if header should be a self linkDefaults to 0 N/A 0 1 or link text if a Sphinx-style permalink should be added Defaults to 0 N/A N/A key value configs N/A N/A N/A N/A self setConfig key value N/A extendMarkdown N/A N/A self md md_globals N/A N/A N/A tocext N/A N/A self TreeProcessorClass md N/A N/A tocext config N/A N/A self getConfigs N/A N/A N/A N/A md treeprocessors add toc tocext _end N/A N/A makeExtension N/A N/A configs N/A N/A N/A N/A N/A TocExtension configs configs N/A