Class used for MkNav decorator routing.
nav
def nav(*path: str, **kwargs: Any) -> Callable[[AnyNavCallable], Any]
Decorator method to use for routing Navs.
The decorated functions will get passed an MkNav as an argument which can be
modified then.
They will get registered to the router-MkNav afterwards.
There is also the possibility to create a new MkNav and return it in the
decorated method, that MkNav takes preference then over the modified one.
Examples:
@nav.route.nav("Routed nav")
def _(nav: mk.MkNav):
nav += ...
Parameters:
Name |
Type |
Description |
Default |
path
|
str
|
The section path for the returned MkNav |
() |
kwargs
|
Any
|
Keyword arguments passed to the MkNav constructor. |
{} |
page
def page(*path: str, **kwargs: Any) -> Callable[[AnyPageCallable], Any]
Decorator method to use for routing Pages.
The decorated functions will get passed an MkPage as an argument which can be
modified then.
The resulting page will get registered to the router-MkNav afterwards.
There is also the possibility to create a new MkPage and return it in the
decorated method, that MkPage takes preference then over the modified one.
The keyword arguments can be used to pass metadata-related keyword arguments
to the MkPage constructor.
Examples:
@nav.route.page("Routed page", icon=...)
def _(page: mk.MkPage):
page += ...
Args:
path: The section path for the returned MkPage
kwargs: Keyword arguments passed to the MkPage constructor.
mknodes.manual.api_section.add_page..
168@nav.route.page(title, hide="toc")
169def _(page: mk.MkPage) -> None:
170 page += INTROS[title]
171 page += mk.MkCode(EXAMPLES[title].rstrip(), language="py", title="Example")
172 for identifier in identifiers:
173 page += mk.MkDocStrings(identifier, **DOCSTRING_OPTIONS)
Resources(css=[],
markdown_extensions={},
plugins=[],
js=[],
assets=[],
packages=[])
created:
source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/api_section.py
source_function: _add_page.<locals>._
source_line_no: 168
hide:
- toc
title: Routing