How to use the commonmark/lib/common.escapeXml function in commonmark

To help you get started, we’ve selected a few commonmark 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 threepointone / markdown-in-js / src / jsx.js View on Github external
image(node, entering) {
    if (entering) {
      if (this.disableTags === 0) {
        if (this.options.safe && potentiallyUnsafe(node.destination)) {
          this.lit('<_m_.img src="" alt="')
        } else {
          this.lit('<_m_.img src="' + esc(node.destination, true) +
                '" alt="')
        }
      }
      this.disableTags += 1
    } else {
      this.disableTags -= 1
      if (this.disableTags === 0) {
        if (node.title) {
          this.lit('" title="' + esc(node.title, true))
        }
        this.lit('" />')
      }
    }
  }
github threepointone / markdown-in-js / src / jsx.js View on Github external
code_block(node) {

    let info_words = node.info ? node.info.split(/\s+/) : []
      , attrs = this.attrs(node)
    if (info_words.length > 0 && info_words[0].length > 0) {
      attrs.push([ 'className', 'language-' + esc(info_words[0], true) ])
    }
    this.cr()
    this.tag('_m_.pre')
    this.tag('_m_.code', attrs)
    this.out(`{\`${node.literal}\`}`)
    this.tag('/_m_.code')
    this.tag('/_m_.pre')
    this.cr()
  }
github threepointone / markdown-in-js / src / jsx.js View on Github external
image(node, entering) {
    if (entering) {
      if (this.disableTags === 0) {
        if (this.options.safe && potentiallyUnsafe(node.destination)) {
          this.lit('<_m_.img src="" alt="')
        } else {
          this.lit('<_m_.img src="' + esc(node.destination, true) +
                '" alt="')
        }
      }
      this.disableTags += 1
    } else {
      this.disableTags -= 1
      if (this.disableTags === 0) {
        if (node.title) {
          this.lit('" title="' + esc(node.title, true))
        }
        this.lit('" />')
      }
    }
  }
github threepointone / markdown-in-js / src / jsx.js View on Github external
link(node, entering) {
    let attrs = this.attrs(node)
    if (entering) {
      if (!(this.options.safe && potentiallyUnsafe(node.destination))) {
        attrs.push([ 'href', esc(node.destination, true) ])
      }
      if (node.title) {
        attrs.push([ 'title', esc(node.title, true) ])
      }
      this.tag('_m_.a', attrs)
    } else {
      this.tag('/_m_.a')
    }
  }
github threepointone / markdown-in-js / src / jsx.js View on Github external
link(node, entering) {
    let attrs = this.attrs(node)
    if (entering) {
      if (!(this.options.safe && potentiallyUnsafe(node.destination))) {
        attrs.push([ 'href', esc(node.destination, true) ])
      }
      if (node.title) {
        attrs.push([ 'title', esc(node.title, true) ])
      }
      this.tag('_m_.a', attrs)
    } else {
      this.tag('/_m_.a')
    }
  }

commonmark

a strongly specified, highly compatible variant of Markdown

BSD-2-Clause
Latest version published 4 months ago

Package Health Score

77 / 100
Full package analysis