markdown.extensions.toc
¶
Table of Contents Extension for Python-Markdown¶
See https://Python-Markdown.github.io/extensions/toc for documentation.
Original code Copyright 2008 Jack Miller
All changes Copyright 2008-2014 The Python Markdown Project
License: BSD
Classes:
Functions:
-
get_name
–
Get title name.
-
nest_toc_tokens
–
Given an unsorted list with errors and skips, return a nested one.
-
slugify
–
Slugify a string, to make it URL friendly.
-
slugify_unicode
–
Slugify a string, to make it URL friendly while preserving Unicode characters.
-
stashedHTML2text
–
Extract raw HTML from stash, reduce to plain text and swap with placeholder.
-
unescape
–
Unescape escaped text.
-
unique
–
Ensure id is unique in set of ids. Append ‘_1’, ‘_2’… if not
markdown.extensions.toc.TocTreeprocessor(md, config)
¶
Bases: Treeprocessor
Methods:
-
build_toc_div
–
Return a string div given a toc list.
-
iterparent
–
Iterator wrapper to get allowed parent and child all at once.
-
replace_marker
–
Replace marker with elem.
-
set_level
–
Adjust header level according to base level.
markdown.extensions.toc.TocTreeprocessor.build_toc_div(toc_list)
¶
Return a string div given a toc list.
markdown.extensions.toc.TocTreeprocessor.iterparent(node)
¶
Iterator wrapper to get allowed parent and child all at once.
markdown.extensions.toc.TocTreeprocessor.replace_marker(root, elem)
¶
Replace marker with elem.
markdown.extensions.toc.TocTreeprocessor.set_level(elem)
¶
Adjust header level according to base level.
markdown.extensions.toc.get_name(el)
¶
Get title name.
markdown.extensions.toc.nest_toc_tokens(toc_list)
¶
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’: []}]
markdown.extensions.toc.slugify(value, separator, unicode = False)
¶
Slugify a string, to make it URL friendly.
markdown.extensions.toc.slugify_unicode(value, separator)
¶
Slugify a string, to make it URL friendly while preserving Unicode characters.
markdown.extensions.toc.stashedHTML2text(text, md, strip_entities = True)
¶
Extract raw HTML from stash, reduce to plain text and swap with placeholder.
markdown.extensions.toc.unescape(text)
¶
Unescape escaped text.
markdown.extensions.toc.unique(id, ids)
¶
Ensure id is unique in set of ids. Append ‘_1’, ‘_2’… if not