From f04703f09b35fa7449fe368b04565016e6482786 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 6 Jan 2023 15:05:19 -0500 Subject: [PATCH] Strip certain HTML tags when rendering mod pages Some mod pages use certain tags for centering purposes, but trips up hoedown. Signed-off-by: Joshua Goins --- launcher/ui/pages/modplatform/ModPage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 677bc4d6..75be25b2 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -428,6 +428,10 @@ void ModPage::updateUi() text += "
"; HoeDown h; + + // hoedown bug: it doesn't handle markdown surrounded by block tags (like center, div) so strip them + current.extraData.body.remove(QRegularExpression("<[^>]*(?:center|div)\\W*>")); + ui->packDescription->setHtml(text + (current.extraData.body.isEmpty() ? current.description : h.process(current.extraData.body.toUtf8()))); ui->packDescription->flush(); }