From 4fae6257bfbb6de9a026685a50be7ee3176d0330 Mon Sep 17 00:00:00 2001 From: Eduard Fugarolas Date: Tue, 14 Apr 2026 14:58:55 +0200 Subject: [PATCH] Add relatedPlugins to the generated plugin reference documentation Adds a PluginReference Pydantic model and a relatedPlugins field to PluginDescription in update_di_reference.py, so the field is deserialized from the DI API response. Updates plugin.md to render a Related Plugins section at the bottom of each plugin page when the list is non-empty. Regenerates data/plugins.json with relatedPlugins populated on all 313 plugins, 77 of which carry non-empty lists. --- tools/templates/plugin.md | 9 +++++++++ tools/update_di_reference.py | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/templates/plugin.md b/tools/templates/plugin.md index 82ebf7e2..3f9bb736 100644 --- a/tools/templates/plugin.md +++ b/tools/templates/plugin.md @@ -25,3 +25,12 @@ tags: {% for tag in plugin.tags %} ## Advanced Parameter {{parameters_advanced if plugin.properties_advanced else "`None`"}} + +{%- if plugin.relatedPlugins %} + +## Related Plugins + +{% for ref in plugin.relatedPlugins -%} +- **{{ ref.id }}**{% if ref.description %} — {{ ref.description }}{% endif %} +{% endfor %} +{%- endif %} diff --git a/tools/update_di_reference.py b/tools/update_di_reference.py index 70b4e23d..1f0d2c07 100644 --- a/tools/update_di_reference.py +++ b/tools/update_di_reference.py @@ -27,6 +27,13 @@ def stripped_single_line(value: str) -> str: return re.sub(r"\s+", " ", value).strip() +class PluginReference(BaseModel): + """Reference to a related plugin.""" + + id: str + description: str | None = None + + class ActionDescription(BaseModel): """Action description""" @@ -82,6 +89,7 @@ class PluginDescription(BaseModel): is_deprecated: bool | None = None tags: list[str] = Field(default_factory=list) pluginType: str | None = None + relatedPlugins: list[PluginReference] = Field(default_factory=list) @model_validator(mode="after") def move_advanced_properties(self) -> Self: @@ -173,8 +181,8 @@ def create_plugin_markdown(plugin: PluginDescription, plugin_type: str, base_dir content = plugin_template.render( plugin=plugin, - parameters=parameter_content, - parameters_advanced=parameter_advanced_content, + parameters=parameter_content.rstrip("\n"), + parameters_advanced=parameter_advanced_content.rstrip("\n"), ) # create the file (incl. directory)