MCPcopy
hub / github.com/Python-Markdown/markdown / ImageInlineProcessor

Class ImageInlineProcessor

markdown/inlinepatterns.py:852–873  ·  view source on GitHub ↗

Return a `img` element from the given match.

Source from the content-addressed store, hash-verified

850
851
852class ImageInlineProcessor(LinkInlineProcessor):
853 """ Return a `img` element from the given match. """
854
855 def handleMatch(self, m: re.Match[str], data: str) -> tuple[etree.Element | None, int | None, int | None]:
856 """ Return an `img` [`Element`][xml.etree.ElementTree.Element] or `(None, None, None)`. """
857 text, index, handled = self.getText(data, m.end(0))
858 if not handled:
859 return None, None, None
860
861 src, title, index, handled = self.getLink(data, index)
862 if not handled:
863 return None, None, None
864
865 el = etree.Element("img")
866
867 el.set("src", src)
868
869 if title is not None:
870 el.set("title", title)
871
872 el.set('alt', self.unescape(text))
873 return el, m.start(0), index
874
875
876class ReferenceInlineProcessor(LinkInlineProcessor):

Callers 1

build_inlinepatternsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…