refactor: replace hoedown markdown parser with cmark
Signed-off-by: Joshua Goins <josh@redstrate.com>
This commit is contained in:
		@@ -9,14 +9,13 @@
 | 
			
		||||
#include <QProxyStyle>
 | 
			
		||||
#include <QStyleFactory>
 | 
			
		||||
 | 
			
		||||
#include <HoeDown.h>
 | 
			
		||||
 | 
			
		||||
#include "Application.h"
 | 
			
		||||
#include "BuildConfig.h"
 | 
			
		||||
#include "InstanceImportTask.h"
 | 
			
		||||
#include "InstanceList.h"
 | 
			
		||||
#include "InstanceTask.h"
 | 
			
		||||
#include "Json.h"
 | 
			
		||||
#include "Markdown.h"
 | 
			
		||||
 | 
			
		||||
#include "modplatform/modrinth/ModrinthPackManifest.h"
 | 
			
		||||
 | 
			
		||||
@@ -263,8 +262,7 @@ void ModrinthManagedPackPage::suggestVersion()
 | 
			
		||||
    auto index = ui->versionsComboBox->currentIndex();
 | 
			
		||||
    auto version = m_pack.versions.at(index);
 | 
			
		||||
 | 
			
		||||
    HoeDown md_parser;
 | 
			
		||||
    ui->changelogTextBrowser->setHtml(md_parser.process(version.changelog.toUtf8()));
 | 
			
		||||
    ui->changelogTextBrowser->setHtml(markdownToHTML(version.changelog.toUtf8()));
 | 
			
		||||
 | 
			
		||||
    ManagedPackPage::suggestVersion();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -43,13 +43,11 @@
 | 
			
		||||
#include <QRegularExpression>
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
#include <HoeDown.h>
 | 
			
		||||
 | 
			
		||||
#include "minecraft/MinecraftInstance.h"
 | 
			
		||||
#include "minecraft/PackProfile.h"
 | 
			
		||||
#include "ui/dialogs/ModDownloadDialog.h"
 | 
			
		||||
#include "ui/widgets/ProjectItem.h"
 | 
			
		||||
 | 
			
		||||
#include "Markdown.h"
 | 
			
		||||
 | 
			
		||||
ModPage::ModPage(ModDownloadDialog* dialog, BaseInstance* instance, ModAPI* api)
 | 
			
		||||
    : QWidget(dialog)
 | 
			
		||||
@@ -427,11 +425,6 @@ 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->setHtml(text + (current.extraData.body.isEmpty() ? current.description : markdownToHTML(current.extraData.body)));
 | 
			
		||||
    ui->packDescription->flush();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@
 | 
			
		||||
#include "ui/dialogs/NewInstanceDialog.h"
 | 
			
		||||
#include "modplatform/modpacksch/FTBPackInstallTask.h"
 | 
			
		||||
 | 
			
		||||
#include "HoeDown.h"
 | 
			
		||||
#include "Markdown.h"
 | 
			
		||||
 | 
			
		||||
FtbPage::FtbPage(NewInstanceDialog* dialog, QWidget *parent)
 | 
			
		||||
        : QWidget(parent), ui(new Ui::FtbPage), dialog(dialog)
 | 
			
		||||
@@ -175,8 +175,7 @@ void FtbPage::onSelectionChanged(QModelIndex first, QModelIndex second)
 | 
			
		||||
 | 
			
		||||
    selected = filterModel->data(first, Qt::UserRole).value<ModpacksCH::Modpack>();
 | 
			
		||||
 | 
			
		||||
    HoeDown hoedown;
 | 
			
		||||
    QString output = hoedown.process(selected.description.toUtf8());
 | 
			
		||||
    QString output = markdownToHTML(selected.description.toUtf8());
 | 
			
		||||
    ui->packDescription->setHtml(output);
 | 
			
		||||
 | 
			
		||||
    // reverse foreach, so that the newest versions are first
 | 
			
		||||
 
 | 
			
		||||
@@ -42,11 +42,10 @@
 | 
			
		||||
#include "BuildConfig.h"
 | 
			
		||||
#include "InstanceImportTask.h"
 | 
			
		||||
#include "Json.h"
 | 
			
		||||
#include "Markdown.h"
 | 
			
		||||
 | 
			
		||||
#include "ui/widgets/ProjectItem.h"
 | 
			
		||||
 | 
			
		||||
#include <HoeDown.h>
 | 
			
		||||
 | 
			
		||||
#include <QComboBox>
 | 
			
		||||
#include <QKeyEvent>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
@@ -280,8 +279,7 @@ void ModrinthPage::updateUI()
 | 
			
		||||
 | 
			
		||||
    text += "<hr>";
 | 
			
		||||
 | 
			
		||||
    HoeDown h;
 | 
			
		||||
    text += h.process(current.extra.body.toUtf8());
 | 
			
		||||
    text += markdownToHTML(current.extra.body.toUtf8());
 | 
			
		||||
 | 
			
		||||
    ui->packDescription->setHtml(text + current.description);
 | 
			
		||||
    ui->packDescription->flush();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user