4.1.2 • Published 5 years ago
ember-linkify v4.1.2
ember-linkify
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
ember install 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 <script>alert("xss!");</script>'}}
Or with a variable bound to an input
{{textarea value=text placeholder='Enter some text with a url'}}
{{linkify text}}
You can specify options to the helper such as 'urlLength' which shortens the URL by 'urlLength' and add 3 dots to the end
{{linkify text urlLength=30}}
The 'defaultScheme' option specifies a scheme to use for URLs that don’t already have one.
For instance, the following will ensure that the https
scheme is used for the created link:
{{linkify 'Link without a scheme: www.foo.com' defaultScheme='https'}}
Also use options to specify attributes you want to add to the generated anchor tags. Currently, "target", "rel" and "class" are the only recognized attributes.
{{linkify text target='_blank' rel='nofollow' class='external-link'}}
Development
Installation
git clone
this repositorycd my-addon
npm install
Running
ember server
- Visit your app at http://localhost:4200.
Running Tests
ember test
ember test --server
ember try:each
– Runs the test suite against multiple Ember versions
Building
ember build
For more information on using ember-cli
, visit http://www.ember-cli.com/.
License
MIT
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Crafted with <3 by John Otander(@4lpine).
4.1.2
5 years ago
4.0.0
6 years ago
3.0.0
7 years ago
2.6.0
7 years ago
2.5.1
8 years ago
2.5.0
8 years ago
2.4.0
8 years ago
2.3.1
8 years ago
2.3.0
8 years ago
2.2.0
8 years ago
2.1.0
8 years ago
2.0.0
9 years ago
1.2.2
9 years ago
1.2.1
9 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.1.5
9 years ago
0.1.4
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago
0.1.0
9 years ago
0.0.5
9 years ago
0.0.4
9 years ago
0.0.3
9 years ago
0.0.2
9 years ago
0.0.1
9 years ago