-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Link inline settings when not part of options section #10499
Docs: Link inline settings when not part of options section #10499
Conversation
a91963b
to
352fada
Compare
|
crates/ruff_dev/src/generate_docs.rs
Outdated
let re = Regex::new(r"\[`([^`]*?)`]\[(.*?)]").unwrap(); | ||
for (_, [option, _]) in re.captures_iter(&documentation).map(|c| c.extract()) { | ||
if let Some(OptionEntry::Field(field)) = Options::metadata().find(option) { | ||
if !options.contains(option) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I first assumed that options
points to Options::metadata
, which isn't the case. What I understand is that options
stores all linked or referenced options, maybe rename to linked_options
or referenced_options
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed to referenced_options
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you
Summary
Some contributors have referenced settings in their documentation without adding the settings to an options section, this has lead to some rendering issues (#10427). This PR addresses this looking for potential inline links to settings, cross-checking them with the options sections, and then linking them anyway if they are not found.
Resolves #10427.
Test Plan
Manually verified that the correct modifications were made and no docs were broken.