Do not break hashtag at zwnj
This commit is contained in:
parent
123dbb0fd6
commit
3599ccf759
2 changed files with 13 additions and 1 deletions
|
@ -15,7 +15,7 @@ defmodule Linkify.Parser do
|
|||
|
||||
@get_scheme_host ~r{^\W*(?<scheme>https?:\/\/)?(?:[^@\n]+\\w@)?(?<host>[^:#~\/\n?]+)}u
|
||||
|
||||
@match_hashtag ~r/^(?<tag>\#[[:word:]_]*[[:alpha:]_·][[:word:]_·\p{M}]*)/u
|
||||
@match_hashtag ~r/^(?<tag>\#[[:word:]_]*[[:alpha:]_·\x{200c}][[:word:]_·\p{M}\x{200c}]*)/u
|
||||
|
||||
@match_skipped_tag ~r/^(?<tag>(a|code|pre)).*>*/
|
||||
|
||||
|
|
|
@ -555,6 +555,18 @@ defmodule LinkifyTest do
|
|||
hashtag_prefix: "https://example.com/tag/"
|
||||
) == expected
|
||||
end
|
||||
|
||||
test "ZWNJ does not break up hashtags" do
|
||||
text = "#ساٴينس"
|
||||
|
||||
expected = "<a href=\"https://example.com/tag/ساٴينس\">#ساٴينس</a>"
|
||||
|
||||
assert Linkify.link(text,
|
||||
rel: false,
|
||||
hashtag: true,
|
||||
hashtag_prefix: "https://example.com/tag/"
|
||||
) == expected
|
||||
end
|
||||
end
|
||||
|
||||
describe "links" do
|
||||
|
|
Loading…
Reference in a new issue