diff --git a/src/chatlog/chatmessage.cpp b/src/chatlog/chatmessage.cpp
index 296d9e442..b6a1b840d 100644
--- a/src/chatlog/chatmessage.cpp
+++ b/src/chatlog/chatmessage.cpp
@@ -214,19 +214,19 @@ QString ChatMessage::detectMarkdown(const QString &str)
// Match captured string to corresponding md format
if (exp.cap(1) == "**") // Bold **text**
- htmledSnippet = QString(" %1 ").arg(snippet.mid(mul,snippet.length()-2*mul));
+ htmledSnippet = QString("%1").arg(snippet.mid(mul,snippet.length()-2*mul));
else if (exp.cap(4) == "*" && snippet.length() > 2) // Italics *text*
- htmledSnippet = QString(" %1 ").arg(snippet.mid(mul/2,snippet.length()-mul));
+ htmledSnippet = QString("%1").arg(snippet.mid(mul/2,snippet.length()-mul));
else if (exp.cap(7) == "_" && snippet.length() > 2) // Italics _text_
- htmledSnippet = QString(" %1 ").arg(snippet.mid(mul/2,snippet.length()-mul));
+ htmledSnippet = QString("%1").arg(snippet.mid(mul/2,snippet.length()-mul));
else if (exp.cap(10) == "__"&& snippet.length() > 4) // Bold __text__
- htmledSnippet = QString(" %1 ").arg(snippet.mid(mul,snippet.length()-2*mul));
+ htmledSnippet = QString("%1").arg(snippet.mid(mul,snippet.length()-2*mul));
else if (exp.cap(13) == "-" && snippet.length() > 2) // Underline -text-
- htmledSnippet = QString(" %1 ").arg(snippet.mid(mul/2,snippet.length()-mul));
+ htmledSnippet = QString("%1").arg(snippet.mid(mul/2,snippet.length()-mul));
else if (exp.cap(16) == "~" && snippet.length() > 2) // Strikethrough ~text~
- htmledSnippet = QString(" %1 ").arg(snippet.mid(mul/2,snippet.length()-mul));
+ htmledSnippet = QString("%1").arg(snippet.mid(mul/2,snippet.length()-mul));
else if (exp.cap(19) == "~~" && snippet.length() > 4) // Strikethrough ~~text~~
- htmledSnippet = QString(" %1 ").arg(snippet.mid(mul,snippet.length()-2*mul));
+ htmledSnippet = QString("%1").arg(snippet.mid(mul,snippet.length()-2*mul));
else if (exp.cap(22) == "`" && snippet.length() > 2) // Codeblock `text`
htmledSnippet = QString("%1
").arg(snippet.mid(mul/2,snippet.length()-mul));
else