Skip to content

docs: fix incorrect import-heading example#23568

Merged
ntBre merged 3 commits intoastral-sh:mainfrom
GeObts:docs-fix-import-heading-example
Feb 26, 2026
Merged

docs: fix incorrect import-heading example#23568
ntBre merged 3 commits intoastral-sh:mainfrom
GeObts:docs-fix-import-heading-example

Conversation

@GeObts
Copy link
Contributor

@GeObts GeObts commented Feb 25, 2026

Fixes incorrect TOML example for import-heading configuration.

Closes #23420

@ntBre
Copy link
Contributor

ntBre commented Feb 25, 2026

Could you please add a test plan showing a local build of the docs with the updated heading? I thought there was a different PR implementing this, and it ended up with a duplicate heading.

@ntBre ntBre added the documentation Improvements or additions to documentation label Feb 25, 2026
@GeObts
Copy link
Contributor Author

GeObts commented Feb 25, 2026

Thanks — I can't run a full local docs build in my current environment atm, so I can't attach a mkdocs build result right now.

What I did verify:

  • The TOML example is now syntactically correct (adds the missing [lint.isort.import-heading] table header before the keys).
  • A repo-wide search shows this is the only import-heading example/table in the docs content I touched, so this change shouldn't introduce a duplicate heading.

If necessary and you'd prefer, I can rerun this with a proper Rust toolchain + docs build and report back

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

I built it locally, and there's a duplicate heading:

Image

@GeObts
Copy link
Contributor Author

GeObts commented Feb 25, 2026

Thanks — I see what you mean. I'll update the snippet to use the fully-qualified table header ([tool.ruff.lint.isort.import-heading] / [lint.isort.import-heading]) instead of the nested [import-heading] form to avoid the duplicate heading in the rendered docs. Pushing an update shortly.

Use fully-qualified table header to avoid duplicate heading in rendered docs.

Closes astral-sh#23420
@GeObts GeObts force-pushed the docs-fix-import-heading-example branch from ed88148 to ec43418 Compare February 25, 2026 21:55
@GeObts
Copy link
Contributor Author

GeObts commented Feb 25, 2026

Thanks — updated the example to use the fully-qualified table header to avoid the duplicate heading in the rendered docs.

@ntBre
Copy link
Contributor

ntBre commented Feb 25, 2026

That just gives a different duplicate heading, which is also wrong for the ruff.toml tab:
image

I think this is going to take a deeper dive than just inserting a line in the docs and would also benefit from you testing it locally.

@GeObts
Copy link
Contributor Author

GeObts commented Feb 26, 2026

Switched the example to the inline dict form (import-heading = {...}) to match other dict examples in options.rs and to avoid the docs generator dropping the nested header segment / producing duplicate headings.

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

It turns out that the correct fix was to use this scope field:

Image

I went ahead and pushed a commit and will merge once today's release is finished.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 26, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre merged commit fbb9fa7 into astral-sh:main Feb 26, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ruff docs example's for [lint.isort] import-heading wrong.

3 participants