code: function factory(tree, options) {
    var settings = options || {}
    var dangerous = settings.allowDangerousHTML
  
    h.dangerous = dangerous
    h.definition = definitions(tree, settings)
    h.footnotes = []
    h.augment = augment
    h.handlers = xtend(handlers, settings.handlers || {})
  
    visit(tree, 'footnoteDefinition', visitor)
  
    return h
  
    // Finalise the created `right`, a hast node, from `left`, an mdast node.
    function augment(left, right) {
      var data
      var ctx
  
      // Handle `data.hName`, `data.hProperties, `hChildren`.
      if (left && 'data' in left) {
        data = left.data
  
        if (right.type === 'element' && data.hName) {
          right.tagName = data.hName
        }
  
        if (right.type === 'element' && data.hProperties) {
          right.properties = xtend(right.properties, data.hProperties)
        }
  
        if (right.children && data.hChildren) {
          right.children = data.hChildren
        }
      }
  
      ctx = left && left.position ? left : {position: left}
  
      if (!generated(ctx)) {
        right.position = {
          start: position.start(ctx),
          end: position.end(ctx)
        }
      }
  
      return right
    }
  
    // Create an element for a `node`.
    function h(node, tagName, props, children) {
      if (
        (children === undefined || children === null) &&
        typeof props === 'object' &&
        'length' in props
      ) {
        children = props
        props = {}
      }
  
      return augment(node, {
        type: 'element',
        tagName: tagName,
        properties: props || {},
        children: children || []
      })
    }
  
    function visitor(definition) {
      h.footnotes.push(definition)
    }
  }
docs: Factory to transform.