AutoLinker v0.2.1 AutoLinker.Parser
Module to handle parsing the the input string.
Link to this section Summary
Functions
Parse the given string, identifying items to link
Link to this section Functions
Link to this function
check_and_link(buffer, scheme, opts)
Link to this function
check_and_link_phone(buffer, _, opts)
Link to this function
link_phone(list, buffer, opts)
Link to this function
parse(text, opts \\ %{})
Parse the given string, identifying items to link.
Parses the string, replacing the matching urls and phone numbers with an html link.
Examples
iex> AutoLinker.Parser.parse("Check out google.com")
"Check out <a href='http://google.com' class='auto-linker' target='_blank' rel='noopener noreferrer'>google.com</a>"
iex> AutoLinker.Parser.parse("call me at x9999", phone: true)
~s{call me at <a href="#" class="phone-number" data-phone="9999">x9999</a>}
iex> AutoLinker.Parser.parse("or at home on 555.555.5555", phone: true)
~s{or at home on <a href="#" class="phone-number" data-phone="5555555555">555.555.5555</a>}
iex> AutoLinker.Parser.parse(", work (555) 555-5555", phone: true)
~s{, work <a href="#" class="phone-number" data-phone="5555555555">(555) 555-5555</a>}