Plugin flow
SearchPlugin¶
on_config¶
Add plugin templates and scripts to config.
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_pre_build¶
Create search index instance for later use.
Source
Hook info
The pre_build
event does not alter any variables. Use this event to call
pre-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_post_build¶
Build search index.
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_page_context¶
Add page to search index.
Source
Hook info
The page_context
event is called after the context for a page is created
and can be used to alter the context for that specific page only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context
|
TemplateContext
|
dict of template context variables |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
nav
|
Navigation
|
global navigation object |
required |
Returns:
Type | Description |
---|---|
TemplateContext | None
|
dict of template context variables |
on_post_build¶
Build search index.
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
AutorefsPlugin¶
on_config¶
Instantiate our Markdown extension.
Hook for the on_config
event.
In this hook, we instantiate our [AutorefsExtension
][mkdocs_autorefs.references.AutorefsExtension]
and add it to the list of Markdown extensions used by mkdocs
.
Arguments: config: The MkDocs config object.
Returns: The modified config.
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_page_markdown¶
Remember which page is the current one.
Arguments: markdown: Input Markdown. page: The related MkDocs page instance. kwargs: Additional arguments passed by MkDocs.
Returns: The same Markdown. We only use this hook to keep a reference to the current page URL, used during Markdown conversion by the anchor scanner tree processor.
Source
Hook info
The page_markdown
event is called after the page's markdown is loaded
from file and can be used to alter the Markdown source text. The meta-
data has been stripped off and is available as page.meta
at this point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
markdown
|
str
|
Markdown source text of page as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
Markdown source text of page as string |
on_page_content¶
Map anchors to URLs.
Hook for the on_page_content
event.
In this hook, we map the IDs of every anchor found in the table of contents to the anchors absolute URLs.
This mapping will be used later to fix unresolved reference of the form [title][identifier]
or
[identifier][]
.
Arguments: html: HTML converted from Markdown. page: The related MkDocs page instance. kwargs: Additional arguments passed by MkDocs.
Returns: The same HTML. We only use this hook to map anchors to URLs.
Source
Hook info
The page_content
event is called after the Markdown text is rendered to
HTML (but before being passed to a template) and can be used to alter the
HTML body of the page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
html
|
str
|
HTML rendered from Markdown source as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
HTML rendered from Markdown source as string |
on_post_page¶
Fix cross-references.
Hook for the on_post_page
event.
In this hook, we try to fix unresolved references of the form [title][identifier]
or [identifier][]
.
Doing that allows the user of autorefs
to cross-reference objects in their documentation strings.
It uses the native Markdown syntax so it's easy to remember and use.
We log a warning for each reference that we couldn't map to an URL, but try to be smart and ignore identifiers
that do not look legitimate (sometimes documentation can contain strings matching
our [AUTO_REF_RE
][mkdocs_autorefs.references.AUTO_REF_RE] regular expression that did not intend to reference anything).
We currently ignore references when their identifier contains a space or a slash.
Arguments: output: HTML converted from Markdown. page: The related MkDocs page instance. kwargs: Additional arguments passed by MkDocs.
Returns: Modified HTML.
Source
Hook info
The post_page
event is called after the template is rendered, but
before it is written to disc and can be used to alter the output of the
page. If an empty string is returned, the page is skipped and nothing is
written to disc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output
|
str
|
output of rendered template as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
str | None
|
output of rendered template as string |
MkNodesPlugin¶
on_startup¶
Activates new-style MkDocs plugin lifecycle.
Source
Hook info
The startup
event runs once at the very beginning of an mkdocs
invocation.
New in MkDocs 1.4.
The presence of an on_startup
method (even if empty) migrates the plugin to the new
system where the plugin object is kept across builds within one mkdocs serve
.
Note that for initializing variables, the __init__
method is still preferred.
For initializing per-build variables (and whenever in doubt), use the on_config
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
Literal['build', 'gh-deploy', 'serve']
|
the command that MkDocs was invoked with, e.g. "serve" for |
required |
dirty
|
bool
|
whether |
required |
on_config¶
Create the project based on MkDocs config.
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_files¶
Create the node tree and write files to build folder.
In this step we aggregate all files and info we need to build the website. This includes:
- Markdown pages (MkPages)
- Templates
- CSS files
Source
Hook info
The files
event is called after the files collection is populated from the
docs_dir
. Use this event to add, remove, or alter files in the
collection. Note that Page objects have not yet been associated with the
file objects in the collection. Use Page Events to manipulate page
specific data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
Files
|
global files collection |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
Files | None
|
global files collection |
on_nav¶
Populate LinkReplacer and build path->MkPage mapping for following steps.
Source
Hook info
The nav
event is called after the site navigation is created and can
be used to alter the site navigation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nav
|
Navigation
|
global navigation object |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Navigation | None
|
global navigation object |
on_env¶
Add our own info to the MkDocs environment.
Source
Hook info
The env
event is called after the Jinja template environment is created
and can be used to alter the
Jinja environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Environment
|
global Jinja environment |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Environment | None
|
global Jinja Environment |
on_post_build¶
Delete the temporary template files.
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_pre_page¶
During this phase we set the edit paths.
Source
Hook info
The pre_page
event is called before any actions are taken on the subject
page and can be used to alter the Page
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Page | None
|
|
on_page_markdown¶
During this phase links get replaced and jinja2
stuff get rendered.
Source
mkdocs_mknodes.plugin.MkNodesPlugin.on_page_markdown | |
---|---|
Hook info
The page_markdown
event is called after the page's markdown is loaded
from file and can be used to alter the Markdown source text. The meta-
data has been stripped off and is available as page.meta
at this point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
markdown
|
str
|
Markdown source text of page as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
Markdown source text of page as string |
on_post_build¶
Delete the temporary template files.
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
MkdocstringsPlugin¶
on_config¶
Instantiate our Markdown extension.
Hook for the on_config
event.
In this hook, we instantiate our [MkdocstringsExtension
][mkdocstrings.extension.MkdocstringsExtension]
and add it to the list of Markdown extensions used by mkdocs
.
We pass this plugin's configuration dictionary to the extension when instantiating it (it will need it later when processing markdown to get handlers and their global configurations).
Arguments: config: The MkDocs config object.
Returns: The modified config.
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_env¶
Extra actions that need to happen after all Markdown rendering and before HTML rendering.
Hook for the on_env
event.
- Write mkdocstrings' extra files into the site dir.
- Gather results from background inventory download tasks.
Source
Hook info
The env
event is called after the Jinja template environment is created
and can be used to alter the
Jinja environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Environment
|
global Jinja environment |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Environment | None
|
global Jinja Environment |
on_post_build¶
Teardown the handlers.
Hook for the on_post_build
event.
This hook is used to teardown all the handlers that were instantiated and cached during documentation buildup.
For example, a handler could open a subprocess in the background and keep it open
to feed it "autodoc" instructions and get back JSON data. If so, it should then close the subprocess at some point:
the proper place to do this is in the handler's teardown
method, which is indirectly called by this hook.
Arguments: config: The MkDocs config object. **kwargs: Additional arguments passed by MkDocs.
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_post_build¶
Teardown the handlers.
Hook for the on_post_build
event.
This hook is used to teardown all the handlers that were instantiated and cached during documentation buildup.
For example, a handler could open a subprocess in the background and keep it open
to feed it "autodoc" instructions and get back JSON data. If so, it should then close the subprocess at some point:
the proper place to do this is in the handler's teardown
method, which is indirectly called by this hook.
Arguments: config: The MkDocs config object. **kwargs: Additional arguments passed by MkDocs.
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
BlogPlugin¶
on_startup¶
Source
Hook info
The startup
event runs once at the very beginning of an mkdocs
invocation.
New in MkDocs 1.4.
The presence of an on_startup
method (even if empty) migrates the plugin to the new
system where the plugin object is kept across builds within one mkdocs serve
.
Note that for initializing variables, the __init__
method is still preferred.
For initializing per-build variables (and whenever in doubt), use the on_config
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
Literal['build', 'gh-deploy', 'serve']
|
the command that MkDocs was invoked with, e.g. "serve" for |
required |
dirty
|
bool
|
whether |
required |
on_shutdown¶
Source
Hook info
The shutdown
event runs once at the very end of an mkdocs
invocation, before exiting.
This event is relevant only for support of mkdocs serve
, otherwise within a
single build it's undistinguishable from on_post_build
.
New in MkDocs 1.4.
The presence of an on_shutdown
method (even if empty) migrates the plugin to the new
system where the plugin object is kept across builds within one mkdocs serve
.
Note the on_post_build
method is still preferred for cleanups, when possible, as it has
a much higher chance of actually triggering. on_shutdown
is "best effort" because it
relies on detecting a graceful shutdown of MkDocs.
on_config¶
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_files¶
Source
Hook info
The files
event is called after the files collection is populated from the
docs_dir
. Use this event to add, remove, or alter files in the
collection. Note that Page objects have not yet been associated with the
file objects in the collection. Use Page Events to manipulate page
specific data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
Files
|
global files collection |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
Files | None
|
global files collection |
on_nav¶
Source
Hook info
The nav
event is called after the site navigation is created and can
be used to alter the site navigation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nav
|
Navigation
|
global navigation object |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Navigation | None
|
global navigation object |
on_env¶
Source
Hook info
The env
event is called after the Jinja template environment is created
and can be used to alter the
Jinja environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Environment
|
global Jinja environment |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Environment | None
|
global Jinja Environment |
on_page_markdown¶
Source
Hook info
The page_markdown
event is called after the page's markdown is loaded
from file and can be used to alter the Markdown source text. The meta-
data has been stripped off and is available as page.meta
at this point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
markdown
|
str
|
Markdown source text of page as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
Markdown source text of page as string |
on_page_content¶
Source
Hook info
The page_content
event is called after the Markdown text is rendered to
HTML (but before being passed to a template) and can be used to alter the
HTML body of the page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
html
|
str
|
HTML rendered from Markdown source as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
HTML rendered from Markdown source as string |
on_page_context¶
Source
Hook info
The page_context
event is called after the context for a page is created
and can be used to alter the context for that specific page only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context
|
TemplateContext
|
dict of template context variables |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
nav
|
Navigation
|
global navigation object |
required |
Returns:
Type | Description |
---|---|
TemplateContext | None
|
dict of template context variables |
on_shutdown¶
Source
Hook info
The shutdown
event runs once at the very end of an mkdocs
invocation, before exiting.
This event is relevant only for support of mkdocs serve
, otherwise within a
single build it's undistinguishable from on_post_build
.
New in MkDocs 1.4.
The presence of an on_shutdown
method (even if empty) migrates the plugin to the new
system where the plugin object is kept across builds within one mkdocs serve
.
Note the on_post_build
method is still preferred for cleanups, when possible, as it has
a much higher chance of actually triggering. on_shutdown
is "best effort" because it
relies on detecting a graceful shutdown of MkDocs.
GroupPlugin¶
on_startup¶
Source
Hook info
The startup
event runs once at the very beginning of an mkdocs
invocation.
New in MkDocs 1.4.
The presence of an on_startup
method (even if empty) migrates the plugin to the new
system where the plugin object is kept across builds within one mkdocs serve
.
Note that for initializing variables, the __init__
method is still preferred.
For initializing per-build variables (and whenever in doubt), use the on_config
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
Literal['build', 'gh-deploy', 'serve']
|
the command that MkDocs was invoked with, e.g. "serve" for |
required |
dirty
|
bool
|
whether |
required |
on_config¶
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
InfoPlugin¶
on_startup¶
Source
Hook info
The startup
event runs once at the very beginning of an mkdocs
invocation.
New in MkDocs 1.4.
The presence of an on_startup
method (even if empty) migrates the plugin to the new
system where the plugin object is kept across builds within one mkdocs serve
.
Note that for initializing variables, the __init__
method is still preferred.
For initializing per-build variables (and whenever in doubt), use the on_config
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
Literal['build', 'gh-deploy', 'serve']
|
the command that MkDocs was invoked with, e.g. "serve" for |
required |
dirty
|
bool
|
whether |
required |
on_config¶
Source
material.plugins.info.plugin.InfoPlugin.on_config | |
---|---|
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
OfflinePlugin¶
on_config¶
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
PrivacyPlugin¶
on_config¶
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_files¶
Source
Hook info
The files
event is called after the files collection is populated from the
docs_dir
. Use this event to add, remove, or alter files in the
collection. Note that Page objects have not yet been associated with the
file objects in the collection. Use Page Events to manipulate page
specific data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
Files
|
global files collection |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
Files | None
|
global files collection |
on_env¶
Source
Hook info
The env
event is called after the Jinja template environment is created
and can be used to alter the
Jinja environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Environment
|
global Jinja environment |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Environment | None
|
global Jinja Environment |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_post_template¶
Source
Hook info
The post_template
event is called after the template is rendered, but before
it is written to disc and can be used to alter the output of the template.
If an empty string is returned, the template is skipped and nothing is is
written to disc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_content
|
str
|
output of rendered template as string |
required |
template_name
|
str
|
string filename of template |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
str | None
|
output of rendered template as string |
on_page_content¶
Source
Hook info
The page_content
event is called after the Markdown text is rendered to
HTML (but before being passed to a template) and can be used to alter the
HTML body of the page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
html
|
str
|
HTML rendered from Markdown source as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
HTML rendered from Markdown source as string |
on_post_page¶
Source
Hook info
The post_page
event is called after the template is rendered, but
before it is written to disc and can be used to alter the output of the
page. If an empty string is returned, the page is skipped and nothing is
written to disc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output
|
str
|
output of rendered template as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
str | None
|
output of rendered template as string |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
SearchPlugin¶
on_startup¶
Source
Hook info
The startup
event runs once at the very beginning of an mkdocs
invocation.
New in MkDocs 1.4.
The presence of an on_startup
method (even if empty) migrates the plugin to the new
system where the plugin object is kept across builds within one mkdocs serve
.
Note that for initializing variables, the __init__
method is still preferred.
For initializing per-build variables (and whenever in doubt), use the on_config
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
Literal['build', 'gh-deploy', 'serve']
|
the command that MkDocs was invoked with, e.g. "serve" for |
required |
dirty
|
bool
|
whether |
required |
on_serve¶
Source
Hook info
The serve
event is only called when the serve
command is used during
development. It runs only once, after the first build finishes.
It is passed the Server
instance which can be modified before
it is activated. For example, additional files or directories could be added
to the list of "watched" files for auto-reloading.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
server
|
LiveReloadServer
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
builder
|
Callable
|
a callable which gets passed to each call to |
required |
Returns:
Type | Description |
---|---|
LiveReloadServer | None
|
|
on_config¶
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_page_context¶
Source
material.plugins.search.plugin.SearchPlugin.on_page_context | |
---|---|
Hook info
The page_context
event is called after the context for a page is created
and can be used to alter the context for that specific page only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context
|
TemplateContext
|
dict of template context variables |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
nav
|
Navigation
|
global navigation object |
required |
Returns:
Type | Description |
---|---|
TemplateContext | None
|
dict of template context variables |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_serve¶
Source
Hook info
The serve
event is only called when the serve
command is used during
development. It runs only once, after the first build finishes.
It is passed the Server
instance which can be modified before
it is activated. For example, additional files or directories could be added
to the list of "watched" files for auto-reloading.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
server
|
LiveReloadServer
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
builder
|
Callable
|
a callable which gets passed to each call to |
required |
Returns:
Type | Description |
---|---|
LiveReloadServer | None
|
|
SocialPlugin¶
on_config¶
Source
material.plugins.social.plugin.SocialPlugin.on_config | |
---|---|
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
on_page_markdown¶
Source
Hook info
The page_markdown
event is called after the page's markdown is loaded
from file and can be used to alter the Markdown source text. The meta-
data has been stripped off and is available as page.meta
at this point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
markdown
|
str
|
Markdown source text of page as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
Markdown source text of page as string |
on_post_build¶
Source
Hook info
The post_build
event does not alter any variables. Use this event to call
post-build scripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
TagsPlugin¶
on_config¶
Source
Hook info
The config
event is the first event called on build and is run immediately
after the user configuration is loaded and validated. Any alterations to the
config should be made here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
MkDocsConfig
|
global configuration object |
required |
Returns:
Type | Description |
---|---|
MkDocsConfig | None
|
global configuration object |
on_nav¶
Source
material.plugins.tags.plugin.TagsPlugin.on_nav | |
---|---|
Hook info
The nav
event is called after the site navigation is created and can
be used to alter the site navigation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nav
|
Navigation
|
global navigation object |
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
Navigation | None
|
global navigation object |
on_page_markdown¶
Source
Hook info
The page_markdown
event is called after the page's markdown is loaded
from file and can be used to alter the Markdown source text. The meta-
data has been stripped off and is available as page.meta
at this point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
markdown
|
str
|
Markdown source text of page as string |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
files
|
Files
|
global files collection |
required |
Returns:
Type | Description |
---|---|
str | None
|
Markdown source text of page as string |
on_page_context¶
Source
Hook info
The page_context
event is called after the context for a page is created
and can be used to alter the context for that specific page only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context
|
TemplateContext
|
dict of template context variables |
required |
page
|
Page
|
|
required |
config
|
MkDocsConfig
|
global configuration object |
required |
nav
|
Navigation
|
global navigation object |
required |
Returns:
Type | Description |
---|---|
TemplateContext | None
|
dict of template context variables |
Page info
Code for this page
Resources
Resources(css=[],
markdown_extensions={'admonition': {},
'attr_list': {},
'md_in_html': {},
'pymdownx.details': {},
'pymdownx.emoji': {'emoji_generator': <function to_svg at 0x7f6e52627c40>,
'emoji_index': <function twemoji at 0x7f6e52627b00>},
'pymdownx.highlight': {'anchor_linenums': True,
'line_spans': '__span',
'pygments_lang_class': True},
'pymdownx.magiclink': {'repo': 'mkdocs_mknodes',
'repo_url_shorthand': True,
'user': 'phil65'},
'pymdownx.superfences': {}},
plugins=[Plugin('mkdocstrings')],
js=[],
assets=[Asset('speechbubble_10d5a72.css')],
packages=[])