diff --git a/launcher/Markdown.cpp b/launcher/Markdown.cpp index 8b1f11f33..31e026dc7 100644 --- a/launcher/Markdown.cpp +++ b/launcher/Markdown.cpp @@ -24,16 +24,20 @@ QString markdownToHTML(const QString& markdown) char* buffer = cmark_markdown_to_html(markdownData.constData(), markdownData.length(), CMARK_OPT_NOBREAKS | CMARK_OPT_UNSAFE); QString htmlStr(buffer); - int first_pos = htmlStr.indexOf(""); - int img_pos = 0; - while( first_pos != -1 ) - { - img_pos = htmlStr.indexOf(""); - first_pos = htmlStr.indexOf("", first_pos+5); - } + free(buffer); + + // Insert a breakpoint between a and tag as this can cause visual bugs + int first_pos = htmlStr.indexOf(""); + int img_pos; + while (first_pos != -1) { + img_pos = htmlStr.indexOf(" -1) // 5 is the size of the tag + htmlStr.insert(img_pos, "
"); + + first_pos = htmlStr.indexOf("", first_pos + 5); + } return htmlStr; } \ No newline at end of file