lib/compiler.js
function urlize(worker, text) {
  if (!linkify.test(text)) return escape(text)
  var matches = linkify.match(text)
  var lastIndex = 0;
  var buf = []
  for (var i = 0, match; (match = matches[i++]); ) {
    buf.push(escape(text.slice(lastIndex, match.index)))
    var link = {tag: true, name: 'a',
                attrs: {href: match.url}, 
                value: escape(match.type === 'hashtag' ? match.text : truncateUrl(match.text))}
    if (match.type === 'hashtag') {
      link.attrs['class'] = 'p-category'
    }
    else {
      link.attrs.rel = 'nofollow'
      link.attrs.target = '_blank'
    }
    buf = buf.concat(tagBuffer(worker, link, true))
    lastIndex = match.lastIndex
  }
  buf.push(escape(text.slice(lastIndex)))
  debug('urlize', matches, buf)
  return buf.join('')
}
function urlize(worker, text) {
  if (!linkify.test(text)) return escape(text)
  var matches = linkify.match(text)
  var lastIndex = 0;
  var buf = []
  for (var i = 0, match; (match = matches[i++]); ) {
    buf.push(escape(text.slice(lastIndex, match.index)))
    var link = {tag: true, name: 'a',
                attrs: {href: match.url}, 
                value: escape(match.type === 'hashtag' ? match.text : truncateUrl(match.text))}
    if (match.type === 'hashtag') {
      link.attrs['class'] = 'p-category'
    }
    else {
      link.attrs.rel = 'nofollow'
      link.attrs.target = '_blank'
    }
    buf = buf.concat(tagBuffer(worker, link, true))
    lastIndex = match.lastIndex
  }
  buf.push(escape(text.slice(lastIndex)))
  debug('urlize', matches, buf)
  return buf.join('')
}
function urlize ( worker , text ) { if ( ! linkify . test ( text ) ) return escape ( text ) var matches = linkify . match ( text ) var lastIndex = 0 ; var buf = [ ] for ( var i = 0 , match ; ( match = matches [ i ++ ] ) ; ) { buf . push ( escape ( text . slice ( lastIndex , match . index ) ) ) var link = { tag : true , name : 'a' , attrs : { href : match . url } , value : escape ( match . type === 'hashtag' ? match . text : truncateUrl ( match . text ) ) } if ( match . type === 'hashtag' ) { link . attrs [ 'class' ] = 'p-category' } else { link . attrs . rel = 'nofollow' link . attrs . target = '_blank' } buf = buf . concat ( tagBuffer ( worker , link , true ) ) lastIndex = match . lastIndex } buf . push ( escape ( text . slice ( lastIndex ) ) ) debug ( 'urlize' , matches , buf ) return buf . join ( '' ) }
Escape and urlize text.
Escape and urlize text .