KrisHedges / ember-linkify

Linkify urls in an Ember app with a fancy helper.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ember-linkify Build Status Ember Observer Score

Linkify urls in an Ember app with a helper that uses a tested url-regex and Handlebars Utils.escapeExpression to ensure links are safe.

Installation

With ember-cli@0.1.5 or later:

ember install:addon ember-linkify

Older ember-cli versions:

npm i --save-dev ember-linkify

Usage

{{linkify post.description}}
{{linkify commentText}}

Use the helper with a raw string:

{{linkify 'Here is a link: https://google.com and some attempted XSS <script>alert("xss!");</script>'}}
{{! => 'Here is a link: <a href="https://google.com">https://google.com</a> and some attempted XSS &lt;script&gt;alert(&quot;xss!&quot;);&lt;/script&gt;'}}

Or with a variable bound to an input:

{{textarea value=text placeholder='Enter some text with a url'}}
{{linkify text}}

Development

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander(@4lpine).

About

Linkify urls in an Ember app with a fancy helper.

License:MIT License


Languages

Language:JavaScript 78.4%Language:HTML 19.8%Language:Handlebars 1.5%Language:CSS 0.4%