sphinx-doc / sphinx-doc/sphinx
autosummary wrongly processes "autosummary directive" inside code-blocks
Open
Nobody has claimed this yet.
extensions:autosummary
type:bug
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
autosummary wrongly processes "autosummary directive" inside code-blocks
To Reproduce
::
.. autosummary::
:toctree: generated
unknown
$ make clean html
Removing everything under '_build'...
Running Sphinx v3.1.0+/d68aa335c
making output directory... done
[autosummary] generating autosummary for: generated/example.Foo.Bar.rst, generated/example.Foo.rst, index.rst
WARNING: [autosummary] failed to import 'unknown': no module named unknown
...
Expected behavior
Should not process.
Your project
N/A
Screenshots
N/A
Environment info
- OS: Mac
- Python version: 3.8.2
- Sphinx version: 3.1.0dev
- Sphinx extensions: sphinx.ext.autosummary
- Extra tools: No
Additional context
N/A
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
Reproduce the issue with the shown reStructuredText snippet using the sphinx.ext.autosummary extension and make clean html. Trace how the autosummary directive is detected inside a code block, then add a regression test showing it is ignored and confirm the build no longer attempts to import unknown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100