Skip to content

Conversation

@augustelalande
Copy link
Contributor

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.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 21, 2024

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@charliermarsh charliermarsh added bug Something isn't working documentation Improvements or additions to documentation labels Mar 21, 2024
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) {
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you

@charliermarsh charliermarsh enabled auto-merge (squash) March 21, 2024 16:25
@charliermarsh charliermarsh merged commit 9b3c732 into astral-sh:main Mar 21, 2024
@augustelalande augustelalande deleted the link-inline-settings branch March 31, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some docs not rendering properly

3 participants