@redpanda-data/docs-extensions-and-macros 5.2.4 → 5.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "5.2.4",
3
+ "version": "5.2.5",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -31,14 +31,26 @@ module.exports = function renderConnectFields(children, prefix = '') {
31
31
  const isArrayTitle = typeof child.name === 'string' && child.name.endsWith('[]');
32
32
  if (isArrayTitle) {
33
33
  displayType = 'array<object>';
34
- } else if (child.type === 'string' && child.kind === 'array') {
35
- displayType = 'array';
36
- } else if (child.type === 'unknown' && child.kind === 'map') {
34
+ } else if (child.kind === 'map') {
35
+ // Maps always render as `object`, regardless of value type.
37
36
  displayType = 'object';
38
- } else if (child.type === 'unknown' && child.kind === 'array') {
39
- displayType = 'array';
40
- } else if (child.type === 'unknown' && child.kind === 'list') {
41
- displayType = 'array';
37
+ } else if (child.kind === 'array' || child.kind === 'list' || child.kind === '2darray') {
38
+ // Arrays render as `array<element>` when the element type is known,
39
+ // for example `array<string>`. 2D arrays nest the element type, for
40
+ // example `array<array<string>>`. Unknown element types render as
41
+ // plain `array`. A `type` of `array` (used by some overrides to force
42
+ // the old plain-array display) is treated as unknown so the field
43
+ // renders as `array` rather than the degenerate `array<array>`.
44
+ const elementType = (typeof child.type === 'string' && child.type !== '' && child.type !== 'unknown' && child.type !== 'array')
45
+ ? child.type
46
+ : null;
47
+ if (elementType) {
48
+ displayType = child.kind === '2darray'
49
+ ? `array<array<${elementType}>>`
50
+ : `array<${elementType}>`;
51
+ } else {
52
+ displayType = 'array';
53
+ }
42
54
  } else {
43
55
  displayType = child.type;
44
56
  }