Skip to content

Commit

Permalink
chore: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Sep 21, 2023
1 parent a19af6e commit 2917d9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions mknodes/manual/navs_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def create_mkmodulepage_page(page: mk.MkPage):

@pages_nav.route.page("Adding to MkPages", hide="toc", status="new")
def create_adding_to_mkpages_page(page: mk.MkPage):
"""Create the "Adding to MkPages" MkPage and attach it to given MkNav."""
page += mk.MkAdmonition("You can add other MkNodes to a page sequentially.")
page += "Adding strings also works, they get converted to MkText nodes."
page += "### ...and text starting with # will become a MkHeader."
Expand All @@ -180,8 +179,6 @@ def create_adding_to_mkpages_page(page: mk.MkPage):
description="Description",
)
def create_metadata_page(page: mk.MkPage):
"""Create the "Metadata" MkPage and attach it to given nav."""
# page.metadata is a dataclass, we can prettyprint these with MkPrettyPrint.
page += METADATA_TEXT
page += mk.MkDocStrings(
metadata.Metadata,
Expand All @@ -192,16 +189,29 @@ def create_metadata_page(page: mk.MkPage):
)


@pages_nav.route.page("Templates", hide="toc", status="new")
def create_template_page(page: mk.MkPage):
page += "The page template can be edited easily via the 'template' attribute."
code = "information = 'You can even put MkNodes here!'"
text = (
'page.template.announce_block.content = mk.MkMetadataBadges(typ="classifiers")\n'
"page.template.footer_block.content = mk.MkProgressBar(50)\n"
f'page.template.tabs_block.content = mk.MkCode(f"{code}")'
)
page += mk.MkCode(text)
page.template.announce_block.content = mk.MkMetadataBadges(typ="classifiers")
page.template.footer_block.content = mk.MkProgressBar(50)
page.template.tabs_block.content = mk.MkCode(f"{code}")


def create_mkdefaultwebsite_section(nav: mk.MkNav):
"""Create the "MkDefaultWebsite" sub-MkNav and attach it to given nav."""
proj = Project.for_path("https://github.com/mkdocstrings/mkdocstrings.git")
website_nav = mk.MkDefaultWebsite(section="MkDocStrings", project=proj)
nav += website_nav


@nav.route.nav("MkDoc")
def create_mkdoc_section(nav: mk.MkNav):
"""Create the "Metadata" sub-MkNav and attach it to given nav."""
nav = nav.add_nav("MkDoc")

page = nav.add_index_page(hide="toc", icon="api")
Expand Down
2 changes: 1 addition & 1 deletion mknodes/pages/mkpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def icon(self, value: str):
self._metadata.icon = value

@property
def template(self) -> pagetemplate.PageTemplate | None:
def template(self) -> pagetemplate.PageTemplate:
return self._template

@template.setter
Expand Down

0 comments on commit 2917d9a

Please sign in to comment.