defmodule AutoLinker do
@moduledoc """
Create url links from text containing urls.
Turns an input string like `"Check out google.com"` into
`Check out `"google.com"`
## Examples
iex> AutoLinker.link("google.com")
"google.com"
iex> AutoLinker.link("google.com", new_window: false, rel: false)
"google.com"
iex> AutoLinker.link("google.com", new_window: false, rel: false, class: false)
"google.com"
"""
import AutoLinker.Parser
@doc """
Auto link a string.
"""
def link(text, opts \\ []) do
opts =
:auto_linker
|> Application.get_all_env()
|> Keyword.merge(opts)
parse text, opts
end
end