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.
- 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
- Create simple demo/docs
Install the module with:
npm install linksoup
var linksoup = require'linksoup';var text = "...";var spans = linksoupparseSpanstext;
###Browser / Client side
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
The Jasmine harness for node is installed globally (to facilitate command-line execution):
npm install jasmine-node -g
From the root project directory (along side
Copyright (c) 2012 Elliott B. Edwards
Licensed under the MIT license.