void FunctionsTest::testParseMarkdownHeaders() { QCOMPARE(parseMarkdown("# h1"), QString("<h1>h1</h1>")); QCOMPARE(parseMarkdown("## h2"), QString("<h2>h2</h2>")); QCOMPARE(parseMarkdown("### h3"), QString("<h3>h3</h3>")); QCOMPARE(parseMarkdown("#### h4"), QString("<h4>h4</h4>")); QCOMPARE(parseMarkdown("##### h5"), QString("<h5>h5</h5>")); QCOMPARE(parseMarkdown("###### h6"), QString("<h6>h6</h6>")); QCOMPARE(parseMarkdown("####### h7"), QString("<h6>h7</h6>")); QCOMPARE(parseMarkdown("a # h1"), QString("a # h1")); }
void MarkdownEditAreaWidget::initSignalsAndSlots() { if ( conf->getPreviewOption() == MdCharmGlobal::WriteRead ) connect( editor, SIGNAL( textChanged() ), this, SLOT( parseMarkdown() ) ); if ( conf->isSyncScrollbar() ) { connect( editorScrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( scrollPreviewTo( int ) ) ); connect( editor, SIGNAL( textChanged() ), this, SLOT( scrollPreviewTo() ) ); }
void UpdateDialog::checkForUpdatesDone(const QString &newVersion, bool available, const QString &changelog) { if (!available) { emit noUpdateAvailable(); return; } bool hasChangelog = !changelog.isEmpty(); if (hasChangelog) { ui->labelChangelog->setTextFormat(Qt::RichText); ui->labelChangelog->setText(parseMarkdown(changelog)); } ui->checkShowChangelog->setVisible(hasChangelog); ui->scrollArea->setVisible(hasChangelog && ui->checkShowChangelog->isChecked()); ui->labelVersion->setText(tr("Version <b>%1</b>").arg(newVersion)); show(); activateWindow(); }
void FunctionsTest::testParseMarkdownIssueLinks() { QCOMPARE(parseMarkdown("issue #123"), QString("<a href='" + QString(PROJECT_GITHUB_URL) + "/issues/123'>issue #123</a>")); QCOMPARE(parseMarkdown("fix #123"), QString("<a href='" + QString(PROJECT_GITHUB_URL) + "/issues/123'>fix #123</a>")); QCOMPARE(parseMarkdown("issue 123"), QString("issue 123")); }