Including code files and partial RST content¶
:include:
for concatenating RST for rendering¶
Code:
.. include:: partials/example-inclusion.rstinc
Rendered:
------------30--------------------------------
Hello, this is that sample partial inclusion file!…which you can find here:partials/example-inclusion.rstinc
------------30--------------------------------
Reference: https://docutils.sourceforge.io/docs/ref/rst/directives.html#include
:literalinclude:
for including file as code block¶
Code:
.. literalinclude:: partials/example-inclusion.rstinc
:language: rst
Rendered:
| ``------------30--------------------------------`` | **Hello**, this is that sample partial inclusion file! | ...which you can find here: :download:`partials/example-inclusion.rstinc` | ``------------30--------------------------------``
Reference: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-literalinclude
Excerpt files for code blocks¶
.. literalinclude:: TODOTODO.y
:language: python
:emphasize-lines: 3,6-8
:linenos: