mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-29 01:09:15 +00:00
android: show markdown in messages (#361)
* android: show markdown in messages * empty line
This commit is contained in:
@@ -32,7 +32,7 @@ data Format
|
||||
| StrikeThrough
|
||||
| Snippet
|
||||
| Secret
|
||||
| Colored {formatColor :: FormatColor}
|
||||
| Colored {color :: FormatColor}
|
||||
| Uri
|
||||
| Email
|
||||
| Phone
|
||||
@@ -178,13 +178,13 @@ markdownP = mconcat <$> A.many' fragmentP
|
||||
ss = b <> s <> a
|
||||
coloredP :: Parser Markdown
|
||||
coloredP = do
|
||||
color <- A.takeWhile (\c -> c /= ' ' && c /= colorMD)
|
||||
case M.lookup color colors of
|
||||
cStr <- A.takeWhile (\c -> c /= ' ' && c /= colorMD)
|
||||
case M.lookup cStr colors of
|
||||
Just c ->
|
||||
let f = Colored c
|
||||
in (A.char ' ' *> formattedP colorMD (color `T.snoc` ' ') f)
|
||||
<|> noFormat (colorMD `T.cons` color)
|
||||
_ -> noFormat (colorMD `T.cons` color)
|
||||
in (A.char ' ' *> formattedP colorMD (cStr `T.snoc` ' ') f)
|
||||
<|> noFormat (colorMD `T.cons` cStr)
|
||||
_ -> noFormat (colorMD `T.cons` cStr)
|
||||
wordsP :: Parser Markdown
|
||||
wordsP = do
|
||||
word <- wordMD <$> A.takeTill (== ' ')
|
||||
|
||||
@@ -83,8 +83,8 @@ data ChatItem (c :: ChatType) (d :: MsgDirection) = ChatItem
|
||||
deriving (Show, Generic)
|
||||
|
||||
instance ToJSON (ChatItem c d) where
|
||||
toJSON = J.genericToJSON J.defaultOptions
|
||||
toEncoding = J.genericToEncoding J.defaultOptions
|
||||
toJSON = J.genericToJSON J.defaultOptions {J.omitNothingFields = True}
|
||||
toEncoding = J.genericToEncoding J.defaultOptions {J.omitNothingFields = True}
|
||||
|
||||
data CIDirection (c :: ChatType) (d :: MsgDirection) where
|
||||
CIDirectSnd :: CIDirection 'CTDirect 'MDSnd
|
||||
|
||||
Reference in New Issue
Block a user