Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions markdown_it/rules_inline/text.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

# Skip text characters for text token, place those to pending buffer
# and increment current pos
from .state_inline import StateInline
Expand Down Expand Up @@ -34,13 +36,15 @@
"}",
"~",
}
_RE_TERMINATOR_CHAR = re.compile("[" + re.escape("".join(_TerminatorChars)) + "]")


def text(state: StateInline, silent: bool) -> bool:
pos = state.pos
posMax = state.posMax
while (pos < posMax) and state.src[pos] not in _TerminatorChars:
pos += 1

terminator_char = _RE_TERMINATOR_CHAR.search(state.src, pos)
pos = terminator_char.start() if terminator_char else posMax

if pos == state.pos:
return False
Expand Down
Loading