Server IP : 15.235.198.142 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/markdown_it/helpers/ |
Upload File : |
""" Parse link label this function assumes that first character ("[") already matches returns the end of the label """ from markdown_it.rules_inline import StateInline def parseLinkLabel(state: StateInline, start: int, disableNested: bool = False) -> int: labelEnd = -1 oldPos = state.pos found = False state.pos = start + 1 level = 1 while state.pos < state.posMax: marker = state.src[state.pos] if marker == "]": level -= 1 if level == 0: found = True break prevPos = state.pos state.md.inline.skipToken(state) if marker == "[": if prevPos == state.pos - 1: # increase level if we find text `[`, # which is not a part of any token level += 1 elif disableNested: state.pos = oldPos return -1 if found: labelEnd = state.pos # restore old state state.pos = oldPos return labelEnd