htmlification

Convert `plain/text` into html.


License
MIT
Install
npm install htmlification@1.0.0

Documentation

#htmlification Convert plain/text into html.

##features

  • convert line breaking character (\r\n) into br.
  • convert schema uri (any://th.in/g) into clickable a tag.
  • convert schema less uri into clickable http a tag.

##Installation install via npm

npm install htmlification 

##examples

var toHTML = require('htmlification');

var str = 'Foo http://foo.example.com' +
            '\r\n' +
            'Bar magnet://bar.example.com' +
            '\r\n' +
            'Baz baz://baz.example.com' +
            '\r\n' +
            'qux quz.example.com';

var result = toHTML(str);
console.log(result);

result would be

Foo <a href="http://foo.example.com" target="blank">http://foo.example.com</a>
<br>
Bar <a href="magnet://bar.example.com" target="blank">magnet://bar.example.com</a>
<br>
Baz <a href="baz://baz.example.com" target="blank">baz://baz.example.com</a>
<br>
qux<a href="http://quz.example.com" target="blank">quz.example.com</a>

##License MIT