-
Notifications
You must be signed in to change notification settings - Fork 306
How to write comments so Pinocchio formatter will pretty print them
We'll use the Pinocchio for really pretty literary API documentation.
It uses Markdown as the parser for comments, and it highlights the phpDocumentor's tags, too. So, if you still don't know how to mark up the text in Markdown, go and read the page behind this link, really.
Here are the most important caveats and hints:
-
Every file gets the first-level header with the name of file without extension.
-
It's cool to have the second-level header with the name of class before the class declaration.
-
It's even more cool to have the third-level header with the name of method before the public methods declaration. It's not important to have headers on private and protected methods, they are ideologically helpers.
-
One can format the second-level header in comments as follows:
/* *## I'm a second-level header! *### I'm a third-level header! Note the absence of space between the asterisk and the sharp sign! */
-
You can turn any URL string into a link by enclosing it between angle brackets.
-
You can turn any email address into a clickable safe link by enclosing it between angle brackets.
-
Empty line in comment makes the end of one paragraph and start of another. Newlines are insignificant. Note, however, that this applies only to multiline comments. Each single-line comment is treated like a separate paragraph.
-
To make it technically simple: parsing of a comment starts from the comment symbols, like this:
/** unparsable area * parsable area starting from space after asterisk * */
-
Please note that phpDocumentor's non-inline tags which are traditionally put into the PHP sources do start with a newline in processed document, so even in multiline comments you don't need to separate e. g. lists of
@param
declarations with empty lines (see p. 7 also).