(state: StateInline, start: int, disableNested: bool = False)
| 10 | |
| 11 | |
| 12 | def parseLinkLabel(state: StateInline, start: int, disableNested: bool = False) -> int: |
| 13 | labelEnd = -1 |
| 14 | oldPos = state.pos |
| 15 | found = False |
| 16 | |
| 17 | state.pos = start + 1 |
| 18 | level = 1 |
| 19 | |
| 20 | while state.pos < state.posMax: |
| 21 | marker = state.src[state.pos] |
| 22 | if marker == "]": |
| 23 | level -= 1 |
| 24 | if level == 0: |
| 25 | found = True |
| 26 | break |
| 27 | |
| 28 | prevPos = state.pos |
| 29 | state.md.inline.skipToken(state) |
| 30 | if marker == "[": |
| 31 | if prevPos == state.pos - 1: |
| 32 | # increase level if we find text `[`, |
| 33 | # which is not a part of any token |
| 34 | level += 1 |
| 35 | elif disableNested: |
| 36 | state.pos = oldPos |
| 37 | return -1 |
| 38 | if found: |
| 39 | labelEnd = state.pos |
| 40 | |
| 41 | # restore old state |
| 42 | state.pos = oldPos |
| 43 | |
| 44 | return labelEnd |
nothing calls this directly
no test coverage detected
searching dependent graphs…