Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
MkNodes
MkNodes

Get started

  • Installation
  • Why should I use MkNodes?
  • A quick node tour
  • Changelog

MkNavs

  • MkNavs
  • Populate MkPages from SUMMARY.md
    • Test nested
      • General
      • Markdown-Exec
    • Test Subnav
      • Subnav page 1
      • Subnav page 2
    • Test file
  • Populate MkPages from folder
    • markdown_exec
    • sub_1
  • Routing
    • Routed page
    • Routed
      • Deeply
        • Nested
          • Nested page
          • Nav
            • Routed section page
  • Context propagation

MkPages

  • MkPages
  • MkClassPage
  • MkCode
  • MkCode
  • MkModulePage
  • info
  • Setting the homepage
  • Adding to MkPages
  • Metadata
  • Templates
  • Resources

The nodes

  • The nodes
  • Markdown flavours
  • Base nodes
    • MkNode
    • MkText
    • MkHeader
    • MkCompactAdmonition
    • MkCritic
    • MkLink
    • MkKeys
    • MkProgressBar
    • MkSpeechBubble
    • MkTemplate
    • MkLlm
  • Image nodes
    • MkImage
    • MkImageCompare
    • MkImageSlideshow
    • MkBadge
    • MkIcon
    • MkMaterialBadge
    • MkBinaryImage
    • MkCard
  • Container nodes
    • MkBlockQuote
    • MkAdmonition
    • MkContainer
    • MkCode
    • MkList
    • MkTable
    • MkHtmlTable
    • MkDefinitionList
    • MkDetailsBlock
    • MkHtmlBlock
    • MkTabbedBlocks
    • MkTabbed
    • MkAnnotations
    • MkFootNotes
    • MkShowcase
    • MkTaskList
  • Presentation nodes
    • MkTreeView
    • MkReprRawRendered
    • MkDiagram
    • MkTimeline
  • Documentation nodes
    • MkClassDiagram
    • MkDocStrings
    • MkCommentedCode
    • MkConfigSetting
    • MkClassTable
    • MkModuleTable
    • MkCliDoc
  • About-the-project nodes
    • MkChangelog
    • MkCodeOfConduct
    • MkLicense
    • MkDependencyTable
    • MkInstallGuide
    • MkCommitConventions
    • MkDevTools
    • MkShields
    • MkMetadataBadges
    • MkPipDepTree
    • MkPyDeps
  • Special nodes
    • MkInclude
    • MkIFrame
    • MkCommandOutput

Templating

  • Templating
  • Jinja Namespace
    • PackageContext
    • ThemeContext
    • GitContext
    • GitHubContext
  • Utility filters
  • MkNode filters
  • Template engines

Site generator

  • Use cases
    • Creating a website via config
  • CLI
    • build
    • serve
    • generate
    • render
    • render-folder
  • Site generator
  • Configuration
  • Site engines
  • The build process

Core API

  • Core API
  • Navs and pages
  • Routing
  • MkNode
  • Theming
  • Build step
  • Rendering

Development

  • Dependencies
  • Development environment
  • Dev Tools
  • Code of conduct
  • Contributing
  • License
Back to top
View this page

Navs and pages¶

A documentation is a tree: MkNav objects are the sections, MkPage objects the pages, nodes the content of a page. Nodes get added with +=, navs and pages with add_nav() / add_page() (or via decorators, see Routing). The root nav is what a build function receives.

Example¶
import mknodes as mk

nav = mk.MkNav()  # the root nav
page = nav.add_page("Usage", is_index=True, hide="toc")
page += mk.MkAdmonition("Install with `pip install mknodes`.", typ="tip")
guides = nav.add_nav("Guides")
first_steps = guides.add_page("First steps")
first_steps += "Some text"

mknodes.MkNav¶

class MkNav(mknode.MkNode)

Nav section, representing a nestable menu.

A nav is named (exception is the root nav, which has section name = None), has an associated virtual file (in general a SUMMARY.md), an optional index page and can contain other navs as well as pages and links.

mknodes.MkPage¶

class MkPage(mkcontainer.MkContainer)

A node container representing a Markdown page.

A page contains a list of other Markdown nodes, has a virtual Markdown file associated, and can have metadata (added as header)

Page info
Code for this page
mknodes.manual.api_section.add_page..¶
168@nav.route.page(title, hide="toc")
169def _(page: mk.MkPage) -> None:
170    page += INTROS[title]
171    page += mk.MkCode(EXAMPLES[title].rstrip(), language="py", title="Example")
172    for identifier in identifiers:
173        page += mk.MkDocStrings(identifier, **DOCSTRING_OPTIONS)
Resources
Resources(css=[],
          markdown_extensions={},
          plugins=[],
          js=[],
          assets=[],
          packages=[])
Metadata
created:
  source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/api_section.py
  source_function: _add_page.<locals>._
  source_line_no: 168
hide:
- toc
title: Navs and pages
Next
Routing
Previous
Core API
Copyright © 2024 Philipp Temminghoff
Made with Sphinx and @pradyunsg's Furo
On this page
  • Navs and pages
    • mknodes.MkNav
    • mknodes.MkPage