a javascript library that parses and exposes links found in string data


With a name inspired by the arcane art of tag soup parsing, linksoup seeks to handle links embedded into text in a robust and safe way.

When given a string:

var text = "Visit [my site]( ""automanual"") (or";

linksoup returns structured data as "spans":

var spans = [{
  text: "Visit "
  text: "my site",
  title: "automanual",
  href: ""
  text: " (or "
  href: ""
  text: ")"

that allows you to represent the "link soup" in a templating system (with appropriate escaping) and rendering to HTML.


This project is in an "alpha" status, and not yet suitable for casual use.

###To Do

  • Port twitter-text
    • make routines lint friend(lier)
    • remove unused/irrelevant routines
    • adapt url test cases
  • Support markdown style links
  • Ensure multi-use code
    • browser wrapper
    • node.js
  • Create simple demo/docs

##Getting Started


Install the module with: npm install linksoup

var linksoup = require('linksoup');
var text = "...";
var spans = linksoup.parseSpans(text);

###Browser / Client side

(Coming soon)

(Coming soon)

(Coming soon)

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

linksoup uses grunt.js...

Tests are defined as Jasmine specs and launched via jasmine-node. Like the code itself, some test cases are adapted from the twitter-text project.

####Initial setup:

The Jasmine harness for node is installed globally (to facilitate command-line execution):

npm install jasmine-node -g

####Running tests:

From the root project directory (along side grunt.js), run:

jasmine-node spec

(Nothing yet)


Copyright (c) 2012 Elliott B. Edwards
Licensed under the MIT license.