How to use the mdurl/encode function in mdurl

To help you get started, we’ve selected a few mdurl 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.js View on Github external
export default function link (h, node) {
  let tagName
  const url = normalize(node.url)
  const props = {}

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

  if (url.startsWith('#') || url.match(/^https?:\/\//)) {
    props.href = url
    tagName = 'a'
  } else {
    props.to = url
    tagName = 'nuxt-link'
    props['data-press-link'] = 'true'
  }

  return h(node, tagName, props, all(h, node))
github nuxt / markdown / src / handlers / image.js View on Github external
export default function image (h, node) {
  const props = {
    src: normalize(node.url),
    alt: node.alt
  }

  if (node.title !== null && node.title !== undefined) {
    props.title = node.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))
}

mdurl

URL utilities for markdown-it

MIT
Latest version published 8 months ago

Package Health Score

70 / 100
Full package analysis

Similar packages