sphinx-doc / sphinx-doc/sphinx

Allow prefix `/` in autosummary's `toctree` to refer to base directory

Open
#11,637 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extensions:autosummary internals:toctree type:proposal
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.

At the moment, Autosummary's toctree directive is always relative to the current file. This means that the generated files always move with the file that contains an toctree-creating autosummary directive. In our case, we'd like to universally put the generated files into one separate folder at the documentation root, regardless of where they were generated from. This is particularly a problem when dealing with recursive autosummary generations, and at the moment is effectively limiting us to our manual documentation all having a flat folder structure.

Describe the solution you'd like

Perhaps a leading os.sep on the toctree directory could be interpreted as relative to the base documentation directory?

Describe alternatives you've considered

Nothing much short of leaving all our documentation in a flat structure / moving all the generated files to be next to the file that generated them.

Additional context

None.

(edit: I'd be happy to do this myself if it's an acceptable direction)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the autosummary directive's toctree handling and how generated-file paths are resolved relative to the current file. Check how the base documentation directory is represented during recursive generation, then add coverage for a leading / while confirming ordinary relative paths remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.