core: fix markdown for trailing / and ) characters in the links (#4357)

This commit is contained in:
Evgeny Poberezkin
2024-06-29 08:41:21 +01:00
committed by GitHub
parent d8126e0cd0
commit fab3827697
2 changed files with 11 additions and 2 deletions
+6 -2
View File
@@ -222,11 +222,15 @@ markdownP = mconcat <$> A.many' fragmentP
wordMD s
| T.null s = unmarked s
| isUri s =
let t = T.takeWhileEnd isPunctuation s
uri = uriMarkdown $ T.dropWhileEnd isPunctuation s
let t = T.takeWhileEnd isPunctuation' s
uri = uriMarkdown $ T.dropWhileEnd isPunctuation' s
in if T.null t then uri else uri :|: unmarked t
| isEmail s = markdown Email s
| otherwise = unmarked s
isPunctuation' = \case
'/' -> False
')' -> False
c -> isPunctuation c
uriMarkdown s = case strDecode $ encodeUtf8 s of
Right cReq -> markdown (simplexUriFormat cReq) s
_ -> markdown Uri s