Teak is a utility generate a Markdown reference documentation for PHP projects, optimized for WordPress.
It can generate documentation for
- Reference pages for your classes and global functions that follow the WordPress PHP Documentation Standards
- Reference for WordPress action and filters hooks that follow the Inline Documentation Standards for Actions and Filters.
You could use documentation generated by Teak to create a documentation website when you use it in combination with a static site generator.
You can install the package with Composer:
composer require timber/teak
Use a folder as the input
./vendor/timber/teak/teak generate:class-reference ../timber/lib --output ./content/reference
This searches all the classes in ../timber/lib
and outputs the Markdown files into ./content/reference
.
Use a single file
./vendor/timber/teak/teak generate:class-reference ../timber/lib/Post.php --output ./content/reference
The Hook Reference Generator will search all the files and output one single file, with all the hooks found.
./vendor/timber/teak/teak generate:hook-reference ../timber/lib --output ./content/hooks --hook_type=filter
./vendor/timber/teak/teak generate:hook-reference ../timber/lib --output ./content/hooks --hook_type=action
An element (class, method, property) is ignored when one of the following conditions applies:
- No DocBlock is provided
- No
@api
tag is present - An
@ignore
tag is present - An
@internal
tag is present - The visibility is
private
(applies to methods only)
This means that for Markdown files to be generated at all, you’ll need at least a DocBlock on a class, with an @api
tag.
/**
* Class MyPublicClass
*
* @api
*/
class MyPublicClass {
}
This Compiler is not a full implementation of phpDocumentor. Rather, it tries to make code documentation that follows the WordPress PHP Documentation Standards readable for everyone. Not all official tags are considered yet. Contributions are welcome.
- CLI: accept a list of files.
- Optimize linking between Markdown documents.