Skip to content

Keep wiki links out of existing links and HTML attributes - #769

Open
alexbertho wants to merge 1 commit into
trentm:masterfrom
alexbertho:fix-wiki-links-in-existing-links
Open

alexbertho wants to merge 1 commit into
trentm:masterfrom
alexbertho:fix-wiki-links-in-existing-links

Conversation

@alexbertho

Copy link
Copy Markdown

The wiki-links extra currently expands [[Home]] inside Markdown links, image descriptions and inline HTML markup. For example, [go [[Home]]](https://example.com) produces nested anchors, while ![go [[Home]]](img.png) puts a complete anchor inside the quoted alt attribute.

Run wiki-link expansion after Markdown links are resolved and use the existing HTML tokenizer to limit replacements to text outside anchors and markup. Standalone wiki links retain their configured URL/class handling. Document the literal behavior inside existing links and image descriptions.

The regression covers inline and reference links/images, a linked image, raw uppercase anchors, HTML attributes, escaped syntax, code spans and a standalone wiki link following a normal link. Five of the initial regression cases fail on the original implementation.

Validation on Linux, Python 3.12.14, with all optional dependencies installed: the configured test.py -- -knownfailure suite passes (305 tests); test/test_redos.py passes (12 tests), and git diff --check passes. Other Python versions and operating systems were not tested locally.

Found by local source inspection and executed reproductions, not a production incident. AI disclosure: investigated, implemented and tested with OpenAI Codex.

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.

1 participant