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

Method getText

markdown/inlinepatterns.py:832–849  ·  view source on GitHub ↗

Parse the content between `[]` of the start of an image or link resolving nested square brackets.

(self, data: str, index: int)

Source from the content-addressed store, hash-verified

830 return href, title, index, handled
831
832 def getText(self, data: str, index: int) -> tuple[str, int, bool]:
833 """Parse the content between `[]` of the start of an image or link
834 resolving nested square brackets.
835
836 """
837 bracket_count = 1
838 text = []
839 for pos in range(index, len(data)):
840 c = data[pos]
841 if c == ']':
842 bracket_count -= 1
843 elif c == '[':
844 bracket_count += 1
845 index += 1
846 if bracket_count == 0:
847 break
848 text.append(c)
849 return ''.join(text), index, bracket_count == 0
850
851
852class ImageInlineProcessor(LinkInlineProcessor):

Callers 3

handleMatchMethod · 0.95
handleMatchMethod · 0.80
handleMatchMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected