@@ -36,7 +36,7 @@ public static string ToMarkdown(string message, MessageEntity[]? entities)
3636 var md = closings [ 0 ] . md ;
3737 closings . RemoveAt ( 0 ) ;
3838 if ( i > 0 && md [ 0 ] == '_' && sb [ i - 1 ] == '_' ) md = '\r ' + md ;
39- if ( md [ 0 ] == '>' ) { inBlockQuote = false ; if ( lastCh != '\n ' && i < sb . Length && sb [ i ] != '\n ' ) md = " \n " ; else continue ; }
39+ if ( md [ 0 ] == '>' ) { inBlockQuote = false ; md = md [ 1 .. ] ; if ( lastCh != '\n ' && i < sb . Length && sb [ i ] != '\n ' ) md += ' \n ' ; }
4040 sb . Insert ( i , md ) ; i += md . Length ;
4141 }
4242 if ( i == sb . Length ) break ;
@@ -56,7 +56,7 @@ public static string ToMarkdown(string message, MessageEntity[]? entities)
5656 closing . md = $ "](tg://emoji?id={ nextEntity . CustomEmojiId } )";
5757 }
5858 else if ( md [ 0 ] == '>' )
59- { inBlockQuote = true ; if ( lastCh is not '\n ' and not '\0 ' ) md = "\n >" ; }
59+ { inBlockQuote = true ; md = lastCh is not '\n ' and not '\0 ' ? "\n >" : " >"; }
6060 else if ( nextEntity . Type is MessageEntityType . Pre )
6161 md = $ "```{ nextEntity . Language } \n ";
6262 int index = ~ closings . BinarySearch ( closing , Comparer < ( int , string ) > . Create ( ( x , y ) => x . Item1 . CompareTo ( y . Item1 ) | 1 ) ) ;
@@ -92,6 +92,7 @@ public static string ToMarkdown(string message, MessageEntity[]? entities)
9292 [ MessageEntityType . Spoiler ] = "||" ,
9393 [ MessageEntityType . CustomEmoji ] = "![" ,
9494 [ MessageEntityType . Blockquote ] = ">" ,
95+ [ MessageEntityType . ExpandableBlockquote ] = ">||" ,
9596 } ;
9697
9798 /// <summary>Insert backslashes in front of MarkdownV2 reserved characters</summary>
@@ -168,6 +169,8 @@ public static string ToHtml(string message, MessageEntity[]? entities)
168169 closing . Item2 = "</code></pre>" ;
169170 tag = $ "<pre><code class=\" language-{ nextEntity . Language } \" >";
170171 }
172+ else if ( nextEntity . Type is MessageEntityType . ExpandableBlockquote )
173+ tag = "<blockquote expandable>" ;
171174 else
172175 tag = $ "<{ tag } >";
173176 int index = ~ closings . BinarySearch ( closing , Comparer < ( int , string ) > . Create ( ( x , y ) => x . Item1 . CompareTo ( y . Item1 ) | 1 ) ) ;
@@ -198,6 +201,7 @@ public static string ToHtml(string message, MessageEntity[]? entities)
198201 [ MessageEntityType . Spoiler ] = "tg-spoiler" ,
199202 [ MessageEntityType . CustomEmoji ] = "tg-emoji" ,
200203 [ MessageEntityType . Blockquote ] = "blockquote" ,
204+ [ MessageEntityType . ExpandableBlockquote ] = "blockquote" ,
201205 } ;
202206
203207 /// <summary>Replace special HTML characters with their &xx; equivalent</summary>
0 commit comments