MkMetadataBadges

github Show source on GitHub

Container node for a list of metadata badges.

Description

Badges are generated locally using “anybadge” package

Example: Classifiers

Jinja

{{ "classifiers" | MkMetadataBadges }}

Python

MkMetadataBadges('classifiers')

4 - Beta: Development Status Developers: Intended Audience OS Independent: Operating System Python :: 3: Programming Language Python :: 3 :: Only: Programming Language Python :: 3.14: Programming Language Python :: Implementation :: CPython: Programming Language Documentation: Topic Software Development :: Code Generators: Topic Software Development :: Documentation: Topic Text Processing :: Markup :: Markdown: Topic Typed: Typing

![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)

Example: Keywords

Jinja

{{ "keywords" | MkMetadataBadges }}

Python

MkMetadataBadges('keywords')

api-documentation docs-as-code documentation documentation-generator jinja2 markdown static-site-generator zensical

![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)

Example: Keywords combined

Jinja

{{ "keywords_combined" | MkMetadataBadges }}

Python

MkMetadataBadges('keywords_combined')

Keywords: api-documentation | docs-as-code | documentation | documentation-generator | jinja2 | markdown | static-site-generator | zensical

![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)
<p><img src="https://img.shields.io/badge/Keywords-blue" alt="Keywords" /></p>
MkMetadataBadges
╰── MkBadge('Keywords', 'api-documentation | docs-as-code | documentation | documentation-generator | jinja2 | markdown | static-site-generator | zensical')

Example: Websites

Jinja

{{ "websites" | MkMetadataBadges }}

Python

MkMetadataBadges('websites')

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

[![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)

Example: Dependencies

Jinja

{{ "dependencies" | MkMetadataBadges }}

Python

MkMetadataBadges('dependencies')

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 furo: 2025.12.19 myst-parser: 5.2.0 Sphinx: 9.2.0 sphinx_design: 0.8.0

[![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)

Example: For other packages

Jinja

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

Python

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

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

[![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/)
<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>
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

Jinja

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

Python

MkMetadataBadges('classifiers', use_gitlab_style=True)

4 - Beta: Development Status Developers: Intended Audience OS Independent: Operating System Python :: 3: Programming Language Python :: 3 :: Only: Programming Language Python :: 3.14: Programming Language Python :: Implementation :: CPython: Programming Language Documentation: Topic Software Development :: Code Generators: Topic Software Development :: Documentation: Topic Text Processing :: Markup :: Markdown: Topic Typed: Typing

![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)

Example: Colored

Jinja

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

Python

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

Python: >=3.14

[![Python: >=3.14](https://img.shields.io/badge/Python-%3E%3D3.14-red)](https://python.org)
<p><a href="https://python.org"><img src="https://img.shields.io/badge/Python-red" alt="Python" /></a></p>
MkMetadataBadges
╰── MkBadge('Python', '>=3.14', badge_color='red')

class MkMetadataBadges(mkcontainer.MkContainer)

Name

Children

Inherits

MkContainer
mknodes.basenodes.mkcontainer
A node containing other MkNodes.

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
/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 %}
"""
mknodes.templatenodes.mkmetadatabadges.MkMetadataBadges
 17class MkMetadataBadges(mkcontainer.MkContainer):
 18    """Container node for a list of metadata badges.
 19
 20    Badges are generated locally using "anybadge" package
 21    """
 22
 23    ICON = "simple/shieldsdotio"
 24    STATUS = "new"
 25    VIRTUAL_CHILDREN = True
 26
 27    def __init__(
 28        self,
 29        typ: datatypes.MetadataTypeStr,
 30        *,
 31        package: str | None = None,
 32        font_size: Literal[10, 11, 12] | None = None,
 33        font_name: str | None = None,
 34        num_padding_chars: int | None = None,
 35        badge_color: str | None = None,
 36        text_color: str | None = None,
 37        use_gitlab_style: bool = False,
 38        block_separator: str = "\n",
 39        **kwargs: Any,
 40    ) -> None:
 41        """Constructor.
 42
 43        Args:
 44            typ: Metadata badges to show
 45            package: Package to show badges for. If None, it will get pulled from project
 46            font_size: Size of font to use
 47            font_name: Name of font to use
 48            num_padding_chars: Number of chars to use for padding
 49            badge_color: Badge color. If none is set, it will be pulled from project.
 50            text_color: Badge color
 51            use_gitlab_style: Use Gitlab-scope style
 52            block_separator: Divider to use between badges
 53            kwargs: Keyword arguments passed to parent
 54        """
 55        super().__init__(block_separator=block_separator, **kwargs)
 56        self._package = package
 57        self.typ = typ
 58        self.font_size: Literal[10, 11, 12] | None = font_size
 59        self.font_name = font_name
 60        self.num_padding_chars = num_padding_chars
 61        self.badge_color = badge_color
 62        self.text_color = text_color
 63        self.use_gitlab_style = use_gitlab_style
 64
 65    @property
 66    def badge_content(self) -> list[tuple[str, str | None, str | None]]:  # noqa: PLR0911
 67        ctx = packageregistry.get_info(self._package) if self._package else self.ctx.metadata
 68        match self.typ:
 69            case "classifiers":
 70                items: list[tuple[str, str | None, str | None]] = []
 71                for category, labels in ctx.classifier_map.items():
 72                    items.extend([(i, category, None) for i in labels])
 73                return items
 74            case "keywords":
 75                return [(keyword, "", None) for keyword in ctx.keywords]
 76            case "keywords_combined":
 77                return [("Keywords", " | ".join(ctx.keywords), None)]
 78            case "required_python":
 79                return [("Python", ctx.required_python_version, "https://python.org")]
 80            case "websites":
 81                return [(name, parse.urlparse(url).netloc, url) for name, url in ctx.urls.items()]
 82            case "dependencies":
 83                return [(p.name, p.version, p.homepage) for p in ctx.required_packages]
 84            case "installed_packages":
 85                return [
 86                    (p.name, p.version, p.homepage)
 87                    for p in packageregistry.get_installed_packages()
 88                ]
 89            case str():
 90                raise ValueError(self.typ)
 91            case _ if self.typ in datatypes.CLASSIFIERS:
 92                labels = ctx.classifier_map.get(self.typ, [])
 93                return [(i, self.typ, None) for i in labels]
 94
 95    def get_items(self) -> list[mknode.MkNode]:
 96        """Return computed badge items."""
 97        return [
 98            mkbadge.MkBadge(
 99                label=label,
100                value=value,
101                target=link,
102                font_size=self.font_size,
103                font_name=self.font_name,
104                badge_color=self.badge_color,
105                text_color=self.text_color,
106                num_padding_chars=self.num_padding_chars,
107                use_gitlab_style=self.use_gitlab_style,
108                title=label,
109                parent=self,
110            )
111            for label, value, link in self.badge_content
112        ]
Page info
Code for this page
mknodes.manual.nodes_section.create_section_for_nodes
 93def create_section_for_nodes(
 94    nav: mk.MkNav,
 95    klasses: Sequence[type[mk.MkNode]],
 96) -> mk.MkTable:
 97    table = mk.MkTable(columns=["Node", "Docstrings", "Markdown extensions"])
 98    for kls in klasses:
 99        tpl = "classpage_custom.jinja"
100        page = mk.MkClassPage(kls, icon=kls.ICON, template_path=tpl, parent=nav, hide="toc")
101        nav += page
102        if kls.STATUS:
103            page.metadata.status = kls.STATUS
104        elif kls.JS_FILES:
105            page.metadata.status = "js"
106        elif kls.CSS:
107            page.metadata.status = "css"
108        page.created_by = create_section_for_nodes
109        link = mk.MkLink(page, kls.__name__, icon=kls.ICON)
110        extensions = ", ".join(f"`{i}`" for i in kls.REQUIRED_EXTENSIONS)
111        table.add_row((link, kls.__doc__, extensions))
112    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 0x7ff77e88b060>,
                                                                           '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