MCPcopy Index your code
hub / github.com/Python-Markdown/markdown / add_permalink

Method add_permalink

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

Source from the content-addressed store, hash-verified

316 c.append(anchor)
317
318 def add_permalink(self, c: etree.Element, elem_id: str) -> None:
319 permalink = etree.Element("a")
320 permalink.text = ("%spara;" % AMP_SUBSTITUTE
321 if self.use_permalinks is True
322 else self.use_permalinks)
323 permalink.attrib["href"] = "#" + elem_id
324 permalink.attrib["class"] = self.permalink_class
325 if self.permalink_title:
326 permalink.attrib["title"] = self.permalink_title
327 if self.permalink_leading:
328 permalink.tail = c.text
329 c.text = ""
330 c.insert(0, permalink)
331 else:
332 c.append(permalink)
333
334 def build_toc_div(self, toc_list: list) -> etree.Element:
335 """ Return a string div given a toc list. """

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected