Sha256: 23b8d89734bb0ffb36934a95204578afe7e2f62cb60e7ec2ecd582c046e3b855

Contents?: true

Size: 692 Bytes

Versions: 23

Compression:

Stored size: 692 Bytes

Contents

'use strict'

var uri = require('../util/enclose-uri')
var title = require('../util/enclose-title')

module.exports = definition

var space = ' '
var colon = ':'
var leftSquareBracket = '['
var rightSquareBracket = ']'

// Stringify an URL definition.
//
// Is smart about enclosing `url` (see `encloseURI()`) and `title` (see
// `encloseTitle()`).
//
// ```markdown
// [foo]: <foo at bar dot com> 'An "example" e-mail'
// ```
function definition(node) {
  var content = uri(node.url)

  if (node.title) {
    content += space + title(node.title)
  }

  return (
    leftSquareBracket +
    (node.label || node.identifier) +
    rightSquareBracket +
    colon +
    space +
    content
  )
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-5.0.7 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-5.0.6 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-5.0.5 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-5.0.4 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-5.0.3 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-5.0.2 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-5.0.1 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.3.5 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-5.0.0 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.3.4 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.3.3 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.3.2 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.3.1 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.3 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.2.3 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.2.2 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.2.1 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.2 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.1.9 node_modules/remark-stringify/lib/visitors/definition.js
trusty-cms-4.1.8 node_modules/remark-stringify/lib/visitors/definition.js