diff --git a/src/chatlog/chatmessage.cpp b/src/chatlog/chatmessage.cpp index 3eef85519..5a24b0ae8 100644 --- a/src/chatlog/chatmessage.cpp +++ b/src/chatlog/chatmessage.cpp @@ -187,9 +187,9 @@ QString ChatMessage::detectMarkdown(const QString &str) // Create regex for certain markdown syntax QRegExp exp("(\\*\\*)([^\\*\\*]{2,})(\\*\\*)" // Bold **text** - "|(\\*)([^\\*]{2,})(\\*)" // Bold *text* + "|(\\*)([^\\*]{2,})(\\*)" // Italics *text* "|(\\_)([^\\_]{2,})(\\_)" // Italics _text_ - "|(\\_\\_)([^\\_\\_]{2,})(\\_\\_)" // Italics __text__ + "|(\\_\\_)([^\\_\\_]{2,})(\\_\\_)" // Bold __text__ "|(\\-)([^\\-]{2,})(\\-)" // Underline -text- "|(\\~)([^\\~]{2,})(\\~)" // Strike ~text~ "|(\\~~)([^\\~\\~]{2,})(\\~~)" // Strike ~~text~~ @@ -225,12 +225,12 @@ 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)); - else if (exp.cap(4) == "*" && snippet.length() > 2) // Bold *text* - htmledSnippet = QString(" %1 ").arg(snippet.mid(mul/2,snippet.length()-mul)); + else if (exp.cap(4) == "*" && snippet.length() > 2) // Italics *text* + 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)); - else if (exp.cap(10) == "__"&& snippet.length() > 4) // Italics __text__ - htmledSnippet = QString(" %1 ").arg(snippet.mid(mul,snippet.length()-2*mul)); + else if (exp.cap(10) == "__"&& snippet.length() > 4) // Bold __text__ + 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)); else if (exp.cap(16) == "~" && snippet.length() > 2) // Strikethrough ~text~