'use strict' var copy = require('../util/copy-identifier-encoding') var label = require('../util/label') module.exports = linkReference var leftSquareBracket = '[' var rightSquareBracket = ']' var shortcut = 'shortcut' var collapsed = 'collapsed' function linkReference(node) { var self = this var type = node.referenceType var exit = self.enterLinkReference(self, node) var value = self.all(node).join('') exit() if (type === shortcut || type === collapsed) { value = copy(value, node.label || node.identifier) } return leftSquareBracket + value + rightSquareBracket + label(node) }