Markups

Markups can be used inside the documentation files to acces the source code. A markup consists of a function call inside double curly braces.

{{ someFunction() }}

Parameters

Unlike normal function calls, the parameters must be named:

{{ someFunction(someNumber: 5) }} // correct
{{ someFunction(5) }} // fails!

The following parameter types are supported:

Return value

The return value of the markup function should be a string. It replaces the markup in the generated documentation.

If the return value is an array, it is converted to a string containing one line per array value.

If the return value is an object of \CodeDocs\Type\Parsable it is parsed again so markups are replaced there as well.

Functions

CodeDocs comes with some built-in markup functions by default. You can also register your own functions in the configuration.

Here's a list of all default available functions:

Name Description
classes() Returns a list of classes matching the given criteria.
codeSnippet() Returns a code snippet of a class, method or class member.
constants() Returns a list of class constants.
defaultValue() Returns the default value of a class member or method param.
docComment() Returns the doc comment of a class, method or class member.
file() Returns the path either of the current file or of a class.
fileContent() Returns the content of a file.
join() Joins an array to one string.
jsonValue() Returns a value from a json file.
methodParamsTable() Creates a markdown table of method params.
param() Returns a param from the configuration.
parse() Parse a string to replace markups.
relpath() Returns a path relative to the baseDir.
list() Renders a list of the given array.
replace() Replaces strings in the given text.
shortName() Returns the class name without namespace.
split() Splits a string.
table() Creates a markdown table.
topic() Returns a topic created by the Topic-Annotation.