mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-19 21:29:52 -07:00
Support sending and completing Emoji shortcodes in the message bar (#100)
This commit is contained in:
parent
529073f4d4
commit
8d22b83d85
5 changed files with 83 additions and 5 deletions
|
@ -97,6 +97,7 @@ const TIME_GUTTER_EMPTY_SPAN: Span<'static> = span_static(TIME_GUTTER_EMPTY);
|
|||
|
||||
fn text_to_message_content(input: String) -> TextMessageEventContent {
|
||||
let mut options = ComrakOptions::default();
|
||||
options.extension.shortcodes = true;
|
||||
options.render.hardbreaks = true;
|
||||
let html = markdown_to_html(input.as_str(), &options);
|
||||
|
||||
|
@ -1013,6 +1014,11 @@ pub mod tests {
|
|||
"<pre><code class=\"language-rust\">const A: usize = 1;\n</code></pre>\n"
|
||||
);
|
||||
|
||||
let input = ":heart:\n";
|
||||
let content = text_to_message_content(input.into());
|
||||
assert_eq!(content.body, input);
|
||||
assert_eq!(content.formatted.unwrap().body, "<p>\u{2764}\u{FE0F}</p>\n");
|
||||
|
||||
let input = "para 1\n\npara 2\n";
|
||||
let content = text_to_message_content(input.into());
|
||||
assert_eq!(content.body, input);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue