feat(integrations): link setup option names to detailed configuration sections (#21897)
integrations: link setup option names to detail sections
Ilya Mashchenko committed
Mar 5, 2026 at 19:41 UTC
f0b15c983f4eca249d6f5f300f18c63aee1a803f
2 files changed
+21
-4
integrations/gen_integrations.py
+12
-1
@@ -191,7 +191,7 @@ def get_jinja_env():
191
lstrip_blocks=True,
192
)
193
194
- _jinja_env.globals.update(strfy=strfy)
194
+ _jinja_env.globals.update(strfy=strfy, anchorfy=anchorfy)
195
196
return _jinja_env
197
@@ -204,6 +204,17 @@ def strfy(value):
204
return value
205
206
207
+def anchorfy(value):
208
+ if value is None:
209
+ return ''
210
+
211
+ anchor = str(value).strip().lower()
212
+ anchor = re.sub(r'[^a-z0-9]+', '-', anchor)
213
+ anchor = re.sub(r'-{2,}', '-', anchor).strip('-')
214
+
215
+ return anchor
216
+
217
+
218
def get_category_sets(categories):
219
default = set()
220
valid = set()
integrations/templates/setup.md
+9
-3
@@ -63,19 +63,25 @@ No action required.
63
|:------|:-----|:------------|:--------|:---------:|
64
[% set ns = namespace(last_group=None) %]
65
[% for item in entry.setup.configuration.options.list %]
66
-| [[ ("**" ~ item.group ~ "**") if (item.group is defined and item.group != ns.last_group) else "" ]] | [[ strfy(item.name) ]] | [[ strfy(item.description) ]] | [[ strfy(item.default_value) ]] | [[ strfy(item.required) ]] |
66
+[% set anchor_source = (item.group ~ "-" ~ item.name) if (item.group is defined and item.group) else item.name %]
67
+[% set item_anchor = "option-" ~ anchorfy(anchor_source) %]
68
+| [[ ("**" ~ item.group ~ "**") if (item.group is defined and item.group != ns.last_group) else "" ]] | [[ ("[" ~ strfy(item.name) ~ "](#" ~ item_anchor ~ ")") if ('detailed_description' in item) else strfy(item.name) ]] | [[ strfy(item.description) ]] | [[ strfy(item.default_value) ]] | [[ strfy(item.required) ]] |
69
[% set ns.last_group = item.group if item.group is defined else ns.last_group %]
70
[% endfor %]
71
[% else %]
72
| Option | Description | Default | Required |
73
|:-----|:------------|:--------|:---------:|
74
[% for item in entry.setup.configuration.options.list %]
73
-| [[ strfy(item.name) ]] | [[ strfy(item.description) ]] | [[ strfy(item.default_value) ]] | [[ strfy(item.required) ]] |
75
+[% set anchor_source = (item.group ~ "-" ~ item.name) if (item.group is defined and item.group) else item.name %]
76
+[% set item_anchor = "option-" ~ anchorfy(anchor_source) %]
77
+| [[ ("[" ~ strfy(item.name) ~ "](#" ~ item_anchor ~ ")") if ('detailed_description' in item) else strfy(item.name) ]] | [[ strfy(item.description) ]] | [[ strfy(item.default_value) ]] | [[ strfy(item.required) ]] |
78
[% endfor %]
79
[% endif %]
80
81
[% for item in entry.setup.configuration.options.list %]
82
[% if 'detailed_description' in item %]
83
+[% set anchor_source = (item.group ~ "-" ~ item.name) if (item.group is defined and item.group) else item.name %]
84
+<a id="[[ "option-" ~ anchorfy(anchor_source) ]]"></a>
85
##### [[ item.name ]]
86
87
[[ item.detailed_description ]]
@@ -165,4 +171,4 @@ There are no configuration examples.
171
172
[% endif %]
173
[% endif %]
168
-[% endif %]
\ No newline at end of file
174
+[% endif %]