Git Product home page Git Product logo

node-autolinks's Introduction

autolinks

Automatically turn URL's into links

Installation

To use locally

npm install autolinks

To use the command line tool autolinks

npm install -g autolinks

Example

var autolinks = require('autolinks');

var s = 'my email is [email protected] and my homepage is http://www.daveeddy.com';
console.log(s);
console.log('html => %s', autolinks(s));
console.log('markdown => %s', autolinks(s, 'markdown'));

yields

my email is [email protected] and my homepage is http://www.daveeddy.com
html => my email is <a href="mailto:[email protected]">[email protected]</a> and my homepage is <a href="http://www.daveeddy.com">http://www.daveeddy.com</a>
markdown => my email is [[email protected]](mailto:[email protected]) and my homepage is [http://www.daveeddy.com](http://www.daveeddy.com)

Usage

autolinks(s, [fmt])

  • s: the string to parse
  • fmt: an optional format string (markdown, html, etc.) html is default

returns the parsed string

Command Line

$ echo 'a link to google http://www.google.com here' | autolinks
a link to google <a href="http://www.google.com">http://www.google.com</a> here
$ echo 'a link to google http://www.google.com here' | autolinks markdown
a link to google [http://www.google.com](http://www.google.com) here

License

MIT License

node-autolinks's People

Contributors

bahamas10 avatar

Watchers

Linus Unnebäck avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.