Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (15 sloc) 1.22 KB

Javascript Text Indexer

Javascript implementation of a text indexer that scans the given text content for email address, URLs, phone numbers, and emoticons.


Executes the indexer on string, returning the text with all linkable content replaced with anchors or images.

Under webOS Mojo applications this library will replace the system defined Mojo.Format.runTextIndexer. If this behavior is not desired then these lines should be removed:

// Mojo Framework override. Unused on non-Mojo platforms and may be removed if undesired in Mojo apps
if (window.Mojo && Mojo.Format) {
    // Override the Mojo API if it exists in this context.
    Mojo.Format.runTextIndexer = runTextIndexer;


This method is not HTML aware. Passing content that contains existing HTML elements could produce invalid HTML. Callers should scrub HTML content before displaying.


As processing human-generated content can be somewhat complex and have ambiguous meaning this indexer generally attempts to take a more conservative route when deciding to replace content. That being said if there are cases where the content is not properly linked please file an issue within this github repository.

Jump to Line
Something went wrong with that request. Please try again.