Introduction
SassDoc is doing quite a lot of things under the hood. In most cases, you won’t have to know anything about it but if you are willing to write your own theme, you might need to understand what’s going on. Especially, you’ll need to know what is being returned to the view so that you can actually write your templates.
Clarification: in the following examples, we are using C-style comments but it works exactly the same for inline comments as well. Please refer to the Annotations page for the syntax.
Note: you can run SassDoc in parse mode with the --parse
CLI flag to output the data as JSON instead of generating a documentation directory.
Terminology
SassDoc uses the word “item” to describe either a variable, a function, a mixin or a placeholder. Technically speaking, an “item” is an object composed of:
- a description defined at the top of the related documentation block comment, before any annotation;
- a context, which is a sub-object containing the item’s name, its type (function, variable, mixin, placeholder), the lines at which it has been found in the file, and the its inner code (inside the declaration braces / variable content);
- annotations: both those declared in the related documentation block comment, and those omitted with a default value.
Sorting
SassDoc will collect all these item in an array and sort them by group, alphabetic file path, and position in file.
@access
Will just return the string after the annotation as the access level.
An item will look like this:
@alias
Will list the alias in the alias
key and add the alias item to the aliased
key in the referenced item.
Item alias-for-other-item
:
Item other-item
will look like this:
@author
An item will look like this:
@content
An item will look like this:
@deprecated
An item will look like this:
@example
An item will look like this:
@group
An item will look like this:
@ignore
This line will be just ignored.
An item will look like this:
@link (synonym: @source)
An item will look like this:
@output (synonym: @outputs)
An item will look like this:
@parameter (synonyms: @param, @arg, @argument)
An item will look like this:
@property (synonym: @prop)
@require (synonym: @requires)
The required item will automatically have a key named usedBy
containing the whole referencing item.
An item will look like this:
The referenced item will have a usedBy
key that looks like:
@return (synonym: @returns)
An item will look like this:
@since
Describes the version at which the documented item has been implemented or updated.
An item will look like this:
@throw (synonym: @throws, @exception)
An item will look like this:
@todo
An item will look like this:
@type
An item will look like this: