@redpanda-data/docs-extensions-and-macros 3.2.6 → 3.2.7
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/macros/glossary.js +5 -4
- package/package.json +1 -1
package/macros/glossary.js
CHANGED
|
@@ -91,9 +91,10 @@ module.exports.register = function (registry, config = {}) {
|
|
|
91
91
|
self.named('glossterm')
|
|
92
92
|
//Specifying the regexp allows spaces in the term.
|
|
93
93
|
self.$option('regexp', /glossterm:([^[]+)\[(|.*?[^\\])\]/)
|
|
94
|
-
self.positionalAttributes(['definition'])
|
|
94
|
+
self.positionalAttributes(['definition', 'customText']);
|
|
95
95
|
self.process(function (parent, target, attributes) {
|
|
96
96
|
const term = attributes.term || target
|
|
97
|
+
const customText = attributes.customText || term;
|
|
97
98
|
const document = parent.document
|
|
98
99
|
const context = vfs.getContext()
|
|
99
100
|
const customLinkCandidate = context.gloss.find(candidate => 'link' in candidate && candidate.term === term);
|
|
@@ -136,10 +137,10 @@ module.exports.register = function (registry, config = {}) {
|
|
|
136
137
|
const termExistsInContext = context.gloss.some((candidate) => candidate.term === term);
|
|
137
138
|
if ((termExistsInContext && links) || (links && customLink)) {
|
|
138
139
|
inline = customLink
|
|
139
|
-
? self.createInline(parent, 'anchor',
|
|
140
|
-
: self.createInline(parent, 'anchor',
|
|
140
|
+
? self.createInline(parent, 'anchor', customText, { type: 'link', target: customLink, attributes: { ...attrs, window: '_blank', rel: 'noopener noreferrer' } })
|
|
141
|
+
: self.createInline(parent, 'anchor', customText, { type: 'xref', target: `${glossaryPage}#${termId(term)}`, reftext: customText, attributes: attrs })
|
|
141
142
|
} else {
|
|
142
|
-
inline = self.createInline(parent, 'quoted',
|
|
143
|
+
inline = self.createInline(parent, 'quoted', customText, { attributes: attrs })
|
|
143
144
|
}
|
|
144
145
|
if (tooltip) {
|
|
145
146
|
const a = inline.convert()
|