Commit d6c7becfde

d6c7becfdedcaae0c782a0dce8290b3047e01c0a

parent: 5d668724e1

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2021-02-07 16:19 UTC

config: Add a config option to disable markdown input parsing

Layout: unified · split

src/config.rs +11
@@ -84,6 +84,7 @@ impl From<i32> for ServerBuffer {
8484
8585config!(
8686 "matrix-rust",
87
8788 Section look {
8889 encrypted_room_sign: String {
8990 // Description.
@@ -121,6 +122,7 @@ config!(
121122 RedactionStyle,
122123 },
123124 },
125
124126 Section network {
125127 debug_buffer: bool {
126128 // Description
@@ -128,6 +130,15 @@ config!(
128130 // Default value.
129131 false,
130132 },
133 },
134
135 Section input {
136 markdown_input: bool {
137 // Description
138 "Should the input be parsed as markdown",
139 // Default value.
140 true,
141 },
131142 }
132143);
133144
src/room/mod.rs +6 −3
@@ -337,9 +337,12 @@ impl RoomHandle {
337337#[async_trait(?Send)]
338338impl BufferInputCallbackAsync for MatrixRoom {
339339 async fn callback(&mut self, _: BufferHandle, input: String) {
340 // TODO parse the input here and produce a formatted body.
341 let content =
342 MessageEventContent::Text(TextMessageEventContent::markdown(input));
340 let content = if self.config.borrow().input().markdown_input() {
341 MessageEventContent::Text(TextMessageEventContent::markdown(input))
342 } else {
343 MessageEventContent::Text(TextMessageEventContent::plain(input))
344 };
345
343346 self.send_message(content).await;
344347 }
345348}