File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -146,13 +146,10 @@ function _is_link(s::AbstractString)
146
146
end
147
147
148
148
# non-normative regex from the HTML5 spec
149
- const _email_regex = r" ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\. [a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
149
+ const _email_regex = r" ^mailto \: [a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\. [a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
150
150
151
151
function _is_mailto (s:: AbstractString )
152
- length (s) < 6 && return false
153
- # slicing strings is a bit risky, but this equality check is safe
154
- lowercase (s[1 : 6 ]) == " mailto:" || return false
155
- return occursin (_email_regex, s[6 : end ])
152
+ return occursin (_email_regex, s)
156
153
end
157
154
158
155
# –––––––––––
Original file line number Diff line number Diff line change @@ -1230,3 +1230,11 @@ end
1230
1230
@test sprint (show, MIME (" text/plain" ), s) == " Misc:\n - line"
1231
1231
end
1232
1232
1233
+ @testset " issue #42139: autolink" begin
1234
+ # ok
1235
+ @test md " <mailto:foo@bar.com>" |> html == """ <p><a href="mailto:foo@bar.com">mailto:foo@bar.com</a></p>\n """
1236
+ # not ok
1237
+ @test md " <mailto foo@bar.com>" |> html == """ <p><mailto foo@bar.com></p>\n """
1238
+ # see issue #42139
1239
+ @test md " <一轮红日初升>" |> html == """ <p><一轮红日初升></p>\n """
1240
+ end
You can’t perform that action at this time.
0 commit comments