mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 21:52:28 +00:00
core: support **text** as bold markdown (#7444)
Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
1 parent
d131173e83
commit
f71b132536
2 files changed
+30
-3
No files matched your search
@@ -211,7 +211,7 @@ markdownP = mconcat <$> A.many' fragmentP
|
||||
Just c -> case c of
|
||||
' ' -> unmarked <$> A.takeWhile (== ' ')
|
||||
'+' -> phoneP <|> wordP
|
||||
'*' -> formattedP '*' Bold
|
||||
'*' -> boldP <|> formattedP '*' Bold
|
||||
'_' -> formattedP '_' Italic
|
||||
'~' -> formattedP '~' StrikeThrough
|
||||
'`' -> formattedP '`' Snippet
|
||||
@@ -233,6 +233,12 @@ markdownP = mconcat <$> A.many' fragmentP
|
||||
| T.null s || T.head s == ' ' || T.last s == ' ' =
|
||||
unmarked $ c `T.cons` s `T.snoc` c
|
||||
| otherwise = markdown f s
|
||||
boldP :: Parser Markdown
|
||||
boldP = do
|
||||
s <- A.string "**" *> A.takeTill (== '*') <* A.string "**"
|
||||
if T.null s || T.head s == ' ' || T.last s == ' '
|
||||
then fail "not bold"
|
||||
else pure $ markdown Bold s
|
||||
secretP :: Parser Markdown
|
||||
secretP = secret <$?> ((,,) <$> A.takeWhile (== '#') <*> A.takeTill (== '#') <*> A.takeWhile1 (== '#'))
|
||||
secret :: (Text, Text, Text) -> Either String Markdown
|
||||
|
||||
Reference in new issue
Block a user