diff --git a/lib/auto_linker/parser.ex b/lib/auto_linker/parser.ex
index 946ae1d..8a0522d 100644
--- a/lib/auto_linker/parser.ex
+++ b/lib/auto_linker/parser.ex
@@ -62,17 +62,18 @@ defmodule AutoLinker.Parser do
defp do_parse(text, %{phone: false} = opts), do: do_parse(text, Map.delete(opts, :phone))
defp do_parse(text, %{url: false} = opts), do: do_parse(text, Map.delete(opts, :url))
- defp do_parse(text, %{markdown: true} = opts) do
- text
- |> Builder.create_markdown_links(opts)
- |> do_parse(Map.delete(opts, :markdown))
- end
defp do_parse(text, %{phone: _} = opts) do
text
|> do_parse(false, opts, {"", "", :parsing}, &check_and_link_phone/3)
|> do_parse(Map.delete(opts, :phone))
end
+ defp do_parse(text, %{markdown: true} = opts) do
+ text
+ |> Builder.create_markdown_links(opts)
+ |> do_parse(Map.delete(opts, :markdown))
+ end
+
defp do_parse(text, %{url: _} = opts) do
if (exclude = Map.get(opts, :exclude_pattern, false)) && String.starts_with?(text, exclude) do
text
diff --git a/test/auto_linker_test.exs b/test/auto_linker_test.exs
index 079ddb7..1ffb972 100644
--- a/test/auto_linker_test.exs
+++ b/test/auto_linker_test.exs
@@ -23,4 +23,10 @@ defmodule AutoLinkerTest do
"google.com"
end
+ test "phone number and markdown link" do
+ assert AutoLinker.link("888 888-8888 [ab](a.com)", phone: true, markdown: true) ==
+ "888 888-8888" <>
+ " ab"
+ end
+
end