'use strict'

const entities = require('html-entities').XmlEntities.encode
const Autolinker = require('autolinker')

const out = (input) => {
  return Autolinker.link(entities(input))
}

const line = (input) => {
  return '<span>' + out(input) + '</span>'
}

const list = (input) => {
  const items = input.reduce((result, item) => {
    result += '<li class="list-item">' + out(item) + '</li>'
    return result
  }, '')
  return '<ul class="list">' + items + '</ul>'
}

module.exports = (input) => {
  if (input === undefined) return '<div>&nbsp;</div>'
  else if (typeof input === 'string') return line(input)
  else if (Array.isArray(input)) return list(input)
}

@@ -160,16 +160,21 @@
 er.link(
+%0A    
 entities
@@ -180,16 +180,207 @@
 s(input)
+,%0A    %7B%0A      urls: %7B schemeMatches: true, wwwMatches: false, tldMatches: false %7D,%0A      phone: false,%0A      hashtag: false,%0A      stripPrefix: false,%0A      stripTrailingSlash: false%0A    %7D%0A  
 )%0A%7D%0A%0Acon

Make autolinker less magic