Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MkMetadataBadges

github Show source on GitHub

Container node for a list of metadata badges.

Note

Description

Badges are generated locally using “anybadge” package

Examples

Example: Classifiers

Note

Jinja

{{ "classifiers" | MkMetadataBadges }}

Note

Python

MkMetadataBadges('classifiers')
Rendered

Markdown
![4 - Beta: Development Status](https://img.shields.io/badge/4%20--%20Beta-Development%20Status-4051b5)
![Developers: Intended Audience](https://img.shields.io/badge/Developers-Intended%20Audience-4051b5)
![OS Independent: Operating System](https://img.shields.io/badge/OS%20Independent-Operating%20System-4051b5)
![Python :: 3: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%203-Programming%20Language-4051b5)
![Python :: 3 :: Only: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%203%20%3A%3A%20Only-Programming%20Language-4051b5)
![Python :: 3.14: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%203.14-Programming%20Language-4051b5)
![Python :: Implementation :: CPython: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%20Implementation%20%3A%3A%20CPython-Programming%20Language-4051b5)
![Documentation: Topic](https://img.shields.io/badge/Documentation-Topic-4051b5)
![Software Development :: Code Generators: Topic](https://img.shields.io/badge/Software%20Development%20%3A%3A%20Code%20Generators-Topic-4051b5)
![Software Development :: Documentation: Topic](https://img.shields.io/badge/Software%20Development%20%3A%3A%20Documentation-Topic-4051b5)
![Text Processing :: Markup :: Markdown: Topic](https://img.shields.io/badge/Text%20Processing%20%3A%3A%20Markup%20%3A%3A%20Markdown-Topic-4051b5)
![Typed: Typing](https://img.shields.io/badge/Typed-Typing-4051b5)
Html

Example: Keywords

Note

Jinja

{{ "keywords" | MkMetadataBadges }}

Note

Python

MkMetadataBadges('keywords')
Rendered

Markdown
![api-documentation](https://img.shields.io/badge/api--documentation-4051b5)
![docs-as-code](https://img.shields.io/badge/docs--as--code-4051b5)
![documentation](https://img.shields.io/badge/documentation-4051b5)
![documentation-generator](https://img.shields.io/badge/documentation--generator-4051b5)
![jinja2](https://img.shields.io/badge/jinja2-4051b5)
![markdown](https://img.shields.io/badge/markdown-4051b5)
![static-site-generator](https://img.shields.io/badge/static--site--generator-4051b5)
![zensical](https://img.shields.io/badge/zensical-4051b5)
Html

Example: Keywords combined

Note

Jinja

{{ "keywords_combined" | MkMetadataBadges }}

Note

Python

MkMetadataBadges('keywords_combined')
Rendered

Markdown
![Keywords: api-documentation | docs-as-code | documentation | documentation-generator | jinja2 | markdown | static-site-generator | zensical](https://img.shields.io/badge/Keywords-api--documentation%20%7C%20docs--as--code%20%7C%20documentation%20%7C%20documentation--generator%20%7C%20jinja2%20%7C%20markdown%20%7C%20static--site--generator%20%7C%20zensical-4051b5)
Html
<p><img src="https://img.shields.io/badge/Keywords-blue" alt="Keywords" /></p>

Repr tree
MkMetadataBadges
╰── MkBadge('Keywords', 'api-documentation | docs-as-code | documentation | documentation-generator | jinja2 | markdown | static-site-generator | zensical')

Example: Websites

Note

Jinja

{{ "websites" | MkMetadataBadges }}

Note

Python

MkMetadataBadges('websites')
Rendered

Code coverage: app.codecov.io Discussions: github.com Documentation: phil65.github.io Issues: github.com Source: github.com

Markdown
[![Code coverage: app.codecov.io](https://img.shields.io/badge/Code%20coverage-app.codecov.io-4051b5)](https://app.codecov.io/gh/phil65/mknodes)
[![Discussions: github.com](https://img.shields.io/badge/Discussions-github.com-4051b5)](https://github.com/phil65/mknodes/discussions)
[![Documentation: phil65.github.io](https://img.shields.io/badge/Documentation-phil65.github.io-4051b5)](https://phil65.github.io/mknodes/)
[![Issues: github.com](https://img.shields.io/badge/Issues-github.com-4051b5)](https://github.com/phil65/mknodes/issues)
[![Source: github.com](https://img.shields.io/badge/Source-github.com-4051b5)](https://github.com/phil65/mknodes)
Html

Example: Dependencies

Note

Jinja

{{ "dependencies" | MkMetadataBadges }}

Note

Python

MkMetadataBadges('dependencies')
Rendered

anybadge: 1.18.0 anyenv: 3.1.0 anyio: 4.16.0 clinspector: 2.2.0 coloraide: 8.17 epregistry: 2.0.6 fieldz: 0.2.0 fsspec: 2026.9.0 git-changelog: 2.12.0 githarbor: 1.0.4 GitPython: 3.2.1 griffelib: 2.4.1 Jinja2: 3.1.6 jinjarope: 1.3.0 logfire-sdk: 6.0.1 Markdown: 3.11.4 MarkupSafe: 3.0.4 natsort: 8.4.0 packaging: 26.4 pipdeptree: 4.2.16 platformdirs: 4.14.8 pydantic: 2.14.4 pymdown-extensions: 13.1.2 pytest-asyncio: 1.5.0 python-dotenv: 1.2.4 PyYAML: 6.0.4 requests: 2.34.2 rich: 15.0.0 tomli_w: 1.2.0 typer: 0.29.3 universal_pathlib: 0.3.11 upathtools: 1.26.0 yamling: 2.1.9 zensical: 0.1.3 markdown-it-py: 4.3.0 mdit-py-plugins: 0.7.0 mkconvert: 2.1.0 agentpool: 2.15.0 mkdocs: 1.6.1 mkdocs-material: 9.8.2 myst-parser: 5.2.0 Sphinx: 9.2.0 sphinx_design: 0.8.0

Markdown
[![anybadge: 1.18.0](https://img.shields.io/badge/anybadge-1.18.0-4051b5)](https://github.com/jongracecox/anybadge)
[![anyenv: 3.1.0](https://img.shields.io/badge/anyenv-3.1.0-4051b5)](https://phil65.github.io/anyenv/)
[![anyio: 4.16.0](https://img.shields.io/badge/anyio-4.16.0-4051b5)](https://anyio.readthedocs.io/en/latest/)
[![clinspector: 2.2.0](https://img.shields.io/badge/clinspector-2.2.0-4051b5)](https://phil65.github.io/clinspector/)
[![coloraide: 8.17](https://img.shields.io/badge/coloraide-8.17-4051b5)](https://github.com/facelessuser/coloraide)
[![epregistry: 2.0.6](https://img.shields.io/badge/epregistry-2.0.6-4051b5)](https://github.com/phil65/epregistry)
[![fieldz: 0.2.0](https://img.shields.io/badge/fieldz-0.2.0-4051b5)](https://github.com/pyapp-kit/fieldz)
[![fsspec: 2026.9.0](https://img.shields.io/badge/fsspec-2026.9.0-4051b5)](https://github.com/fsspec/filesystem_spec)
[![git-changelog: 2.12.0](https://img.shields.io/badge/git--changelog-2.12.0-4051b5)](https://pawamoy.github.io/git-changelog)
[![githarbor: 1.0.4](https://img.shields.io/badge/githarbor-1.0.4-4051b5)](https://github.com/phil65/githarbor)
[![GitPython: 3.2.1](https://img.shields.io/badge/GitPython-3.2.1-4051b5)](https://gitpython.readthedocs.io/en/stable/)
[![griffelib: 2.4.1](https://img.shields.io/badge/griffelib-2.4.1-4051b5)](https://mkdocstrings.github.io/griffe)
[![Jinja2: 3.1.6](https://img.shields.io/badge/Jinja2-3.1.6-4051b5)](https://jinja.palletsprojects.com/)
[![jinjarope: 1.3.0](https://img.shields.io/badge/jinjarope-1.3.0-4051b5)](https://phil65.github.io/jinjarope/)
[![logfire-sdk: 6.0.1](https://img.shields.io/badge/logfire--sdk-6.0.1-4051b5)](https://pydantic.dev/logfire)
[![Markdown: 3.11.4](https://img.shields.io/badge/Markdown-3.11.4-4051b5)](https://Python-Markdown.github.io/)
[![MarkupSafe: 3.0.4](https://img.shields.io/badge/MarkupSafe-3.0.4-4051b5)](https://markupsafe.palletsprojects.com/)
[![natsort: 8.4.0](https://img.shields.io/badge/natsort-8.4.0-4051b5)](https://github.com/SethMMorton/natsort)
[![packaging: 26.4](https://img.shields.io/badge/packaging-26.4-4051b5)](https://packaging.pypa.io/)
[![pipdeptree: 4.2.16](https://img.shields.io/badge/pipdeptree-4.2.16-4051b5)](https://github.com/tox-dev/pipdeptree)
[![platformdirs: 4.14.8](https://img.shields.io/badge/platformdirs-4.14.8-4051b5)](https://github.com/tox-dev/platformdirs)
[![pydantic: 2.14.4](https://img.shields.io/badge/pydantic-2.14.4-4051b5)](https://github.com/pydantic/pydantic)
[![pymdown-extensions: 13.1.2](https://img.shields.io/badge/pymdown--extensions-13.1.2-4051b5)](https://github.com/facelessuser/pymdown-extensions)
[![pytest-asyncio: 1.5.0](https://img.shields.io/badge/pytest--asyncio-1.5.0-4051b5)](https://github.com/pytest-dev/pytest-asyncio)
[![python-dotenv: 1.2.4](https://img.shields.io/badge/python--dotenv-1.2.4-4051b5)](https://github.com/theskumar/python-dotenv)
[![PyYAML: 6.0.4](https://img.shields.io/badge/PyYAML-6.0.4-4051b5)](https://pyyaml.org/)
[![requests: 2.34.2](https://img.shields.io/badge/requests-2.34.2-4051b5)](https://requests.readthedocs.io)
[![rich: 15.0.0](https://img.shields.io/badge/rich-15.0.0-4051b5)](https://github.com/Textualize/rich)
[![tomli_w: 1.2.0](https://img.shields.io/badge/tomli__w-1.2.0-4051b5)](https://github.com/hukkin/tomli-w)
[![typer: 0.29.3](https://img.shields.io/badge/typer-0.29.3-4051b5)](https://github.com/fastapi/typer)
[![universal_pathlib: 0.3.11](https://img.shields.io/badge/universal__pathlib-0.3.11-4051b5)](https://github.com/fsspec/universal_pathlib)
[![upathtools: 1.26.0](https://img.shields.io/badge/upathtools-1.26.0-4051b5)](https://phil65.github.io/upathtools/)
[![yamling: 2.1.9](https://img.shields.io/badge/yamling-2.1.9-4051b5)](https://phil65.github.io/yamling/)
[![zensical: 0.1.3](https://img.shields.io/badge/zensical-0.1.3-4051b5)](https://zensical.org/)
[![markdown-it-py: 4.3.0](https://img.shields.io/badge/markdown--it--py-4.3.0-4051b5)](https://github.com/executablebooks/markdown-it-py)
[![mdit-py-plugins: 0.7.0](https://img.shields.io/badge/mdit--py--plugins-0.7.0-4051b5)](https://github.com/executablebooks/mdit-py-plugins)
[![mkconvert: 2.1.0](https://img.shields.io/badge/mkconvert-2.1.0-4051b5)](https://phil65.github.io/mkconvert/)
[![agentpool: 2.15.0](https://img.shields.io/badge/agentpool-2.15.0-4051b5)](https://phil65.github.io/agentpool/)
[![mkdocs: 1.6.1](https://img.shields.io/badge/mkdocs-1.6.1-4051b5)](https://www.mkdocs.org/)
[![mkdocs-material: 9.8.2](https://img.shields.io/badge/mkdocs--material-9.8.2-4051b5)](https://squidfunk.github.io/mkdocs-material/)
![furo: 2025.12.19](https://img.shields.io/badge/furo-2025.12.19-4051b5)
[![myst-parser: 5.2.0](https://img.shields.io/badge/myst--parser-5.2.0-4051b5)](https://github.com/executablebooks/MyST-Parser)
[![Sphinx: 9.2.0](https://img.shields.io/badge/Sphinx-9.2.0-4051b5)](https://www.sphinx-doc.org/)
[![sphinx_design: 0.8.0](https://img.shields.io/badge/sphinx__design-0.8.0-4051b5)](https://github.com/executablebooks/sphinx-design)
Html

Example: For other packages

Note

Jinja

{{ "dependencies" | MkMetadataBadges(package="mkdocs") }}

Note

Python

MkMetadataBadges('dependencies', package='mkdocs')
Rendered

click: 8.5.1 colorama: 0.4.6 ghp-import: 2.1.0 Jinja2: 3.1.6 Markdown: 3.11.4 MarkupSafe: 3.0.4 mergedeep: 1.3.4 mkdocs-get-deps: 0.2.2 packaging: 26.4 pathspec: 1.1.1 pyyaml_env_tag: 1.1 PyYAML: 6.0.4 watchdog: 7.1.1 babel: 2.19.0

Markdown
[![click: 8.5.1](https://img.shields.io/badge/click-8.5.1-4051b5)](https://click.palletsprojects.com/)
[![colorama: 0.4.6](https://img.shields.io/badge/colorama-0.4.6-4051b5)](https://github.com/tartley/colorama)
[![ghp-import: 2.1.0](https://img.shields.io/badge/ghp--import-2.1.0-4051b5)](https://github.com/c-w/ghp-import)
[![Jinja2: 3.1.6](https://img.shields.io/badge/Jinja2-3.1.6-4051b5)](https://jinja.palletsprojects.com/)
[![Markdown: 3.11.4](https://img.shields.io/badge/Markdown-3.11.4-4051b5)](https://Python-Markdown.github.io/)
[![MarkupSafe: 3.0.4](https://img.shields.io/badge/MarkupSafe-3.0.4-4051b5)](https://markupsafe.palletsprojects.com/)
[![mergedeep: 1.3.4](https://img.shields.io/badge/mergedeep-1.3.4-4051b5)](https://github.com/clarketm/mergedeep)
[![mkdocs-get-deps: 0.2.2](https://img.shields.io/badge/mkdocs--get--deps-0.2.2-4051b5)](https://github.com/mkdocs/get-deps)
[![packaging: 26.4](https://img.shields.io/badge/packaging-26.4-4051b5)](https://packaging.pypa.io/)
[![pathspec: 1.1.1](https://img.shields.io/badge/pathspec-1.1.1-4051b5)](https://python-path-specification.readthedocs.io/en/latest/index.html)
[![pyyaml_env_tag: 1.1](https://img.shields.io/badge/pyyaml__env__tag-1.1-4051b5)](https://github.com/waylan/pyyaml-env-tag)
[![PyYAML: 6.0.4](https://img.shields.io/badge/PyYAML-6.0.4-4051b5)](https://pyyaml.org/)
[![watchdog: 7.1.1](https://img.shields.io/badge/watchdog-7.1.1-4051b5)](https://github.com/gorakhargosh/watchdog)
[![babel: 2.19.0](https://img.shields.io/badge/babel-2.19.0-4051b5)](https://babel.pocoo.org/)
Html
<p><a href="https://click.palletsprojects.com/"><img src="https://img.shields.io/badge/click-8.5.1-blue" alt="click: 8.5.1" /></a>
<a href="https://github.com/tartley/colorama"><img src="https://img.shields.io/badge/colorama-0.4.6-blue" alt="colorama: 0.4.6" /></a>
<a href="https://github.com/c-w/ghp-import"><img src="https://img.shields.io/badge/ghp--import-2.1.0-blue" alt="ghp-import: 2.1.0" /></a>
<a href="https://jinja.palletsprojects.com/"><img src="https://img.shields.io/badge/Jinja2-3.1.6-blue" alt="Jinja2: 3.1.6" /></a>
<a href="https://Python-Markdown.github.io/"><img src="https://img.shields.io/badge/Markdown-3.11.4-blue" alt="Markdown: 3.11.4" /></a>
<a href="https://markupsafe.palletsprojects.com/"><img src="https://img.shields.io/badge/MarkupSafe-3.0.4-blue" alt="MarkupSafe: 3.0.4" /></a>
<a href="https://github.com/clarketm/mergedeep"><img src="https://img.shields.io/badge/mergedeep-1.3.4-blue" alt="mergedeep: 1.3.4" /></a>
<a href="https://github.com/mkdocs/get-deps"><img src="https://img.shields.io/badge/mkdocs--get--deps-0.2.2-blue" alt="mkdocs-get-deps: 0.2.2" /></a>
<a href="https://packaging.pypa.io/"><img src="https://img.shields.io/badge/packaging-26.4-blue" alt="packaging: 26.4" /></a>
<a href="https://python-path-specification.readthedocs.io/en/latest/index.html"><img src="https://img.shields.io/badge/pathspec-1.1.1-blue" alt="pathspec: 1.1.1" /></a>
<a href="https://github.com/waylan/pyyaml-env-tag"><img src="https://img.shields.io/badge/pyyaml__env__tag-1.1-blue" alt="pyyaml_env_tag: 1.1" /></a>
<a href="https://pyyaml.org/"><img src="https://img.shields.io/badge/PyYAML-6.0.4-blue" alt="PyYAML: 6.0.4" /></a>
<a href="https://github.com/gorakhargosh/watchdog"><img src="https://img.shields.io/badge/watchdog-7.1.1-blue" alt="watchdog: 7.1.1" /></a>
<a href="https://babel.pocoo.org/"><img src="https://img.shields.io/badge/babel-2.19.0-blue" alt="babel: 2.19.0" /></a></p>

Repr tree
MkMetadataBadges
├── MkBadge('click', '8.5.1')
├── MkBadge('colorama', '0.4.6')
├── MkBadge('ghp-import', '2.1.0')
├── MkBadge('Jinja2', '3.1.6')
├── MkBadge('Markdown', '3.11.4')
├── MkBadge('MarkupSafe', '3.0.4')
├── MkBadge('mergedeep', '1.3.4')
├── MkBadge('mkdocs-get-deps', '0.2.2')
├── MkBadge('packaging', '26.4')
├── MkBadge('pathspec', '1.1.1')
├── MkBadge('pyyaml_env_tag', '1.1')
├── MkBadge('PyYAML', '6.0.4')
├── MkBadge('watchdog', '7.1.1')
╰── MkBadge('babel', '2.19.0')

Example: Gitlab style

Note

Jinja

{{ "classifiers" | MkMetadataBadges(use_gitlab_style=True) }}

Note

Python

MkMetadataBadges('classifiers', use_gitlab_style=True)
Rendered

Markdown
![4 - Beta: Development Status](https://img.shields.io/badge/4%20--%20Beta-Development%20Status-4051b5)
![Developers: Intended Audience](https://img.shields.io/badge/Developers-Intended%20Audience-4051b5)
![OS Independent: Operating System](https://img.shields.io/badge/OS%20Independent-Operating%20System-4051b5)
![Python :: 3: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%203-Programming%20Language-4051b5)
![Python :: 3 :: Only: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%203%20%3A%3A%20Only-Programming%20Language-4051b5)
![Python :: 3.14: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%203.14-Programming%20Language-4051b5)
![Python :: Implementation :: CPython: Programming Language](https://img.shields.io/badge/Python%20%3A%3A%20Implementation%20%3A%3A%20CPython-Programming%20Language-4051b5)
![Documentation: Topic](https://img.shields.io/badge/Documentation-Topic-4051b5)
![Software Development :: Code Generators: Topic](https://img.shields.io/badge/Software%20Development%20%3A%3A%20Code%20Generators-Topic-4051b5)
![Software Development :: Documentation: Topic](https://img.shields.io/badge/Software%20Development%20%3A%3A%20Documentation-Topic-4051b5)
![Text Processing :: Markup :: Markdown: Topic](https://img.shields.io/badge/Text%20Processing%20%3A%3A%20Markup%20%3A%3A%20Markdown-Topic-4051b5)
![Typed: Typing](https://img.shields.io/badge/Typed-Typing-4051b5)
Html

Example: Colored

Note

Jinja

{{ "required_python" | MkMetadataBadges(badge_color="red") }}

Note

Python

MkMetadataBadges('required_python', badge_color='red')
Rendered

Python: >=3.14

Markdown
[![Python: >=3.14](https://img.shields.io/badge/Python-%3E%3D3.14-red)](https://python.org)
Html
<p><a href="https://python.org"><img src="https://img.shields.io/badge/Python-red" alt="Python" /></a></p>

Repr tree
MkMetadataBadges
╰── MkBadge('Python', '>=3.14', badge_color='red')
DocStrings

class MkMetadataBadges(mkcontainer.MkContainer)
Base classes
NameChildrenInherits
MkContainer
mknodes.basenodes.mkcontainer
A node containing other MkNodes.
⋔ Inheritance diagram
graph TD
  4160346072["mkmetadatabadges.MkMetadataBadges"]
  835538629["mkcontainer.MkContainer"]
  1956333208["mkcontainer.MkContainerBase"]
  1359323199["mknode.MkNode"]
  2751680898["builtins.object"]
  835538629 --> 4160346072
  1956333208 --> 835538629
  1359323199 --> 1956333208
  2751680898 --> 1359323199
NodeFile

/home/runner/work/mknodes/mknodes/src/mknodes/templatenodes/mkmetadatabadges/metadata.toml

[metadata]
name = "MkMetadataBadges"
icon = "simple-icons:shieldsdotio"
status = "new"
group = "badge"
virtual_children = true

[requirements.package.anybadge]

[examples.classifiers]
title = "Classifiers"
jinja = """
{{ "classifiers" | MkMetadataBadges }}
"""

[examples.keywords]
title = "Keywords"
jinja = """
{{ "keywords" | MkMetadataBadges }}
"""

[examples.keywords_combined]
title = "Keywords combined"
jinja = """
{{ "keywords_combined" | MkMetadataBadges }}
"""

[examples.websites]
title = "Websites"
jinja = """
{{ "websites" | MkMetadataBadges }}
"""

[examples.dependencies]
title = "Dependencies"
jinja = """
{{ "dependencies" | MkMetadataBadges }}
"""

[examples.other_packages]
title = "For other packages"
jinja = """
{{ "dependencies" | MkMetadataBadges(package="mkdocs") }}
"""

[examples.gitlab]
title = "Gitlab style"
jinja = """
{{ "classifiers" | MkMetadataBadges(use_gitlab_style=True) }}
"""

[examples.colored]
title = "Colored"
jinja = """
{{ "required_python" | MkMetadataBadges(badge_color="red") }}
"""

[output.markdown]
template = """
{% filter rstrip %}
{% for label, value, link in node.badge_content %}
{{ label | MkBadge(value=value, target=link, font_size=node.font_size, font_name=node.font_name, badge_color=node.badge_color, text_color=node.text_color, num_padding_chars=node.num_padding_chars, use_gitlab_style=node.use_gitlab_style, title=label) }}
{% endfor %}
{% endfilter %}
"""

Code

mknodes.templatenodes.mkmetadatabadges.MkMetadataBadges

class MkMetadataBadges(mkcontainer.MkContainer):
    """Container node for a list of metadata badges.

    Badges are generated locally using "anybadge" package
    """

    ICON = "simple/shieldsdotio"
    STATUS = "new"
    VIRTUAL_CHILDREN = True

    def __init__(
        self,
        typ: datatypes.MetadataTypeStr,
        *,
        package: str | None = None,
        font_size: Literal[10, 11, 12] | None = None,
        font_name: str | None = None,
        num_padding_chars: int | None = None,
        badge_color: str | None = None,
        text_color: str | None = None,
        use_gitlab_style: bool = False,
        block_separator: str = "\n",
        **kwargs: Any,
    ) -> None:
        """Constructor.

        Args:
            typ: Metadata badges to show
            package: Package to show badges for. If None, it will get pulled from project
            font_size: Size of font to use
            font_name: Name of font to use
            num_padding_chars: Number of chars to use for padding
            badge_color: Badge color. If none is set, it will be pulled from project.
            text_color: Badge color
            use_gitlab_style: Use Gitlab-scope style
            block_separator: Divider to use between badges
            kwargs: Keyword arguments passed to parent
        """
        super().__init__(block_separator=block_separator, **kwargs)
        self._package = package
        self.typ = typ
        self.font_size: Literal[10, 11, 12] | None = font_size
        self.font_name = font_name
        self.num_padding_chars = num_padding_chars
        self.badge_color = badge_color
        self.text_color = text_color
        self.use_gitlab_style = use_gitlab_style

    @property
    def badge_content(self) -> list[tuple[str, str | None, str | None]]:  # noqa: PLR0911
        ctx = packageregistry.get_info(self._package) if self._package else self.ctx.metadata
        match self.typ:
            case "classifiers":
                items: list[tuple[str, str | None, str | None]] = []
                for category, labels in ctx.classifier_map.items():
                    items.extend([(i, category, None) for i in labels])
                return items
            case "keywords":
                return [(keyword, "", None) for keyword in ctx.keywords]
            case "keywords_combined":
                return [("Keywords", " | ".join(ctx.keywords), None)]
            case "required_python":
                return [("Python", ctx.required_python_version, "https://python.org")]
            case "websites":
                return [(name, parse.urlparse(url).netloc, url) for name, url in ctx.urls.items()]
            case "dependencies":
                return [(p.name, p.version, p.homepage) for p in ctx.required_packages]
            case "installed_packages":
                return [
                    (p.name, p.version, p.homepage)
                    for p in packageregistry.get_installed_packages()
                ]
            case str():
                raise ValueError(self.typ)
            case _ if self.typ in datatypes.CLASSIFIERS:
                labels = ctx.classifier_map.get(self.typ, [])
                return [(i, self.typ, None) for i in labels]

    def get_items(self) -> list[mknode.MkNode]:
        """Return computed badge items."""
        return [
            mkbadge.MkBadge(
                label=label,
                value=value,
                target=link,
                font_size=self.font_size,
                font_name=self.font_name,
                badge_color=self.badge_color,
                text_color=self.text_color,
                num_padding_chars=self.num_padding_chars,
                use_gitlab_style=self.use_gitlab_style,
                title=label,
                parent=self,
            )
            for label, value, link in self.badge_content
        ]

Page info
Code for this page

mknodes.manual.nodes_section.create_section_for_nodes

def create_section_for_nodes(
    nav: mk.MkNav,
    klasses: Sequence[type[mk.MkNode]],
) -> mk.MkTable:
    table = mk.MkTable(columns=["Node", "Docstrings", "Markdown extensions"])
    for kls in klasses:
        tpl = "classpage_custom.jinja"
        page = mk.MkClassPage(kls, icon=kls.ICON, template_path=tpl, parent=nav, hide="toc")
        nav += page
        if kls.STATUS:
            page.metadata.status = kls.STATUS
        elif kls.JS_FILES:
            page.metadata.status = "js"
        elif kls.CSS:
            page.metadata.status = "css"
        page.created_by = create_section_for_nodes
        link = mk.MkLink(page, kls.__name__, icon=kls.ICON)
        extensions = ", ".join(f"`{i}`" for i in kls.REQUIRED_EXTENSIONS)
        table.add_row((link, kls.__doc__, extensions))
    return table

Resources
Resources(css=[],
          markdown_extensions={'admonition': {},
                               'pymdownx.details': {},
                               'pymdownx.highlight': {'anchor_linenums': True,
                                                      'line_spans': '__span',
                                                      'pygments_lang_class': True},
                               'pymdownx.superfences': {'custom_fences': [{'class': 'mermaid',
                                                                           'format': <function fence_code_format at 0x7d707a397060>,
                                                                           'name': 'mermaid'}]},
                               'pymdownx.tabbed': {},
                               'tables': {}},
          plugins=[Plugin('mkdocstrings')],
          js=[],
          assets=[],
          packages=[])
Metadata
created:
  source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/nodes_section.py
  source_function: create_section_for_nodes
  source_line_no: 93
hide:
- toc
icon: simple/shieldsdotio
status: new
title: MkMetadataBadges