@redpanda-data/docs-extensions-and-macros 5.38.8 → 5.38.9
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.
|
@@ -261,11 +261,26 @@ function anchorIndex (contentCatalog, attachment, properties, logger) {
|
|
|
261
261
|
}
|
|
262
262
|
for (const [name, entry] of pages) {
|
|
263
263
|
if (!entry || !entry.page) continue
|
|
264
|
-
|
|
264
|
+
const anchor = propertyAnchor(name)
|
|
265
|
+
index.set(anchor, { page: entry.page, name, anchor })
|
|
266
|
+
// Legacy spelling. Before anchors replaced dots with hyphens they dropped
|
|
267
|
+
// them, so descriptions written then say <<redpandaremoteread>> for
|
|
268
|
+
// redpanda.remote.read, and some carry a stray hyphen (<<redpandastorage-mode>>).
|
|
269
|
+
// Those still name a documented property; only the spelling is old. Index
|
|
270
|
+
// the dot-and-hyphen-free form too, so they resolve to the real anchor
|
|
271
|
+
// instead of degrading to plain text and a warning on every build of every
|
|
272
|
+
// version still carrying them. A real anchor always wins over a legacy one.
|
|
273
|
+
const legacy = LEGACY_ANCHOR_PREFIX + legacyAnchorKey(name)
|
|
274
|
+
if (!index.has(legacy)) index.set(legacy, { page: entry.page, name, anchor })
|
|
265
275
|
}
|
|
266
276
|
return index
|
|
267
277
|
}
|
|
268
278
|
|
|
279
|
+
const LEGACY_ANCHOR_PREFIX = 'legacy:'
|
|
280
|
+
function legacyAnchorKey (name) {
|
|
281
|
+
return name.replace(/[.-]/g, '')
|
|
282
|
+
}
|
|
283
|
+
|
|
269
284
|
/**
|
|
270
285
|
* Rewrite <<anchor>> to an xref before conversion.
|
|
271
286
|
*
|
|
@@ -278,8 +293,8 @@ function anchorIndex (contentCatalog, attachment, properties, logger) {
|
|
|
278
293
|
function resolveInternalRefs (description, anchors, report) {
|
|
279
294
|
return description.replace(INTERNAL_REF_RX, (match, anchor, display) => {
|
|
280
295
|
const text = (display || '').trim()
|
|
281
|
-
const target = anchors.get(anchor)
|
|
282
|
-
if (target) return `xref:reference:${target.page}.adoc#${anchor}[${attrlistValue(text || `\`${target.name}\``)}]`
|
|
296
|
+
const target = anchors.get(anchor) || anchors.get(LEGACY_ANCHOR_PREFIX + legacyAnchorKey(anchor))
|
|
297
|
+
if (target) return `xref:reference:${target.page}.adoc#${target.anchor || anchor}[${attrlistValue(text || `\`${target.name}\``)}]`
|
|
283
298
|
// The anchor names no documented property, so there is nothing to link to.
|
|
284
299
|
// Asciidoctor would render a same-page fragment, and a tooltip is shown on
|
|
285
300
|
// arbitrary pages, so that link would go nowhere and still invite a click --
|