diff --git a/lib/src/client.dart b/lib/src/client.dart
index c9ed118a..dcce1069 100644
--- a/lib/src/client.dart
+++ b/lib/src/client.dart
@@ -107,6 +107,8 @@ class Client extends MatrixApi {
String? get syncFilterId => _syncFilterId;
+ final bool convertLinebreaksInFormatting;
+
final ComputeCallback? compute;
@Deprecated('Use [nativeImplementations] instead')
@@ -233,6 +235,10 @@ class Client extends MatrixApi {
/// support.
this.customRefreshTokenLifetime,
this.typingIndicatorTimeout = const Duration(seconds: 30),
+
+ /// When sending a formatted message, converting linebreaks in markdown to
+ ///
tags:
+ this.convertLinebreaksInFormatting = true,
}) : syncFilter = syncFilter ??
Filter(
room: RoomFilter(
diff --git a/lib/src/room.dart b/lib/src/room.dart
index a5600619..59cff938 100644
--- a/lib/src/room.dart
+++ b/lib/src/room.dart
@@ -646,6 +646,7 @@ class Room {
event['body'],
getEmotePacks: () => getImagePacksFlat(ImagePackUsage.emoticon),
getMention: getMention,
+ convertLinebreaks: client.convertLinebreaksInFormatting,
);
// if the decoded html is the same as the body, there is no need in sending a formatted message
if (HtmlUnescape().convert(html.replaceAll(RegExp(r'
\n?'), '\n')) !=