Skip to content

Latest commit

 

History

History
77 lines (50 loc) · 2.66 KB

README.md

File metadata and controls

77 lines (50 loc) · 2.66 KB

Teak

Teak is a utility generate a Markdown reference documentation for PHP projects, optimized for WordPress.

It can generate documentation for

You could use documentation generated by Teak to create a documentation website when you use it in combination with a static site generator.

Installation

You can install the package with Composer:

composer require timber/teak

Usage

Generate a class reference

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

Generate a hooks 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

Ignoring Structural Elements

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 {
    
}

Limitations

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.

Roadmap

  • CLI: accept a list of files.
  • Optimize linking between Markdown documents.