Skip to content
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

Merged
merged 4 commits into from Mar 21, 2024

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.

Copy link

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
17 checks passed
@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