Sha256: d18c55d33fb06f6609f866ea7784370b8cb266ebb97ac937dea125fcb57b28ad

Contents?: true

Size: 759 Bytes

Versions: 23

Compression:

Stored size: 759 Bytes

Contents

'use strict'

var identity = require('./identity')

module.exports = enter

// Shortcut and collapsed link references need no escaping and encoding during
// the processing of child nodes (it must be implied from identifier).
//
// This toggler turns encoding and escaping off for shortcut and collapsed
// references.
//
// Implies `enterLink`.
function enter(compiler, node) {
  var encode = compiler.encode
  var escape = compiler.escape
  var exitLink = compiler.enterLink()

  if (node.referenceType !== 'shortcut' && node.referenceType !== 'collapsed') {
    return exitLink
  }

  compiler.escape = identity
  compiler.encode = identity

  return exit

  function exit() {
    compiler.encode = encode
    compiler.escape = escape
    exitLink()
  }
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-4.1.7 node_modules/remark-stringify/lib/util/enter-link-reference.js
trusty-cms-4.1.6 node_modules/remark-stringify/lib/util/enter-link-reference.js
trusty-cms-4.1.5 node_modules/remark-stringify/lib/util/enter-link-reference.js