Skip to content

Commit

Permalink
chore: misc
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Sep 21, 2023
1 parent 0a8b188 commit 91c8b51
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mknodes/basenodes/mkcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def __init__(
title: Code block title
linenums: If set, use as start linenumber
highlight_lines: Optionally highlight lines
fence_level: Determines amount of ` used for fence. If None, auto-determine.
fence_level: Determines amount of ticks used for fence.
If None, auto-determine based on nesting depth.
header: Section header
kwargs: Keyword arguments passed to parent
"""
Expand Down
1 change: 0 additions & 1 deletion mknodes/manual/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def build(project: mk.Project[materialtheme.MaterialTheme]) -> mk.MkNav:
page += admonition # This adds (6) to the page.

# Now we add the MkNode you are looking at right now.
# We will use MkCode.for_object quite a lot in the next sections.
# DocStrings for for_object: (7)
page += mk.MkCode.for_object(build)
page += annotations # here we add the (invisible) annotations block to the page.
Expand Down
14 changes: 14 additions & 0 deletions mknodes/utils/xmlhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ def get_material_icon_svg(icon: str) -> Et.Element:
return Et.fromstring(svg_text)


def get_source_button(icon: str = "material/code-json"):
href = (
"{{ config.site_url | rstrip('/') + '/src/' + page.file.src_uri | replace('.md',"
" '.original') }}"
)
elem = A(
"md-content__button md-icon",
title="Source",
href=href,
)
elem.append(get_material_icon_svg(icon))
return elem


def pformat(str_or_elem: str | Et.Element, space: str = " ", level: int = 0) -> str:
"""Prettyprint given XML.
Expand Down

0 comments on commit 91c8b51

Please sign in to comment.