Moved html patch to StringUtils

Signed-off-by: SabrePenguin <lknofczynski@gmail.com>
This commit is contained in:
SabrePenguin
2024-04-30 22:40:04 -04:00
parent 5348a90a15
commit cec27fd014
3 changed files with 23 additions and 17 deletions
+1 -17
View File
@@ -26,22 +26,6 @@ QString markdownToHTML(const QString& markdown)
QString htmlStr(buffer);
free(buffer);
int pos = htmlStr.indexOf("</ul>");
int imgPos;
while (pos != -1) {
pos = pos + 5; // 5 is the size of the </ul> tag
imgPos = htmlStr.indexOf("<img ", pos);
if (imgPos == -1)
break; // no image after the tag
auto textBetween = htmlStr.mid(pos, imgPos - pos).trimmed(); // trim all white spaces
if (textBetween.isEmpty())
htmlStr.insert(pos, "<br>");
pos = htmlStr.indexOf("</ul>", pos);
}
return htmlStr;
}