@@ -36,7 +36,7 @@ public static string ToMarkdown(string message, MessageEntity[]? entities)
36
36
var md = closings [ 0 ] . md ;
37
37
closings . RemoveAt ( 0 ) ;
38
38
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 ' ; }
40
40
sb . Insert ( i , md ) ; i += md . Length ;
41
41
}
42
42
if ( i == sb . Length ) break ;
@@ -56,7 +56,7 @@ public static string ToMarkdown(string message, MessageEntity[]? entities)
56
56
closing . md = $ "](tg://emoji?id={ nextEntity . CustomEmojiId } )";
57
57
}
58
58
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 >" : " >"; }
60
60
else if ( nextEntity . Type is MessageEntityType . Pre )
61
61
md = $ "```{ nextEntity . Language } \n ";
62
62
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)
92
92
[ MessageEntityType . Spoiler ] = "||" ,
93
93
[ MessageEntityType . CustomEmoji ] = "![" ,
94
94
[ MessageEntityType . Blockquote ] = ">" ,
95
+ [ MessageEntityType . ExpandableBlockquote ] = ">||" ,
95
96
} ;
96
97
97
98
/// <summary>Insert backslashes in front of MarkdownV2 reserved characters</summary>
@@ -168,6 +169,8 @@ public static string ToHtml(string message, MessageEntity[]? entities)
168
169
closing . Item2 = "</code></pre>" ;
169
170
tag = $ "<pre><code class=\" language-{ nextEntity . Language } \" >";
170
171
}
172
+ else if ( nextEntity . Type is MessageEntityType . ExpandableBlockquote )
173
+ tag = "<blockquote expandable>" ;
171
174
else
172
175
tag = $ "<{ tag } >";
173
176
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)
198
201
[ MessageEntityType . Spoiler ] = "tg-spoiler" ,
199
202
[ MessageEntityType . CustomEmoji ] = "tg-emoji" ,
200
203
[ MessageEntityType . Blockquote ] = "blockquote" ,
204
+ [ MessageEntityType . ExpandableBlockquote ] = "blockquote" ,
201
205
} ;
202
206
203
207
/// <summary>Replace special HTML characters with their &xx; equivalent</summary>
0 commit comments