This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues or pull requests.
linkify/README.md

54 lines
1.4 KiB
Markdown
Raw Normal View History

2019-06-24 10:56:27 +00:00
# Linkify
2017-03-29 14:11:22 +00:00
2019-06-27 08:32:29 +00:00
Linkify is a basic package for turning website names into links.
2017-03-29 20:27:13 +00:00
Use this package in your web view to convert web references into click-able links.
2017-03-29 14:11:22 +00:00
## Installation
2019-06-24 10:56:27 +00:00
The package can be installed by adding `linkify` to your list of dependencies in `mix.exs`:
2017-03-29 14:11:22 +00:00
```elixir
def deps do
2020-10-07 14:55:53 +00:00
[{:linkify, "~> 0.3"}]
2017-03-29 14:11:22 +00:00
end
```
2017-03-29 20:27:13 +00:00
## Usage
2017-11-17 18:36:37 +00:00
The following examples illustrate some examples on how to use the auto linker.
```elixir
2017-03-29 20:27:13 +00:00
iex> Linkify.link("google.com")
"<a href=\"http://google.com\">google.com</a>"
2017-11-17 18:36:37 +00:00
iex> Linkify.link("google.com", class: "linkified")
"<a href=\"http://google.com\" class=\"linkified\">google.com</a>"
2017-11-17 18:36:37 +00:00
iex> Linkify.link("google.com", new_window: true)
"<a href=\"http://google.com\" target=\"_blank\">google.com</a>"
2017-11-17 18:36:37 +00:00
iex> Linkify.link("google.com", new_window: true, rel: "noopener noreferrer")
"<a href=\"http://google.com\" target=\"_blank\" rel=\"noopener noreferrer\">google.com</a>"
iex> Linkify.link("Hello @niceguy17@pleroma.com", mention: true, mention_prefix: "/users/")
"Hello <a href=\"/users/niceguy17@pleroma.com\">@niceguy17@pleroma.com</a>"
2019-02-08 12:28:38 +00:00
```
2018-01-23 00:46:47 +00:00
2019-06-24 10:56:27 +00:00
See the [Docs](https://hexdocs.pm/linkify/) for more examples
2017-03-29 20:27:13 +00:00
## Acknowledgments
2017-11-17 18:36:37 +00:00
2019-06-27 08:33:18 +00:00
This is a fork of [auto_linker](https://github.com/smpallen99/auto_linker) by [Steve Pallen](https://github.com/smpallen99).
2017-11-17 18:36:37 +00:00
2017-03-29 20:27:13 +00:00
## License
2019-06-27 08:33:18 +00:00
Copyright © 2017 E-MetroTel
2019-06-27 09:58:35 +00:00
2020-10-07 14:55:53 +00:00
Copyright © 2019-2020 Pleroma Authors
2017-03-29 20:27:13 +00:00
The source is released under the MIT License.
2017-03-29 14:11:22 +00:00
2017-03-29 20:27:13 +00:00
Check [LICENSE](LICENSE) for more information.