Search code examples
python-sphinxrestructuredtext

It is possible to import text from reStructuredText File and put into other file?


I have two files engine.rst and car.rst In the file engine.rst

|
Engine
======
V8 Engine with turbo

file car.rst

.. _Engine: engine.rst
|

Car
======
Ford Mustang

Engine
------
`Engine`_

I would like to have the content of engine.rst in car.rst because I need to use engine.rst in several files


Solution

  • Finally I could add the text including the other file, but the file had to be .txt to avoid warnings so my code was as follows:

    file car.rst

    |
    
    Car
    ======
    Ford Mustang
    
    Engine
    ------
    .. include:: engine.txt