References before the first section of a file are mangled
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 355
- Forks
- 181
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 3
Description
Hello,
I found a similar issue to #214 which has already been fixed. I believe the trigger is when the reference appears before the first section of the document. The following image illustrates the problem, and I have modified the standalone example in #214 to show the new issue.

The test case is attached as: numpydoctest.zip
The command given to reproduce the error is
sphinx-build -b singlehtml -d _build/doctrees . _build/singlehtml
I checked out 0.9.2 and 0.8.0 as well, both have the still have the issue so I don't think this is a regression. I also checked the issue is reproducible on the latest master commit.
Sincerely,
Caleb
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached numpydoctest.zip and reproduce the issue using sphinx-build -b singlehtml -d _build/doctrees . _build/singlehtml. Compare the behavior with issue #214 and trace how references before the first section are handled. Done means those references render correctly in the generated single-page HTML.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100