Skip to content
Open
Changes from all commits
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
10 changes: 10 additions & 0 deletions marko/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ def __init__(self, match: _Match) -> None:
self.soft = not match.group(1).startswith((" ", "\\"))
self.children = "\n"

@classmethod
def find(cls, text: str, *, source: Source) -> Iterator[_Match]:
"""This method should return an iterable containing matches of this element."""
# HACK: short circuit to avoid quadratic runtime when text doesn't have a linebreak.
# ideally the regex pattern should be rewritten, but this works for now.
# see issue #219
if '\n' not in text:
return []
return super().find(text, source=source)


class InlineHTML(InlineElement):
priority = 7
Expand Down
Loading