diff --git a/lib/linkify/parser.ex b/lib/linkify/parser.ex index 7011d10..8102d9e 100644 --- a/lib/linkify/parser.ex +++ b/lib/linkify/parser.ex @@ -130,6 +130,11 @@ defmodule Linkify.Parser do defp do_parse({"<" <> text, user_acc}, opts, {"", acc, :parsing}), do: do_parse({text, user_acc}, opts, {"<", acc, {:open, 1}}) + defp do_parse({"<" <> text, user_acc}, opts, {buffer, acc, :parsing}) do + {buffer, user_acc} = link(buffer, opts, user_acc) + do_parse({text, user_acc}, opts, {"", accumulate(acc, buffer, "<"), {:open, 1}}) + end + defp do_parse({">" <> text, user_acc}, opts, {buffer, acc, {:attrs, _level}}), do: do_parse({text, user_acc}, opts, {"", accumulate(acc, buffer, ">"), :parsing}) diff --git a/test/linkify_test.exs b/test/linkify_test.exs index 09214de..6da502f 100644 --- a/test/linkify_test.exs +++ b/test/linkify_test.exs @@ -369,6 +369,13 @@ defmodule LinkifyTest do "

hello world

\n

<`em>another @user__test and @user__test google.com paragraph

\n" assert Linkify.link(text, mention: true, mention_prefix: "u/") == expected + + text = "

hi

@user @anotherUser

" + + expected = + "

hi

@user @anotherUser

" + + assert Linkify.link(text, mention: true, mention_prefix: "u/") == expected end test "mention @user@example.com" do