How to document an extension¶
This chapter explains how to write documentation for a new extension.
This guide uses the example extension manual as a template for starting out. It contains a working navigation panel, a range of example content and adheres to the guidelines laid out in the Documentation content style guide chapter.
Rendering the documentation locally¶
Docker is required to run the rendering toolchain locally. By rendering the documentation this way, proofreading and checking for typos and testing links can be carried out before the documentation is committed. The How to render documentation has more information on how this toolchain is set up and configured.
Using the documentation-draft branch to preview changes¶
Alternatively, a documentation-draft
branch can be created in the documentation repository.
Once committed, this will render the documentation and make it available publicly, but it will only be visible
when the "draft" drop-down is selected when viewing the rendered documentation. Documentation under the draft branch will not be indexed
by search engines. Visit the Supported branches section for more information.
Creating extension documentation using the sample manual¶
Clone the sample extension manual
In a temporary directory, clone the GitHub project sample extension manual
git clone https://github.com/TYPO3-Documentation/TYPO3CMS-Example-ExtensionManual.git
Copy the entire
Documentation
directory, so that it is a subdirectory located within your extension, for example:cp -r TYPO3CMS-Example-ExtensionManual/Documentation <my-extension-directory>/
Add or modify additional files
Make sure composer.json is up to date. (required)
Make sure Settings: Documentation/Settings.cfg is up to date. (required)
A .gitignore is useful, in order to prevent accidentally committing the generated documentation in
Documentation-GENERATED-temp
to the Git repository. (recommended)An .editorconfig is useful, so the recommended Coding Guidelines will be used within an editor or IDE. EditorConfig Plugin contains further information for PhpStorm users. (recommended)
# cp .gitignore (make sure you don't accidentally overwrite existing one though!) cp -n TYPO3CMS-Example-ExtensionManual/.gitignore <my-extension-directory>/.gitignore # cp .editorconfig (make sure you don't accidentally overwrite existing one though!) cp -n TYPO3CMS-Example-ExtensionManual/.editorconfig <my-extension-directory>/.editorconfig
If you plan to host your extension on a public repository, consider adding a CONTRIBUTING.rst and README.rst to help guide any future contributors.
Start adding documentation
Now it's time to start adding content. Reviewing existing guides can help you structure your own documentation. The news extension is a strong example of how extension documentation should be written and structured.
Populate composer.json
Complete the
composer.json
as described in composer.json.Populate Settings.cfg
Complete the
Settings.cfg
as described in Settings: Documentation/Settings.cfg.Render documentation
Before publishing changes, make sure the documentation is rendered correctly, either by rendering it locally or by using the draft branch to preview the changes.
Publish when ready
The documentation needs to be made publicly available.
In order to trigger the documentation rendering process, a webhook needs to be added.
Tip
Consider hosting your extension repository on either GitHub, Bitbucket or GitLab. That way others can report issues and assist you by creating change requests to help improve both the extensions documentation and the code.