core, ui, website: small text markdown (#6697)

* core: small text markdown

* ios: small markdown

* desktop, android: small markdown

* fix font size

* small markdown on website

* update ios core library

* update bot api docs

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
This commit is contained in:
Evgeny @ SimpleX Chat
2026-03-21 18:06:23 +00:00
committed by GitHub
co-authored by Evgeny Poberezkin
parent 2472bee6b6
commit a8a8883027
13 changed files with 143 additions and 14 deletions
+8 -6
View File
@@ -53,6 +53,7 @@ data Format
| StrikeThrough
| Snippet
| Secret
| Small
| Colored {color :: FormatColor}
| Uri
-- showText is Nothing for the usual Uri without text
@@ -202,7 +203,7 @@ markdownP = mconcat <$> A.many' fragmentP
'~' -> formattedP '~' StrikeThrough
'`' -> formattedP '`' Snippet
'#' -> A.char '#' *> secretP
'!' -> coloredP <|> wordP
'!' -> styledP <|> wordP
'@' -> mentionP <|> wordP
'/' -> commandP <|> wordP
'[' -> sowLinkP <|> wordP
@@ -228,13 +229,13 @@ markdownP = mconcat <$> A.many' fragmentP
| otherwise = markdown Secret $ T.init ss
where
ss = b <> s <> a
coloredP :: Parser Markdown
coloredP = do
clr <- A.char '!' *> colorP <* A.space
styledP :: Parser Markdown
styledP = do
f <- A.char '!' *> ((A.char '-' $> Small) <|> (colored <$> colorP)) <* A.space
s <- ((<>) <$> A.takeWhile1 (\c -> c /= ' ' && c /= '!') <*> A.takeTill (== '!')) <* A.char '!'
if T.null s || T.last s == ' '
then fail "not colored"
else pure $ markdown (colored clr) s
then fail "not styled"
else pure $ markdown f s
mentionP = prefixedStringP '@' displayNameTextP_ Mention
commandP = prefixedStringP '/' commandTextP Command
prefixedStringP pfx parser format = do
@@ -441,6 +442,7 @@ markdownText (FormattedText f_ t) = case f_ of
StrikeThrough -> around '~'
Snippet -> around '`'
Secret -> around '#'
Small -> "!- " <> t <> "!"
Colored (FormatColor c) -> color c
Uri -> t
HyperLink {} -> t
+1
View File
@@ -75,6 +75,7 @@ sgr = \case
StrikeThrough -> [SetSwapForegroundBackground True]
Colored (FormatColor c) -> [SetColor Foreground Vivid c]
Secret -> [SetColor Foreground Dull Black, SetColor Background Dull Black]
Small -> [SetConsoleIntensity FaintIntensity]
_ -> []
unStyle :: StyledString -> String