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

Method add_anchor

markdown/extensions/toc.py:328–338  ·  view source on GitHub ↗
(self, c: etree.Element, elem_id: str)

Source from the content-addressed store, hash-verified

326 elem.tag = 'h%d' % level
327
328 def add_anchor(self, c: etree.Element, elem_id: str) -> None:
329 anchor = etree.Element("a")
330 anchor.text = c.text
331 anchor.attrib["href"] = "#" + elem_id
332 anchor.attrib["class"] = self.anchorlink_class
333 c.text = ""
334 for elem in c:
335 anchor.append(elem)
336 while len(c):
337 c.remove(c[0])
338 c.append(anchor)
339
340 def add_permalink(self, c: etree.Element, elem_id: str) -> None:
341 permalink = etree.Element("a")

Callers 1

runMethod · 0.95

Calls 1

removeMethod · 0.80

Tested by

no test coverage detected