11

I need to create one sphinx project for each module,

and each module share some common rsts, like company info, license, etc.

My project tree is like this:

./conf.py
./index.rst
./intro.rst
./about.rst

./device1/conf.py
./device1/index.rst 

I write this in ./device1/index.rst, and it is not worked, how could I import parent rst files?

.. toctree::
   :maxdepth: 1

   ../intro
   ../about
mzjn
  • 48,958
  • 13
  • 128
  • 248
linjunhalida
  • 4,538
  • 6
  • 44
  • 64

2 Answers2

11

I found a way to do this:

.. include:: ../intro.rst

but it will include all the texts... maybe it is the only way?

linjunhalida
  • 4,538
  • 6
  • 44
  • 64
  • Check out [this StackOverflow answer](http://stackoverflow.com/a/17217041/1398841) for a slightly more verbose answer. – phoenix Nov 18 '15 at 13:53
  • 1
    To include only part of the README.rst: https://muffinresearch.co.uk/selectively-including-parts-readme-rst-in-your-docs/ – ederag Jan 21 '18 at 19:38
0

I personally couldn't figure out how to modify the source search path, so I ended up modifying the make file to create symlinks for all *.rst files in the sphinx build directory.

foreach f ( `\ls OTHER_DIR | egrep '.rst$$'` ) \
    ln -s -f $$f BUILD_DIR \
end

(This presumes you're using Linux/Unix.)

Ross Rogers
  • 23,523
  • 27
  • 108
  • 164