@redpanda-data/docs-extensions-and-macros 5.38.2 → 5.38.3

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.
@@ -98,7 +98,9 @@ Two more things come from the same registry:
98
98
  * The licensing feature tables on the licensing pages are *generated* from it (`enterprise_features::redpanda[]` and friends), so the tables can never disagree with the registry.
99
99
  * `doc-tools validate enterprise-features` compares the registry against the actual license gates in Redpanda's source code and Connect's plugin list. When engineering ships a new license-gated feature, CI fails until someone decides its documented name -- naming stays a human decision, but forgetting is no longer possible.
100
100
 
101
- Like properties, feature links adapt to context: registry entries can carry Kubernetes- and Cloud-specific pages, chosen by the page's environment attributes.
101
+ Like properties, feature links adapt to context: registry entries can carry a Kubernetes-specific page, chosen by the page's environment attributes.
102
+
103
+ Cloud is different from Kubernetes here, not just another context to adapt to. Redpanda Cloud has no Enterprise Edition license, so on a page in a Cloud component `enterprise:` renders as plain text -- no styling, tooltip, or link -- the same way `prop:` renders a non-`cloud_supported` property as plain code there, and `enterprise_features::[]` renders nothing at all: no table and no admonition, because a note about a macro belongs to the writer, not the reader. Both macros report the Cloud page to the build log according to `enterprise-validate`, naming the page. That includes the Cloud rendering of single-sourced self-managed prose: the check reads the page actually being converted, regardless of which repo the mention was written in. See link:REFERENCE.adoc#cloud-pages[Cloud pages] in the macros reference.
102
104
 
103
105
  == Where to see all of this working
104
106
 
@@ -85,7 +85,7 @@ The macro target is the feature name, which can contain spaces. Named attributes
85
85
  xref::
86
86
  Optional Antora resource ID of the feature's documentation page. Overrides the registry entry's link. When neither is set, the term links to the licensing page.
87
87
  +
88
- Registry entries can carry environment-specific pages: on pages with the `env-cloud` attribute the entry's `xref-cloud` is used, on pages with `env-kubernetes` the entry's `xref-kubernetes` is used, and otherwise the entry's default `xref` (the Linux or generic self-managed page). This mirrors the `config_ref` macro's environment awareness.
88
+ Registry entries can carry a Kubernetes-specific page: on pages with the `env-kubernetes` attribute the entry's `xref-kubernetes` is used, and otherwise the entry's default `xref` (the Linux or generic self-managed page). This mirrors the `config_ref` macro's environment awareness. There is no Cloud counterpart -- see <<cloud-pages>>.
89
89
 
90
90
  text::
91
91
  Optional display text override. Use it when the sentence needs different casing or phrasing than the feature name.
@@ -113,6 +113,15 @@ Set to `false` to render the term without a link.
113
113
  enterprise-beta-badge::
114
114
  Set to `false` to suppress the beta badge in prose. Generated tables always show it. See <<beta-features>>.
115
115
 
116
+ [[cloud-pages]]
117
+ === Cloud pages
118
+
119
+ Redpanda Cloud has no Enterprise Edition license -- customers never apply or manage one -- so a page in a Cloud component (recognized by its `env-cloud` attribute) has nothing true to say about a license, its expiration, or its restrictions. On such a page the macro renders the target as plain text with no styling, tooltip, or link, skipping registry validation and the release-status checks below entirely, and reports the mention according to `enterprise-validate`.
120
+
121
+ This also covers the Cloud rendering of single-sourced self-managed prose: `env-cloud` is read from the document being converted, which reflects the page actually being rendered (the Cloud stub page), regardless of which repo the included `enterprise:` mention was written in. See the `prop` macro's <<prop-availability>> for the same mechanism applied to properties.
122
+
123
+ The `enterprise_features` block macro is affected too: see <<cloud-pages-block>>.
124
+
116
125
  [[release-status]]
117
126
  === Release status
118
127
 
@@ -195,7 +204,7 @@ enterprise_features::connect[]
195
204
  enterprise_features::operator[title=Operator features,heading=What stops working]
196
205
  ----
197
206
 
198
- The target is the scope: `redpanda`, `console`, `connect`, `operator`, or `cloud`. Rows render alphabetically by feature name with three columns: the feature name (linked to its documentation page when the entry has an `xref` or `url`), the description, and the expiration or restriction behavior. Named attributes:
207
+ The target is the scope: `redpanda`, `console`, `connect`, or `operator`. Rows render alphabetically by feature name with three columns: the feature name (linked to its documentation page when the entry has an `xref` or `url`), the description, and the expiration or restriction behavior. Named attributes:
199
208
 
200
209
  title::
201
210
  Optional table title override. The default is scope-specific, for example `Enterprise features in Redpanda`.
@@ -203,6 +212,9 @@ Optional table title override. The default is scope-specific, for example `Enter
203
212
  heading::
204
213
  Optional third-column heading override. The default is `Behavior Upon Expiration` for the `redpanda` scope and `Restrictions Without Valid License` for the other scopes.
205
214
 
215
+ [[cloud-pages-block]]
216
+ There is no `cloud` scope: Redpanda Cloud has no Enterprise Edition license, so there is no licensing table to generate for it (see <<cloud-pages>>). Calling this macro from a page in a Cloud component -- directly or through single-sourced self-managed content -- renders nothing: no table and no admonition. The diagnostic goes to the build log, reported according to `enterprise-validate` and naming the page, so it reaches the writer and never the reader.
217
+
206
218
  === Registration
207
219
 
208
220
  Registered together with the `enterprise` inline macro.
@@ -37,6 +37,15 @@
37
37
  * the same way an unreleased feature renders on released docs, because as
38
38
  * of that page's version the feature had not shipped yet.
39
39
  *
40
+ * Redpanda Cloud has no Enterprise Edition license -- customers never apply
41
+ * or manage one -- so both macros treat a page in a Cloud component
42
+ * (env-cloud) as having no enterprise feature to mark or list at all. The
43
+ * inline macro renders plain text with no styling, tooltip, or link, and the
44
+ * block macro renders nothing instead of a licensing table; both report to
45
+ * the build log according to enterprise-validate. This also covers the Cloud rendering of
46
+ * single-sourced self-managed prose: the document reflects the page being
47
+ * converted, regardless of which repo the included prose was written in.
48
+ *
40
49
  * Document or site attributes:
41
50
  *
42
51
  * enterprise-validate 'warn' (default) to log unknown feature names,
@@ -62,6 +71,7 @@
62
71
  const yaml = require('js-yaml')
63
72
  const semver = require('semver')
64
73
  const { buildBadgeHtml, DEFAULT_TOOLTIPS } = require('./badge')
74
+ const { isAttributeSet } = require('./prop')
65
75
  const logger = require('@antora/logger')('enterprise-macro')
66
76
 
67
77
  const $enterpriseRegistry = Symbol('$enterpriseRegistry')
@@ -181,6 +191,42 @@ function isPrereleasePage (config, document) {
181
191
  return Boolean(componentVersion && componentVersion.prerelease)
182
192
  }
183
193
 
194
+ /**
195
+ * Whether the page being converted belongs to a Cloud component.
196
+ *
197
+ * Read from the document rather than the component's antora.yml, because the
198
+ * document is what reflects a Cloud stub page's own attributes even when its
199
+ * content came from an included self-managed file -- the same mechanism
200
+ * resolveEntryXref already relied on for env-cloud.
201
+ *
202
+ * The value test is prop.js's isAttributeSet, so `env-cloud: false` reads as
203
+ * unset in both places. The two readers are still not interchangeable:
204
+ * prop.js asks the CATALOG about the page's component, while this asks the
205
+ * DOCUMENT being converted, which is the whole point above.
206
+ * rp-connect-components.js still uses a bare `!== undefined` for env-cloud,
207
+ * so `env-cloud: false` reads as Cloud there. Worth aligning separately, but
208
+ * not from here.
209
+ */
210
+ function isCloudPage (document) {
211
+ return isAttributeSet(document && document.getAttribute('env-cloud'))
212
+ }
213
+
214
+ /**
215
+ * Report an enterprise: mention or enterprise_features::[] call on a page
216
+ * belonging to a Cloud component. Redpanda Cloud has no Enterprise Edition
217
+ * license, so nothing about a license, its expiration, or its restrictions
218
+ * is true there.
219
+ */
220
+ function reportNoLicenseOnCloud ({ call, mode, filePath }) {
221
+ if (mode === 'off') return
222
+ const where = filePath ? ` in ${filePath}` : ''
223
+ const message =
224
+ `${call}${where}: this page belongs to a Cloud component, and Redpanda Cloud has no Enterprise Edition license. ` +
225
+ 'Reword the content for Cloud instead of relying on this macro, or wrap it in ifndef::env-cloud[] if the same prose is single-sourced to a non-Cloud page too.'
226
+ if (mode === 'error') throw new Error(message)
227
+ logger.warn(message)
228
+ }
229
+
184
230
  /**
185
231
  * Render the release-status badge for a registry entry.
186
232
  *
@@ -310,14 +356,15 @@ function buildBetaBadgeAsciiDoc (entry) {
310
356
  return html ? `pass:[${html}]` : ''
311
357
  }
312
358
  const REGISTRY_FILENAME = 'enterprise-features.yml'
313
- const VALID_SCOPES = ['redpanda', 'console', 'connect', 'operator', 'cloud']
359
+ // No 'cloud' scope: Redpanda Cloud has no Enterprise Edition license, so
360
+ // there is no licensing table to generate for it. See isCloudPage.
361
+ const VALID_SCOPES = ['redpanda', 'console', 'connect', 'operator']
314
362
 
315
363
  const TABLE_TITLES = {
316
364
  redpanda: 'Enterprise features in Redpanda',
317
365
  console: 'Enterprise features in Redpanda Console',
318
366
  connect: 'Enterprise features in Redpanda Connect',
319
367
  operator: 'Enterprise features in the Redpanda Operator',
320
- cloud: 'Enterprise features in Redpanda Cloud',
321
368
  }
322
369
 
323
370
  const THIRD_COLUMN_HEADINGS = {
@@ -438,12 +485,15 @@ function reportUnknownFeature ({ feature, mode, registry, filePath }) {
438
485
  }
439
486
 
440
487
  /**
441
- * Pick the environment-appropriate feature page from a registry entry.
442
- * Some features have separate documentation for Kubernetes, Linux
443
- * (self-managed), and Redpanda Cloud. Mirrors the config_ref macro's
444
- * environment-awareness: the env-cloud and env-kubernetes page attributes
445
- * select the xref-cloud and xref-kubernetes registry fields, falling back
446
- * to the default xref.
488
+ * Pick the environment-appropriate feature page from a registry entry. Some
489
+ * features have separate documentation for Kubernetes and Linux
490
+ * (self-managed). Mirrors the config_ref macro's environment-awareness: the
491
+ * env-kubernetes page attribute selects the xref-kubernetes registry field,
492
+ * falling back to the default xref.
493
+ *
494
+ * No Cloud counterpart: a page in a Cloud component never reaches this
495
+ * function, because isCloudPage short-circuits the inline macro to plain
496
+ * text first. See isCloudPage.
447
497
  *
448
498
  * @param {object} entry - Registry entry.
449
499
  * @param {object} document - Asciidoctor document (for env attributes).
@@ -451,7 +501,6 @@ function reportUnknownFeature ({ feature, mode, registry, filePath }) {
451
501
  */
452
502
  function resolveEntryXref (entry, document) {
453
503
  if (!entry) return undefined
454
- if (document.getAttribute('env-cloud') !== undefined && entry['xref-cloud']) return entry['xref-cloud']
455
504
  if (document.getAttribute('env-kubernetes') !== undefined && entry['xref-kubernetes']) return entry['xref-kubernetes']
456
505
  return entry.xref
457
506
  }
@@ -577,6 +626,16 @@ function enterpriseInlineMacro (config) {
577
626
  self.$option('regexp', /enterprise:([^[]+)\[(|.*?[^\\])\]/)
578
627
  self.process(function (parent, target, attributes) {
579
628
  const document = parent.getDocument()
629
+ const mode = document.getAttribute('enterprise-validate', 'warn')
630
+ const filePath = config && config.file && config.file.src && config.file.src.path
631
+ if (isCloudPage(document)) {
632
+ // Redpanda Cloud has no Enterprise Edition license, so there is
633
+ // nothing to validate against the registry, no status to gate on,
634
+ // and no styling that would be true here. Bail out before any of
635
+ // that runs, the same way an unrecognized name bails out below.
636
+ reportNoLicenseOnCloud({ call: `enterprise:${target}[]`, mode, filePath })
637
+ return self.createInline(parent, 'quoted', attributes.text || target)
638
+ }
580
639
  let registry
581
640
  if (config && config.contentCatalog) {
582
641
  registry = loadRegistry(config)
@@ -591,14 +650,12 @@ function enterpriseInlineMacro (config) {
591
650
  } else {
592
651
  reportUnknownFeature({
593
652
  feature: target,
594
- mode: document.getAttribute('enterprise-validate', 'warn'),
653
+ mode,
595
654
  registry,
596
- filePath: config && config.file && config.file.src && config.file.src.path,
655
+ filePath,
597
656
  })
598
657
  }
599
658
  }
600
- const mode = document.getAttribute('enterprise-validate', 'warn')
601
- const filePath = config && config.file && config.file.src && config.file.src.path
602
659
  const status = entryStatus(entry, { mode, filePath, contentCatalog: config && config.contentCatalog })
603
660
  if (status === STATUS_UNRELEASED && !isPrereleasePage(config, document)) {
604
661
  // Documented for an upcoming release, referenced from released docs.
@@ -654,6 +711,23 @@ function enterpriseFeaturesBlockMacro (config) {
654
711
  if (!VALID_SCOPES.includes(scope)) {
655
712
  throw new Error(`enterprise_features::[] needs a scope of ${VALID_SCOPES.join(', ')} as its target, got '${scope}'.`)
656
713
  }
714
+ const document = parent.getDocument()
715
+ if (isCloudPage(document)) {
716
+ // Same reasoning as the inline macro: no license, no table.
717
+ reportNoLicenseOnCloud({
718
+ call: `enterprise_features::${scope}[]`,
719
+ mode: document.getAttribute('enterprise-validate', 'warn'),
720
+ filePath: config && config.file && config.file.src && config.file.src.path,
721
+ })
722
+ // Render NOTHING, not an admonition. The message is internal tooling
723
+ // language aimed at a writer, and all three docs-site playbooks run
724
+ // with enterprise-validate: warn, so an admonition here would ship to
725
+ // docs.redpanda.com and tell a reader about a macro. The diagnostic
726
+ // belongs in the build log, which reportNoLicenseOnCloud just wrote,
727
+ // and it names the page. This also makes the inline and block macros
728
+ // behave the same way on Cloud, which the docs claim.
729
+ return undefined
730
+ }
657
731
  const registry = config && config.contentCatalog ? loadRegistry(config) : undefined
658
732
  if (!registry) {
659
733
  warnNoRegistry(config && config.contentCatalog)
@@ -663,13 +737,13 @@ function enterpriseFeaturesBlockMacro (config) {
663
737
  title: attributes.title,
664
738
  heading: attributes.heading,
665
739
  report: {
666
- mode: parent.getDocument().getAttribute('enterprise-validate', 'warn'),
740
+ mode: document.getAttribute('enterprise-validate', 'warn'),
667
741
  filePath: config && config.file && config.file.src && config.file.src.path,
668
742
  contentCatalog: config && config.contentCatalog,
669
743
  },
670
744
  // Prerelease docs describe the upcoming release, so they list features
671
745
  // that are still only in a release candidate.
672
- includeUnreleased: isPrereleasePage(config, parent.getDocument()),
746
+ includeUnreleased: isPrereleasePage(config, document),
673
747
  config,
674
748
  })
675
749
  // A block anchor before the macro call ([[my-id]]) is consumed into the
package/macros/prop.js CHANGED
@@ -1012,6 +1012,7 @@ module.exports.propertyAnchor = propertyAnchor
1012
1012
  module.exports.helmValuesPath = helmValuesPath
1013
1013
  module.exports.loadPropertiesFor = loadPropertiesFor
1014
1014
  module.exports.compareTags = compareTags
1015
+ module.exports.isAttributeSet = isAttributeSet
1015
1016
  module.exports.isPrerelease = isPrerelease
1016
1017
  module.exports.releaseSeries = releaseSeries
1017
1018
  module.exports.extractHeadingsWithTags = extractHeadingsWithTags
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "5.38.2",
3
+ "version": "5.38.3",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -14,7 +14,9 @@
14
14
  const yaml = require('js-yaml')
15
15
  const semver = require('semver')
16
16
 
17
- const VALID_SCOPES = ['redpanda', 'console', 'connect', 'operator', 'cloud']
17
+ // Mirrors macros/enterprise.js: no 'cloud' scope, because Redpanda Cloud has
18
+ // no Enterprise Edition license.
19
+ const VALID_SCOPES = ['redpanda', 'console', 'connect', 'operator']
18
20
  const SOURCE_KINDS = ['core-enum', 'core-property', 'connect-plugin', 'manual']
19
21
 
20
22
  function finding (level, check, message) {