MkNode¶
Base class for everything which can be expressed as Markup.¶
Description
This class combines tree node functionality with markdown generation. Starting from the root nav (aka Docs) down to nested Markup blocks, the whole project can be represented by one tree.
MkNode is the base class for all nodes. We dont instanciate it directly.
All subclasses carry an MkAnnotations node (except the MkAnnotations node itself)
They can also pass an indent as well as a shift_header_levels keyword argument
in order to modify the resulting markdown.
Name |
Children |
Inherits |
|---|---|---|
MkContainerBase |
||
MkCompactAdmonition |
||
MkLink |
||
MkText |
||
MkHeader |
||
MkKeys |
||
MkDocStrings |
||
MkIcon |
||
MkImage |
||
MkProgressBar |
||
BaseBlock |
||
MkTimelineItem |
||
MkPyodideTerminal |
||
MkJupyterLite |
||
MkPyScript |
||
MkDataClassInfo |
||
MkNav |
||
MkTemplateTable |
||
MkPyDeps |
||
FlavorComparison |
Page info
Code for this page
93def create_section_for_nodes(
94 nav: mk.MkNav,
95 klasses: Sequence[type[mk.MkNode]],
96) -> mk.MkTable:
97 table = mk.MkTable(columns=["Node", "Docstrings", "Markdown extensions"])
98 for kls in klasses:
99 tpl = "classpage_custom.jinja"
100 page = mk.MkClassPage(kls, icon=kls.ICON, template_path=tpl, parent=nav, hide="toc")
101 nav += page
102 if kls.STATUS:
103 page.metadata.status = kls.STATUS
104 elif kls.JS_FILES:
105 page.metadata.status = "js"
106 elif kls.CSS:
107 page.metadata.status = "css"
108 page.created_by = create_section_for_nodes
109 link = mk.MkLink(page, kls.__name__, icon=kls.ICON)
110 extensions = ", ".join(f"`{i}`" for i in kls.REQUIRED_EXTENSIONS)
111 table.add_row((link, kls.__doc__, extensions))
112 return table
Resources
Resources(css=[],
markdown_extensions={'admonition': {},
'pymdownx.details': {},
'pymdownx.superfences': {},
'tables': {}},
plugins=[Plugin('mkdocstrings')],
js=[],
assets=[],
packages=[])
Metadata
created:
source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/nodes_section.py
source_function: create_section_for_nodes
source_line_no: 93
hide:
- toc
icon: material/puzzle-outline
title: MkNode