This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/remark-stringify/lib/visitors/link-reference.js
2020-11-01 22:46:04 +00:00

28 lines
612 B
JavaScript

'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)
}