MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / add_link

Method add_link

src/__init__.py:2241–2252  ·  view source on GitHub ↗

Add a hyperlink ("a" tag)

(self, href, text=None)

Source from the content-addressed store, hash-verified

2239 return child
2240
2241 def add_link(self, href, text=None):
2242 """Add a hyperlink ("a" tag)"""
2243 child = self.create_element("a")
2244 if not isinstance(text, str):
2245 text = href
2246 child.set_attribute("href", href)
2247 child.append_child(self.create_text_node(text))
2248 prev = self.span_bottom()
2249 if prev is None:
2250 prev = self
2251 prev.append_child(child)
2252 return self
2253
2254 def add_list_item(self):
2255 """Add item ("li" tag) under a (numbered or bulleted) list."""

Callers 1

json-example.pyFile · 0.80

Calls 5

create_elementMethod · 0.95
create_text_nodeMethod · 0.95
span_bottomMethod · 0.95
set_attributeMethod · 0.80
append_childMethod · 0.80

Tested by

no test coverage detected