Skip to content

NavItem

πŸ›ˆ DocStrings

An entry of the site navigation.

Either a link to a page / URL (target set) or a section (children set).

Parameters:

Name Type Description Default
title str
required
target str | None

Page path (relative to the docs root) or an external URL.

None
children list[NavItem]

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

<dynamic>
Source code in mkdocs_mknodes/generator/output.py
@dataclasses.dataclass
class NavItem:
    """An entry of the site navigation.

    Either a link to a page / URL (`target` set) or a section (`children` set).
    """

    title: str
    target: str | None = None
    """Page path (relative to the docs root) or an external URL."""
    children: list[NavItem] = dataclasses.field(default_factory=list)

    @property
    def is_section(self) -> bool:
        return self.target is None

    def iter_targets(self):
        if self.target:
            yield self.target
        for child in self.children:
            yield from child.iter_targets()

target class-attribute instance-attribute

target: str | None = None

Page path (relative to the docs root) or an external URL.

:fa-brands-github: Show source on GitHub

Page info
Resources
Resources(css=[],
          markdown_extensions={},
          plugins=[Plugin('mkdocstrings')],
          js=[],
          assets=[],
          packages=[])
Metadata
created:
  source_filename: /home/runner/work/mkdocs-mknodes/mkdocs-mknodes/.venv/lib/python3.13/site-packages/mknodes/pages/mkclasspage/__init__.py
  source_function: MkClassPage.__init__
  source_line_no: 46
title: NavItem