Skip to content

combo

CollapsedCodeFile

Bases: MdObj

A code-file in a collapsed admonition.

Source code in mkreports/md/combo.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@register_md("CollapsedCodeFile")
class CollapsedCodeFile(MdObj):
    """A code-file in a collapsed admonition."""

    def __init__(
        self, file: Union[Path, str], page_info: PageInfo, title: str = "Code"
    ) -> None:
        """
        Initialize the object.

        Args:
            file (Path): The file path (absolute or reltive to cwd) of the code-file.
            page_info (PageInfo): PageInfo about the page where it is to be added.
            title (str): Title on the admonition that is visible.
        """
        file = Path(file)
        self.obj = Admonition(
            CodeFile(
                file,
                title=None,
                page_info=page_info,
            ),
            collapse=True,
            title=title,
            kind="code",
            page_info=page_info,
        )

        self._body = self.obj.body
        self._back = self.obj.back
        self._settings = self.obj.settings

__init__(file, page_info, title='Code')

Initialize the object.

Parameters:

Name Type Description Default
file Path

The file path (absolute or reltive to cwd) of the code-file.

required
page_info PageInfo

PageInfo about the page where it is to be added.

required
title str

Title on the admonition that is visible.

'Code'
Source code in mkreports/md/combo.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def __init__(
    self, file: Union[Path, str], page_info: PageInfo, title: str = "Code"
) -> None:
    """
    Initialize the object.

    Args:
        file (Path): The file path (absolute or reltive to cwd) of the code-file.
        page_info (PageInfo): PageInfo about the page where it is to be added.
        title (str): Title on the admonition that is visible.
    """
    file = Path(file)
    self.obj = Admonition(
        CodeFile(
            file,
            title=None,
            page_info=page_info,
        ),
        collapse=True,
        title=title,
        kind="code",
        page_info=page_info,
    )

    self._body = self.obj.body
    self._back = self.obj.back
    self._settings = self.obj.settings

HLine

Bases: Raw

MdObj making a horizontal line.

Source code in mkreports/md/combo.py
11
12
13
14
15
16
17
@register_md("HLine")
class HLine(Raw):
    """MdObj making a horizontal line."""

    def __init__(self):
        """Initialize the object."""
        super().__init__(SpacedText("---", (2, 2)))

__init__()

Initialize the object.

Source code in mkreports/md/combo.py
15
16
17
def __init__(self):
    """Initialize the object."""
    super().__init__(SpacedText("---", (2, 2)))

HideNav

Bases: Raw

Hide the Nav-bar on the page.

Once added to a page, this can't be reversed. When the nav-bar is hidden, it can be hard to navigate. Consider added 'NavTabs', that show a header of navigation tabs. Please note that 'HideNav' affects only the current page, while adding NavTabs affects the entire report.

Source code in mkreports/md/combo.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@register_md("HideNav")
class HideNav(Raw):
    """
    Hide the Nav-bar on the page.

    Once added to a page, this can't be reversed. When the nav-bar is hidden,
    it can be hard to navigate. Consider added 'NavTabs', that show a header
    of navigation tabs. Please note that 'HideNav' affects only the current page,
    while adding NavTabs affects the entire report.
    """

    def __init__(self):
        """Initialize the object."""
        super().__init__(page_settings=dict(hide=["navigation"]))

__init__()

Initialize the object.

Source code in mkreports/md/combo.py
77
78
79
def __init__(self):
    """Initialize the object."""
    super().__init__(page_settings=dict(hide=["navigation"]))

HideToc

Bases: Raw

Hide the ToC on the page.

Once added to a page, this can't be reversed.

Source code in mkreports/md/combo.py
53
54
55
56
57
58
59
60
61
62
63
@register_md("HideToc")
class HideToc(Raw):
    """
    Hide the ToC on the page.

    Once added to a page, this can't be reversed.
    """

    def __init__(self):
        """Initialize the object."""
        super().__init__(page_settings=dict(hide=["toc"]))

__init__()

Initialize the object.

Source code in mkreports/md/combo.py
61
62
63
def __init__(self):
    """Initialize the object."""
    super().__init__(page_settings=dict(hide=["toc"]))

NavTabs

Bases: Raw

Add a header with navigation tabs.

This cannot be reversed once added. Affects the entire report.

Source code in mkreports/md/combo.py
82
83
84
85
86
87
88
89
90
91
92
@register_md("NavTabs")
class NavTabs(Raw):
    """
    Add a header with navigation tabs.

    This cannot be reversed once added. Affects the entire report.
    """

    def __init__(self):
        """Initialize the object."""
        super().__init__(mkdocs_settings={"theme": {"features": ["navigation.tabs"]}})

__init__()

Initialize the object.

Source code in mkreports/md/combo.py
90
91
92
def __init__(self):
    """Initialize the object."""
    super().__init__(mkdocs_settings={"theme": {"features": ["navigation.tabs"]}})