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/teakUse a folder as the input
./vendor/timber/teak/teak generate:class-reference ../timber/lib --output ./content/referenceThis 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/referenceThe 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=actionAn element (class, method, property) is ignored when one of the following conditions applies:
- No DocBlock is provided
- No
@apitag is present - An
@ignoretag is present - An
@internaltag 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.