Make single newlines cause a <br> by default
This should match what people expect from a chat application much better. The biggest reason not to do this, is because some people might paste markdown documents. For those people there is now a /cmark command, which disables most of our extensions to cmark, including the newline behaviour. There is a long discussion on the Fediverse and on Github linked below. Mastodon https://fosstodon.org/@deepbluev7/109771668066978726 fixes #757
This commit is contained in:
parent
9f529075f0
commit
0c3d46795b
8 changed files with 48 additions and 15 deletions
|
|
@ -465,6 +465,14 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow
|
|||
text.formatted_body = "";
|
||||
else
|
||||
text.format = "org.matrix.custom.html";
|
||||
} else if (useMarkdown == MarkdownOverride::CMARK) {
|
||||
// disable all markdown extensions
|
||||
text.formatted_body = utils::markdownToHtml(msg, rainbowify, true).toStdString();
|
||||
// keep everything as it was
|
||||
text.body = msg.trimmed().toStdString();
|
||||
|
||||
// always send formatted
|
||||
text.format = "org.matrix.custom.html";
|
||||
}
|
||||
|
||||
text.relations = generateRelations();
|
||||
|
|
@ -802,6 +810,8 @@ InputBar::command(const QString &command, QString args)
|
|||
cache::dropOutboundMegolmSession(room->roomId().toStdString());
|
||||
} else if (command == QLatin1String("md")) {
|
||||
message(args, MarkdownOverride::ON);
|
||||
} else if (command == QLatin1String("cmark")) {
|
||||
message(args, MarkdownOverride::CMARK);
|
||||
} else if (command == QLatin1String("plain")) {
|
||||
message(args, MarkdownOverride::OFF);
|
||||
} else if (command == QLatin1String("rainbow")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue