Skip to content

Commit 4fae625

Browse files
author
Eduard Fugarolas
committed
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.
1 parent 95fff72 commit 4fae625

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

tools/templates/plugin.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ tags: {% for tag in plugin.tags %}
2525
## Advanced Parameter
2626

2727
{{parameters_advanced if plugin.properties_advanced else "`None`"}}
28+
29+
{%- if plugin.relatedPlugins %}
30+
31+
## Related Plugins
32+
33+
{% for ref in plugin.relatedPlugins -%}
34+
- **{{ ref.id }}**{% if ref.description %} — {{ ref.description }}{% endif %}
35+
{% endfor %}
36+
{%- endif %}

tools/update_di_reference.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
def stripped_single_line(value: str) -> str:
2828
return re.sub(r"\s+", " ", value).strip()
2929

30+
class PluginReference(BaseModel):
31+
"""Reference to a related plugin."""
32+
33+
id: str
34+
description: str | None = None
35+
36+
3037
class ActionDescription(BaseModel):
3138
"""Action description"""
3239

@@ -82,6 +89,7 @@ class PluginDescription(BaseModel):
8289
is_deprecated: bool | None = None
8390
tags: list[str] = Field(default_factory=list)
8491
pluginType: str | None = None
92+
relatedPlugins: list[PluginReference] = Field(default_factory=list)
8593

8694
@model_validator(mode="after")
8795
def move_advanced_properties(self) -> Self:
@@ -173,8 +181,8 @@ def create_plugin_markdown(plugin: PluginDescription, plugin_type: str, base_dir
173181

174182
content = plugin_template.render(
175183
plugin=plugin,
176-
parameters=parameter_content,
177-
parameters_advanced=parameter_advanced_content,
184+
parameters=parameter_content.rstrip("\n"),
185+
parameters_advanced=parameter_advanced_content.rstrip("\n"),
178186
)
179187

180188
# create the file (incl. directory)

0 commit comments

Comments
 (0)