-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
include directive does not comply with specification #9269
Comments
May I ask if this isn't considered to be a bug. I would be happy to contribute if anybody would reply on the desired behaviour. |
We've been discussing this on the Docutils tracker as for multi-file projects it may be more desirable to have a 'include root' which specifies the root from which files are to be included from. Sphinx implicitly uses the project root as the 'include root', a side effect of the implementation details of Sphinx and Docutils. Given we are somewhat likely to change the specification in Docutils, I would say that this is not a bug and that when possible Sphinx will make this more explicit by setting the include root. A |
Hi A Thank you for the response. Although I'm somewhat disheartened to here it. If I understand you correctly this will imply that for every file you have to know in which context it is (the path from the 'include root'). I prefer the way docutils is handeling it currently, so that any include (also images) is relative to the current file location. My reasoning:
The include behaviour you are describing is (again, I hope I understood you correctly), similar as asciidoctor with antora or latex is following. And I have the same gripe with them (at least in LaTeX there is a workaround with environment variables) I'm sure you have reasons for the path you are following, and you might find reasons why my suggestion has its flaws. Could you point out where my proposals fail, or if it might be possible to make Sphinx configurable to allow for both behaviors. Regards and utter most respect for the great work on Sphinx |
Describe the bug
The specification for the included directive from https://docutils.sourceforge.io/docs/ref/rst/directives.html states
To Reproduce
Steps to reproduce the behavior:
Given following directory structure:
With file contents:
foo.rst
.. include:: bar/bar.rst
bar/bar.rst
bar/here.rst
bar/there/file.rst
Expected behavior
docutils rst2html will correctly include file.rst whereas sphinx doesn't find the file as it will search for it in
<root>/there/
instead of<root>/bar/there
Your project
Link to your sphinx project, or attach zipped small project sample.
demo.zip
Screenshots
Docutils output:
Sphinx output:
Environment info
Additional context
The text was updated successfully, but these errors were encountered: