JavaScript Linkify: Process links in text!

Version: 0.3, Last updated: 6/27/2009

Project Homehttp://benalman.com/projects/javascript-linkify/
GitHubhttp://github.com/cowboy/javascript-linkify/
Sourcehttp://github.com/cowboy/javascript-linkify/raw/master/ba-linkify.js
(Minified)http://github.com/cowboy/javascript-linkify/raw/master/ba-linkify.min.js (2.8kb)
Summary
JavaScript Linkify: Process links in text!Version: 0.3, Last updated: 6/27/2009
LicenseCopyright © 2009 “Cowboy” Ben Alman, Dual licensed under the MIT and GPL licenses.
ExamplesThis working example, complete with fully commented code, illustrates one way in which this code can be used.
Support and TestingInformation about what browsers this code has been tested in.
Release History
Functions
linkifyTurn text into linkified html.

License

Copyright © 2009 “Cowboy” Ben Alman, Dual licensed under the MIT and GPL licenses.  http://benalman.com/about/license/

Examples

This working example, complete with fully commented code, illustrates one way in which this code can be used.

Linkifyhttp://benalman.com/code/projects/javascript-linkify/examples/linkify/

Support and Testing

Information about what browsers this code has been tested in.

Browsers TestedInternet Explorer 6-8, Firefox 2-3.7, Safari 3-4, Chrome, Opera 9.6-10.

Release History

0.3(6/27/2009) Initial release

Functions

linkify

Turn text into linkified html.

Usage

var html = linkify( text [, options ] );

Arguments

text(String) Non-HTML text containing links to be parsed.
options(Object) An optional object containing linkify parse options.

Options

callback (Function)If specified, this will be called once for each link- or non-link-chunk with two arguments, text and href.  If the chunk is non-link, href will be omitted.  If unspecified, the default linkification callback is used.
punct_regexp (RegExp)A RegExp that will be used to trim trailing punctuation from links, instead of the default.  If set to null, trailing punctuation will not be trimmed.

Returns

(String) An HTML string containing links.

Close