-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
This issue might be an x-y problem, and there might be a better solution. Let me explain what I am trying to do first.
I want to build multiple manuals that have sections in common. Imagine modules with the same safety warnings, for example. I would like to include the common sections in multiple places, so they can be reused. However, I have been stumped on how to include these files properly.
My understanding is that Sphinx is not intended for multiple manuals in one folder (as noted by @tk0miya here), but copying the content would be bad, and this SO question implies that my use case (and confusion) is not rare, and people have come up with many different workarounds.
I thought that the best solution would be a single source directory containing all the content, and subfolders with a conf file declaring the top-level index
of each manual. However, I realized that each node can only have one section number, which will be displayed wherever it is included. For files that are included in multiple locations, one of the numbers will usually be wrong. Here is a minimal example producing this output:
I have considered these alternatives:
- Using the
include
directive, but this breaks relative image links - Symlinking, but this has the same drawbacks and more (not platform-agnostic, seems hacky and not scalable)
- Using tags to disable section numbering, but the doc states that it's not possible
- Intersphinx, but this does not allow including whole files
- Ditching Sphinx and using DITA Open Toolkit instead, but this would sacrifice tools like
autodoc
/autoapi
It would be great if Sphinx assigned the section number on-the-fly, depending on the position in the ToC hierarchy. More generally, it would be great if managing multiple manuals/documentations with overlapping contents was supported -- it surprised me that all documents are compiled, instead of only the ones that are needed for root_doc
.
My questions are:
- Is there an accepted method to achieve what I am trying to with Sphinx, and what is it?
- How much development effort would it take to fix the section numbering issue?
- How much would it take to support multiple manuals built from the same source?
I am open to investing some cycles into contributing back, but I would first like to make sure that the direction is good and that changes can be merged down the line. Sponsorship or setting a bounty are an option as well. Thanks for discussing.
Related:
- Including rst in toctree multiple times not possible with latex builder #5145 mentioning problems with latex, and the comment by @tk0miya mentioned earliear
- Custom section numbering (Letters, numbers) #6614 deals with numbering, but not this problem
- This SO question