Skip to content

Advance one char in silent mode so label scans cannot hang - #163

Open
ranas-mukminov wants to merge 1 commit into
executablebooks:masterfrom
ranas-mukminov:fix/gfm-autolink-silent-advance
Open

ranas-mukminov wants to merge 1 commit into
executablebooks:masterfrom
ranas-mukminov:fix/gfm-autolink-silent-advance

Conversation

@ranas-mukminov

Copy link
Copy Markdown

Fixes #160

Problem: the www, protocol and email rules returned True in silent (validation) mode without advancing state.pos, so parseLinkLabel looped forever on a link whose text starts a www autolink after other text (e.g. see www.example.com).

Change:

  • mdit_py_plugins/gfm_autolink/index.py: all three rules now advance state.pos by one in silent mode, without touching pending. One char (not the full match) so the label scan still sees every character, including a closing bracket a greedy match would overshoot.

Tests:

  • Issue repro: both hanging inputs now render (see www.example.com as a link, link www.example.com as a link with emphasis); all previously working cases render unchanged.
  • Existing tests/test_gfm_autolink.py fixture suite: 20 passed.
  • python3 -m py_compile on the patched file: OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gfm_autolink: a www. URL inside link text hangs the parser

1 participant