How to use the mdast-util-to-hast/lib/revert function in mdast-util-to-hast

To help you get started, we’ve selected a few mdast-util-to-hast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt / markdown / src / handlers / image-reference.js View on Github external
export default function imageReference (h, node) {
  const def = h.definition(node.identifier)

  if (!def) {
    return revert(h, node)
  }

  const props = { src: normalize(def.url || ''), alt: node.alt }

  if (def.title !== null && def.title !== undefined) {
    props.title = def.title
  }

  return h(node, 'img', props)
}
github nuxt / markdown / src / handlers / link-reference.js View on Github external
export default function linkReference (h, node) {
  const def = h.definition(node.identifier)

  if (!def) {
    return revert(h, node)
  }

  const props = { href: normalize(def.url || '') }

  if (def.title !== null && def.title !== undefined) {
    props.title = def.title
  }

  return h(node, 'a', props, all(h, node))
}

mdast-util-to-hast

mdast utility to transform to hast

MIT
Latest version published 6 months ago

Package Health Score

82 / 100
Full package analysis