We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1a43fa3 commit 9616588Copy full SHA for 9616588
markdown_it/rules_inline/text.py
@@ -1,3 +1,5 @@
1
+import re
2
+
3
# Skip text characters for text token, place those to pending buffer
4
# and increment current pos
5
from .state_inline import StateInline
@@ -34,13 +36,15 @@
34
36
"}",
35
37
"~",
38
}
39
+_RE_TERMINATOR_CHAR = re.compile("[" + re.escape("".join(_TerminatorChars)) + "]")
40
41
42
def text(state: StateInline, silent: bool) -> bool:
43
pos = state.pos
44
posMax = state.posMax
- while (pos < posMax) and state.src[pos] not in _TerminatorChars:
- pos += 1
45
46
+ terminator_char = _RE_TERMINATOR_CHAR.search(state.src, pos)
47
+ pos = terminator_char.start() if terminator_char else posMax
48
49
if pos == state.pos:
50
return False
0 commit comments