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

Method add_anchor

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

Source from the content-addressed store, hash-verified

304 elem.tag = 'h%d' % level
305
306 def add_anchor(self, c: etree.Element, elem_id: str) -> None:
307 anchor = etree.Element("a")
308 anchor.text = c.text
309 anchor.attrib["href"] = "#" + elem_id
310 anchor.attrib["class"] = self.anchorlink_class
311 c.text = ""
312 for elem in c:
313 anchor.append(elem)
314 while len(c):
315 c.remove(c[0])
316 c.append(anchor)
317
318 def add_permalink(self, c: etree.Element, elem_id: str) -> None:
319 permalink = etree.Element("a")

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected