Note
This version of the guide covers the new PHP-based rendering of Documentation with the TYPO3 Documentation theme.
If the project you are looking at has a file Documentation/guides.xml it is using the new rendering.
Otherwise, consider to migrate the Documentation or head over to the legacy version of this guide: How to document, Sphinx based.
Including files
Includes can be used for two use cases in the documentation: Repeating text snippets used in several places or breaking up long pages into easier to edit subparts.
Some documentation projects have the same snippet of text appear in several places. This text can be maintained once and included in many places.
In this case it may make sense to include text snippets. The .. include:: some
directive does this.
Files to be included cannot lie outside the Documentation
folder.
They may not end on .rst
. By convention they should end on .rst.
.
Table of contents
Example of a simple include:
Include the same text asking for contributions in all Events that do not have an example yet:
Example
=======
.. include:: /_includes/EventsContributeNote.rst.txt
Example
=======
.. include:: /_includes/EventsContributeNote.rst.txt
The file to be included:
.. note::
Currently, we do not have an example for this event. If you can provide a
useful one, please open an issue ...
These rst definitions will be included in all places the include is used as if they had been written directly into the rst file. All markup is respected.
Example: Break up a large file into manageable pieces
In places like the TSconfig reference or TCA reference it is helpful to display all properties of an element on one page. However this gives the contributors very large rst files to maintain. Such files can be broken into pieces that contain only the definition and maybe example of one parameter each.
Properties of the TCA column type `category`
============================================
.. confval-menu::
:display: table
:type:
:Scope:
.. include:: _Properties/_Default.rst.txt
:show-buttons:
.. include:: _Properties/_ExclusiveKeys.rst.txt
:show-buttons:
.. include:: _Properties/_ForeignTable.rst.txt
:show-buttons:
Each include file in turn contains the complete data for one property, for example:
.. _columns-category-properties-exclusivekeys:
.. confval:: exclusiveKeys
:name: category-exclusiveKeys
:type: string (list of)
List of keys that exclude any other keys ...
The option :show-
display a special "Edit on GitHub" button only for
the section contained within include:
Properties
[content]
-
- Type
- string, local file path, relative or absolute
Path to the file to be included. Can be relative or absolute.
.. include:: /some/absolute/path/_includes/_SomeFile.rst.txt .. include:: ../_includes/_SomeFile.rst.txt
Copied!The path is calculated starting from the
Documentation
directory. It is not possible to include files from different locations in an extension.
:show-buttons:
-
- Type
- string, local file path, relative or absolute
If set an edit on GitHub Button is displayed if the edit-on-github workflow is enabled in the guides.xml. In future other buttons might be displayed if configured in the guides.xml.