MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / build_etree_ul

Method build_etree_ul

markdown/extensions/toc.py:368–378  ·  view source on GitHub ↗
(toc_list: list, parent: etree.Element)

Source from the content-addressed store, hash-verified

366 header.text = self.title
367
368 def build_etree_ul(toc_list: list, parent: etree.Element) -> etree.Element:
369 ul = etree.SubElement(parent, "ul")
370 for item in toc_list:
371 # List item link, to be inserted into the toc div
372 li = etree.SubElement(ul, "li")
373 link = etree.SubElement(li, "a")
374 link.text = item.get('name', '')
375 link.attrib["href"] = '#' + item.get('id', '')
376 if item['children']:
377 build_etree_ul(item['children'], li)
378 return ul
379
380 build_etree_ul(toc_list, div)
381

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected