Bug fix: Prevent fully defined links [name](link) from being reformatted#10442
Bug fix: Prevent fully defined links [name](link) from being reformatted#10442charliermarsh merged 1 commit intoastral-sh:mainfrom
name](link) from being reformatted#10442Conversation
name](link) from being reformattedname](link) from being reformatted
name](link) from being reformattedname\](link) from being reformatted
name\](link) from being reformattedname](link) from being reformatted
55c5573 to
de0a6ec
Compare
|
|
Does the example in https://docs.astral.sh/ruff/rules/typed-argument-default-in-stub/ now render correctly? I think this hack exists because MkDocs wasn't respecting backticks within URLs. |
|
It does work. Although looking again at #280 I'm not sure why. |
|
Is it possible that something changed in MkDocs? |
|
Wait actually this always worked even in Python-Markdown/markdown#280
|
|
What doesn't work is empty references with code formatting, so the proposed fix is reasonable.
And actually the current implementation doesn't address Python-Markdown/markdown#280 |
|
Oh right, I think the motivating case was specifically about reference links. |

Summary
Currently fully define markdown links which include ticks are being reformatted by
ruff/crates/ruff_dev/src/generate_docs.rs
Lines 105 to 114 in 8619986
[`name`](link)->[`name`][name](link)For example: https://docs.astral.sh/ruff/rules/typed-argument-default-in-stub/
This PR excludes the open parentheses from the regex, so that these types of links won't be reformatted.
Test Plan
Extended the regression test.