Skip to content

Populate MkPages from folder

Directory tree

📂 test_folder
┣━━ 📝 markdown-exec.md (508 Bytes)
┗━━ 📝 sub_1.md (287 Bytes)
Page info
Code for this section
mknodes.manual.navs_section._
@nav.route.nav("Populate MkPages from folder")
def _(nav: mk.MkNav):
    """Create a MkNav based on a folder tree containing markup files."""
    folder = paths.TEST_RESOURCES / "nav_tree/test_folder/"
    nav.parse.folder(folder, hide="toc")
    page = nav.add_page(is_index=True, hide="toc", icon="folder")
    variables = dict(folder=folder)
    page += mk.MkTemplate("navs/nav_from_folder.jinja", variables=variables)
Resources
Resources(css=[],
          markdown_extensions={'attr_list': {},
                               'md_in_html': {},
                               'pymdownx.emoji': {'emoji_generator': <function to_svg at 0x7fd7a6931800>,
                                                  'emoji_index': <function twemoji at 0x7fd7a69316c0>},
                               'pymdownx.highlight': {'anchor_linenums': True,
                                                      'line_spans': '__span',
                                                      'pygments_lang_class': True},
                               'pymdownx.magiclink': {'repo': 'mknodes',
                                                      'repo_url_shorthand': True,
                                                      'user': 'phil65'},
                               'pymdownx.superfences': {}},
          plugins=[],
          js=[],
          assets=[],
          packages=[])
Metadata
created:
  source_filename: /home/runner/work/mknodes/mknodes/mknodes/manual/navs_section.py
  source_function: _
  source_line_no: 38
hide:
- toc
icon: material/folder
template: SUMMARY.html
title: Populate MkPages from folder