Bug: the autolink pass stashed <a> tags (via _al_stash) before running, but did not stash <img> tags. When  was converted to an <img> tag by the image pass, the subsequent autolink regex matched the URL inside src="..." and wrapped it in <a href="...">url</a>, producing src="<a href="...">url</a>" — a completely broken image source. Fix: extend the _al_stash regex from: (<a\b[^>]*>[\s\S]*?<\/a>) to: (<a\b[^>]*>[\s\S]*?<\/a>|<img\b[^>]*>) This stashes both <a> and self-closing <img> tags before autolink runs, then restores them after, so the URL inside src= is never touched. Adds 7 regression tests in tests/test_issue487b.py.
5.3 KiB
5.3 KiB