Populate MkPages from SUMMARY.md

MkNavs can parse index files in SUMMARY.md style (as popularized by mkdocs-literate-nav).

Given the following folder structure:

Directory tree

nav_tree/
├── 📄SUMMARY.md
├── 📄test_file.md
├── 📁test_folder/
│   ├── 📄markdown-exec.md
│   ╰── 📄sub_1.md
╰── 📁test_subnav/
    ├── 📄subnav_page_1.md
    ├── 📄subnav_page_2.md
    ╰── 📄SUMMARY.md

and a root SUMMARY.md looking like:

Root SUMMARY.md

* Test nested
    * [General] (test_folder/sub_1.md)
    * [Markdown-Exec] (test_folder/markdown-exec.md)
* [Test Subnav] (test_subnav/)
* [Test file] (test_file.md)
Page info
Code for this section
mknodes.manual.navs_section._
@nav.route.nav("Populate MkPages from SUMMARY.md")
def _(nav: mk.MkNav):
    folder = paths.TEST_RESOURCES / "nav_tree/"
    summary_file = folder / "SUMMARY.md"
    nav.parse.file(summary_file, hide="toc")
    page = nav.add_page(is_index=True, hide="toc", icon="file")
    text = summary_file.read_text()
    text = text.replace("](", "] (")  ##
    path = paths.TEST_RESOURCES / "nav_tree/"
    variables = dict(path=path, text=text)
    page += mk.MkTemplate("navs/nav_from_file.jinja", variables=variables)
Resources
Resources(css=[],
          markdown_extensions={'admonition': {},
                               'attr_list': {},
                               'md_in_html': {},
                               'pymdownx.details': {},
                               'pymdownx.emoji': {'emoji_generator': <function to_svg at 0x7fd32a7ad800>,
                                                  'emoji_index': <function twemoji at 0x7fd32a7ad6c0>},
                               '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: 26
hide:
- toc
icon: material/file
template: SUMMARY.html
title: Populate MkPages from SUMMARY.md