fix readme examples

This commit is contained in:
Egor Kislitsyn 2019-02-08 19:28:38 +07:00
parent b2dd560888
commit e8470008ec

View file

@ -27,6 +27,7 @@ end
The following examples illustrate some examples on how to use the auto linker.
```iex
iex> AutoLinker.link("google.com")
"<a href='http://google.com' class='auto-linker' target='_blank' rel='noopener noreferrer'>google.com</a>"
@ -36,17 +37,18 @@ iex> AutoLinker.link("google.com", new_window: false, rel: false)
iex> AutoLinker.link("google.com", new_window: false, rel: false, class: false)
"<a href='http://google.com'>google.com</a>"
iex> AutoLinker.link("call me at x9999")
~s{call me at <a href="" class="phone-number" data-number="9999">x9999</a>}
iex> AutoLinker.link("call me at x9999", phone: true)
"call me at <a href=\"#\" class=\"phone-number\" data-phone=\"9999\">x9999</a>"
iex> AutoLinker.link("or at home on 555.555.5555")
~s{or at home on <a href="" class="phone-number" data-number="55555555555">555.555.5555</a>}
iex> AutoLinker.link("or at home on 555.555.5555", phone: true)
"or at home on <a href=\"#\" class=\"phone-number\" data-phone=\"5555555555\">555.555.5555</a>"
iex> AutoLinker.link(", work (555) 555-5555")
~s{, work <a href="" class="phone-number" data-number="5555555555">(555) 555-5555</a>}
iex> AutoLinker.link(", work (555) 555-5555", phone: true)
", work <a href=\"#\" class=\"phone-number\" data-phone=\"5555555555\">(555) 555-5555</a>"
iex> AutoLinker.link("[Google Search](http://google.com)", markdown: true)
"<a href='http://google.com' class='auto-linker' target='_blank' rel='noopener noreferrer'>Google Search</a>"
```
See the [Docs](https://hexdocs.pm/auto_linker/) for more examples