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 Rendering the documentation with Docker has more information on how this toolchain is set up and configured.
Using the documentation-draft branch to preview changes¶
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
Documentationdirectory, 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 Documentation/Settings.cfg is up to date. (required)
- A .gitignore is useful, in order to
prevent accidentally committing the generated documentation in
Documentation-GENERATED-tempto 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.
composer.jsonas described in composer.json.
Settings.cfgas described in Documentation/Settings.cfg.
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.
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.