How can I link / link to another reST file in the documentation?

I just don't know how I can link to another document in the reST file.

I want to link a file called install.rst with my quick start guide in a paragraph. I do not know how I can achieve this.

Please also refer to a great resource where I can find syntax for relaxing. A quick start by default is a little boring and does not require much discussion of the depth of using rest with sphinx.

Doc in question: http://todx.rtfd.io

+21
source share
4 answers

To transfer other files, I had to include the following in conf.py I took the code from the Pillow docs (PIL fork) here .

 extensions = ['sphinx.ext.intersphinx'] 

I think the inter-sphinx extension came to my aid. It is linked through other pages of the document.

-2
source

To create links between different reStructuredText (.rst) files, you can use the built-in markup provided by sphinx. See Documentation under Cross-References.

at the top of the file you define its label

 .. _my-reference-label: 

then you can link to it from other documents using

 :ref:'my-reference-label'. 

I do not believe that you need to use the intersphinx extension, as it is intended for links between different projects. Using this method, you can link different RST files using their relative paths, as described in the documentation link above.

+18
source

I am writing a link to another document using this:

 :doc:'my document <../my_doc>' 

../my_doc is the path to my my_doc.rst file.

I also have the inter-sphinx extension in my conf.py file

 extensions = ['sphinx.ext.intersphinx'] 
+11
source

By simplifying @ eme-eme's answer, you can simply do:

 :doc:'path/to/document' 

You do not need to enclose the path in <> and provide text to display. In this case, the top-level title from the referenced document will be displayed as a link.

You do not need an extension between the sphinxes for this.

0
source

All Articles