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 <josh@redstrate.com>
This commit is contained in:
Joshua Goins 2023-01-06 15:05:19 -05:00
parent 4b12c85d91
commit f04703f09b

View File

@ -428,6 +428,10 @@ void ModPage::updateUi()
text += "<hr>";
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();
}