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
8 changes: 8 additions & 0 deletions mdit_py_plugins/gfm_autolink/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def _www_inline_rule(state: StateInline, silent: bool) -> bool:
label = src[pos : pos + length]

if silent:
# Advance by one: parseLinkLabel must keep seeing every character
# (a full-token advance can overshoot ']' when the match extends
# past it), and any advance at all breaks the no-progress loop.
state.pos += 1
return True

full_url = state.md.normalizeLink(url)
Expand Down Expand Up @@ -223,6 +227,8 @@ def _protocol_rule(state: StateInline, silent: bool) -> bool:
label = combined[:total_len]

if silent:
# Advance by one, as above; never touch pending in silent mode.
state.pos += 1
return True
return _create_autolink(state, bscan_len, total_len, full_url, label)

Expand Down Expand Up @@ -291,5 +297,7 @@ def _email_rule(state: StateInline, silent: bool) -> bool:
url = "mailto:" + email_text

if silent:
# Advance by one, as above; never touch pending in silent mode.
state.pos += 1
return True
return _create_autolink(state, local_len, total_len, url, email_text)