Headings optionsยค
heading_level
ยค
- Type
int
2
The initial heading level to use.
When injecting documentation for an object, the object itself and its members are rendered. For each layer of objects, we increase the heading level by 1.
The initial heading level will be used for the first layer. If you set it to 3, then headings will start with <h3>
.
If the heading for the root object is not shown, then the initial heading level is used for its members.
plugins:
- mkdocstrings:
handlers:
matlab:
options:
heading_level: 2
::: matlab_callable
options:
heading_level: 3
Source files
๐ +mynamespace
โโโ ๐ readme.md
โโโ ๐ classA.m
โโโ ๐ classB.m
โโโ ๐ typed_function.m
This is the docstring for mynamespace.
classdef classA
% Docstring of class A.
methods
function obj = method_a(inputArg1)
% Docstring of the method.
end
end
end
classdef classB
% Docstring of class B.
properties
prop_b % Docstring of the property.
end
methods
function obj = method_b(inputArg1)
% Docstring of the method.
end
end
end
function output = typed_function(input, options)
% Example function with typed inputs and outputs
arguments (Input)
input (1,1) string % The input variable
options.keyword (1,1) double = 0 % An optional keyword argument
end
arguments (Output)
output (1,:) char % The output variable
end
output = char(input);
end
Preview
mynamespace
(3)
Docstring of the package namespace.
ClassA
(4)
Docstring of class A.
ClassB
(4)
Docstring of class B.
myfunction
(5)
Docstring of the function.
Docstring of the package namespace.
ClassA
(3)
Docstring of class A.
ClassB
(3)
Docstring of class B.
myfunction
(4)
Docstring of the function.
parameter_headings
ยค
- Type
bool
False
Whether to render headings for function/method parameters.
With this option enabled, each function/method parameter (including parameters of the constructor methods merged in their parent class with the merge_constructor_into_class
option) gets a permalink, an entry in the Table of Contents, and an entry in the generated objects inventory. The permalink and inventory entry allow cross-references from internal and external pages.
The identifier used in the permalink and inventory is of the following form: path.to.function(param_name)
. To manually cross-reference a arameter, you can therefore use this Markdown syntax:
- Class parameter: [`param`][package.module.Class(param)]
- Method parameter: [`param`][package.module.Class.method(param)]
- Function parameter: [`param`][package.module.function(param)]
- Variadic positional parameters: [`*args`][package.module.function(*args)]
- Variadic keyword parameters: [`**kwargs`][package.module.function(**kwargs)]
plugins:
- mkdocstrings:
handlers:
matlab:
options:
parameter_headings: false
::: matlab_callable
options:
parameter_headings: true
Source files
๐ +mynamespace
โโโ ๐ readme.md
โโโ ๐ classA.m
โโโ ๐ classB.m
โโโ ๐ typed_function.m
This is the docstring for mynamespace.
classdef classA
% Docstring of class A.
methods
function obj = method_a(inputArg1)
% Docstring of the method.
end
end
end
classdef classB
% Docstring of class B.
properties
prop_b % Docstring of the property.
end
methods
function obj = method_b(inputArg1)
% Docstring of the method.
end
end
end
function output = typed_function(input, options)
% Example function with typed inputs and outputs
arguments (Input)
input (1,1) string % The input variable
options.keyword (1,1) double = 0 % An optional keyword argument
end
arguments (Output)
output (1,:) char % The output variable
end
output = char(input);
end
Preview: Cross-references
::: mynamespace.typed_function
options:
parameter_headings: true
::: mynamespace.typed_function
options:
parameter_headings: false
mynamespace.typed_function(input, /, *, keyword=0)
ยค
Example function with typed inputs and outputs
Parameters:
-
input
(string
) โThe input variable
Name-Value Arguments:
-
keyword
(double
) โAn optional keyword argument
Returns:
-
output
(char
) โThe output variable
Preview: Parameter sections
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
string
|
The input variable |
required |
Name-Value Arguments:
Name | Type | Description |
---|---|---|
keyword |
double
|
An optional keyword argument |
Parameters:
-
input
ยคstring
) โThe input variable
Name-Value Arguments:
-
keyword
(double
) โAn optional keyword argument
PARAMETER | DESCRIPTION |
---|---|
|
The input variable
TYPE:
|
NAME-VALUE ARGUMENTS | DESCRIPTION |
---|---|
keyword |
An optional keyword argument
TYPE:
|
Preview: Table of contents (with symbol types)
typed_function
input
show_root_heading
ยค
- Type
bool
False
Show the heading of the object at the root of the documentation tree (i.e. the object referenced by the identifier after :::
).
It is pretty common to inject documentation for one module per page. Since each page already has a title, usually being the module's name, we can spare one heading level by not showing the heading for the module itself (heading levels are limited to 6 by the HTML specification).
Sparing that extra level can be helpful when your objects tree is deeply nested (e.g. method in a class in a class in a module). If your objects tree is not deeply nested, and you are injecting documentation for many different objects on a single page, it might be preferable to render the heading of each object.
plugins:
- mkdocstrings:
handlers:
matlab:
options:
show_root_heading: false
::: mynamespace.ClassA
options:
show_root_heading: true
::: mynamespace.ClassB
options:
show_root_heading: true
Source files
๐ +mynamespace
โโโ ๐ readme.md
โโโ ๐ classA.m
โโโ ๐ classB.m
โโโ ๐ typed_function.m
This is the docstring for mynamespace.
classdef classA
% Docstring of class A.
methods
function obj = method_a(inputArg1)
% Docstring of the method.
end
end
end
classdef classB
% Docstring of class B.
properties
prop_b % Docstring of the property.
end
methods
function obj = method_b(inputArg1)
% Docstring of the method.
end
end
end
function output = typed_function(input, options)
% Example function with typed inputs and outputs
arguments (Input)
input (1,1) string % The input variable
options.keyword (1,1) double = 0 % An optional keyword argument
end
arguments (Output)
output (1,:) char % The output variable
end
output = char(input);
end
Preview
show_root_toc_entry
ยค
- Type
bool
True
If the root heading is not shown, at least add a ToC entry for it.
If you inject documentation for an object in the middle of a page, after long paragraphs, and without showing the root heading, then you will not be able to link to this particular object as it won't have a permalink and will be "lost" in the middle of text. In that case, it is useful to add a hidden anchor to the document, which will also appear in the table of contents.
In other cases, you might want to disable the entry to avoid polluting the ToC. It is not possible to show the root heading and hide the ToC entry.
plugins:
- mkdocstrings:
handlers:
matlab:
options:
show_root_toc_entry: true
## Some heading
Lots of text.
::: matlab_callable
options:
show_root_toc_entry: false
## Other heading.
More text.
Preview
::: matlab_callable
options:
show_root_toc_entry: true
Table of contents
Some heading
matlab_callable
Other heading
::: matlab_callable
options:
show_root_toc_entry: false
Table of contents
Some heading
Other heading
show_root_full_path
ยค
- Type
bool
True
Show the full namespace path for the root object heading.
The namespace path of a MATLAB object is the dot-separated list of names under which it is accessible, for example namespace.Class.method
.
With this option you can choose to show the full path of the object you inject documentation for, or just its name. This option impacts only the object you specify, not its members. For members, see the two other options show_root_members_full_path
and show_object_full_path
.
plugins:
- mkdocstrings:
handlers:
matlab:
options:
show_root_full_path: true
::: mynamespace.classA
options:
show_root_full_path: false
Source files
๐ +mynamespace
โโโ ๐ readme.md
โโโ ๐ classA.m
โโโ ๐ classB.m
โโโ ๐ typed_function.m
This is the docstring for mynamespace.
classdef classA
% Docstring of class A.
methods
function obj = method_a(inputArg1)
% Docstring of the method.
end
end
end
classdef classB
% Docstring of class B.
properties
prop_b % Docstring of the property.
end
methods
function obj = method_b(inputArg1)
% Docstring of the method.
end
end
end
function output = typed_function(input, options)
% Example function with typed inputs and outputs
arguments (Input)
input (1,1) string % The input variable
options.keyword (1,1) double = 0 % An optional keyword argument
end
arguments (Output)
output (1,:) char % The output variable
end
output = char(input);
end
Preview
show_root_members_full_path
ยค
- Type
bool
False
Show the full namespace path of the root members.
This option does the same thing as show_root_full_path
, but for direct members of the root object instead of the root object itself.
To show the full path for every member recursively, see show_object_full_path
.
plugins:
- mkdocstrings:
handlers:
matlab:
options:
show_root_members_full_path: true
::: mynamespace.classA
options:
show_root_members_full_path: false
Source files
๐ +mynamespace
โโโ ๐ readme.md
โโโ ๐ classA.m
โโโ ๐ classB.m
โโโ ๐ typed_function.m
This is the docstring for mynamespace.
classdef classA
% Docstring of class A.
methods
function obj = method_a(inputArg1)
% Docstring of the method.
end
end
end
classdef classB
% Docstring of class B.
properties
prop_b % Docstring of the property.
end
methods
function obj = method_b(inputArg1)
% Docstring of the method.
end
end
end
function output = typed_function(input, options)
% Example function with typed inputs and outputs
arguments (Input)
input (1,1) string % The input variable
options.keyword (1,1) double = 0 % An optional keyword argument
end
arguments (Output)
output (1,:) char % The output variable
end
output = char(input);
end
Preview
::: mynamespace.classA
options:
show_root_members_full_path: true
show_object_full_path
ยค
- Type
bool
False
Show the full namespace path of every object.
Same as for show_root_members_full_path
, but for every member, recursively. This option takes precedence over show_root_members_full_path
:
show_root_members_full_path |
show_object_full_path |
Direct root members path |
---|---|---|
False | False | Name only |
False | True | Full |
True | False | Full |
True | True | Full |
plugins:
- mkdocstrings:
handlers:
matlab:
options:
show_object_full_path: true
::: +mynamespace
options:
show_object_full_path: false
Preview
::: +mynamespace
options:
show_object_full_path: true
mynamespace
ยค
This is the docstring for mynamespace.
mynamespace.classB
ยค
mynamespace.classA
ยค
Docstring of class A.
mynamespace.classA.method_a()
ยค
Docstring of the method.
mynamespace.typed_function(input, /, *, keyword=0)
ยค
Example function with typed inputs and outputs
Name-Value Arguments:
Name | Type | Description |
---|---|---|
keyword |
double
|
An optional keyword argument |
show_category_heading
ยค
- Type
bool
False
When grouped by categories, show a heading for each category. These category headings will appear in the table of contents, allowing you to link to them using their permalinks.
Not recommended with deeply nested object
When injecting documentation for deeply nested objects, you'll quickly run out of heading levels, and the objects at the bottom of the tree risk all getting documented using H6 headings, which might decrease the readability of your API docs.
plugins:
- mkdocstrings:
handlers:
matlab:
options:
group_by_category: true
show_category_heading: true
::: matlab_callable
options:
group_by_category: true
show_category_heading: false
Source files
๐ +mynamespace
โโโ ๐ readme.md
โโโ ๐ classA.m
โโโ ๐ classB.m
โโโ ๐ typed_function.m
This is the docstring for mynamespace.
classdef classA
% Docstring of class A.
methods
function obj = method_a(inputArg1)
% Docstring of the method.
end
end
end
classdef classB
% Docstring of class B.
properties
prop_b % Docstring of the property.
end
methods
function obj = method_b(inputArg1)
% Docstring of the method.
end
end
end
function output = typed_function(input, options)
% Example function with typed inputs and outputs
arguments (Input)
input (1,1) string % The input variable
options.keyword (1,1) double = 0 % An optional keyword argument
end
arguments (Output)
output (1,:) char % The output variable
end
output = char(input);
end
Preview
::: +mynamespace
options:
group_by_category: true
show_category_heading: true
::: +mynamespace
options:
group_by_category: true
show_category_heading: false
show_symbol_type_heading
ยค
- Type
bool
False
Show the symbol type in headings.
This option will prefix headings with
,
,
,
or
types.
See also
show_symbol_type_toc
.
plugins:
- mkdocs-material-matlab # (1)
- mkdocstrings:
handlers:
matlab:
options:
show_symbol_type_heading: true
- When using material theme, make sure to also enable the plugin
mkdocs-material-matlab
such that the right heading types are displayed. Otherwise,will be shown as
attr
andwill be shown as
mod
, as the mkdocstrings-matlab plugin is reusing assets from mkdocstrings-python.
::: matlab_callable
options:
show_symbol_type_heading: false
Source files
๐ +mynamespace
โโโ ๐ readme.md
โโโ ๐ classA.m
โโโ ๐ classB.m
โโโ ๐ typed_function.m
This is the docstring for mynamespace.
classdef classA
% Docstring of class A.
methods
function obj = method_a(inputArg1)
% Docstring of the method.
end
end
end
classdef classB
% Docstring of class B.
properties
prop_b % Docstring of the property.
end
methods
function obj = method_b(inputArg1)
% Docstring of the method.
end
end
end
function output = typed_function(input, options)
% Example function with typed inputs and outputs
arguments (Input)
input (1,1) string % The input variable
options.keyword (1,1) double = 0 % An optional keyword argument
end
arguments (Output)
output (1,:) char % The output variable
end
output = char(input);
end
Preview
::: +mynamespace
options:
show_symbol_type_heading: true
show_symbol_type_toc
ยค
- Type
bool
False
Show the symbol type in the Table of Contents.
This option will prefix items in the ToC with
,
,
,
or
types.
See also
show_symbol_type_heading
.
plugins:
- mkdocs-material-matlab # (1)
- mkdocstrings:
handlers:
matlab:
options:
show_symbol_type_toc: true
- When using material theme, make sure to also enable the plugin
mkdocs-material-matlab
such that the right heading types are displayed. Otherwise,will be shown as
attr
andwill be shown as
mod
, as the mkdocstrings-matlab plugin is reusing assets from mkdocstrings-python.
::: matlab_callable
options:
show_symbol_type_toc: false
Preview
namespace
function
Class
method
property
- namespace
- function
- Class
- method
- property