Convert plain text to html with url, line break, list recognition
The htmlize can convert plain text to html with recognition for:
Convert an url to an <a/>
tag.
- normal url
- email address
Convert a line break to a <br/>
.
Convert a line of content that is composed by only with more than 3 -
to a horizontal line.
Order list signs:
- digit with one or more whitespaces (
2 hello
) - digit + dot with one or more whitespaces (
3. world
)
Unorder list signs
*
with one or more whitespaces (* hello
)-
with one or more whitespaces (- hello
)
http://fudesign2008.github.io/htmlize/test.html
htmlize.htmlize(text)
For example:
var plainText = 'xxxx...',
html = window.htmlize.htmlize(plainText),
container = document.getElementById('container')
if (container) {
container.innerHTML = html
}
If you have any advice, please feel free to contact with me: [email protected]