Skip to content

Provides an alternative toHtml() function for QTextDocuments that export basic-formatted HTML.

License

Notifications You must be signed in to change notification settings

Open-App-Library/QBasicHtmlExporter

Repository files navigation

QBasicHtmlExporter

Provides an alternative toHtml() function for QTextDocuments that export basic-formatted HTML.

Used in Vibrato Notes and the Escriba text editor.

Important Note: This is not meant to be a more advanced version of Qt's HTML exporter (hence 'Basic' in the name). The HTML export provides all of the features in the markdown specfication.

Installation

There are various ways to get set up. I will share the easiest way with QMake.

First, you need to clone the repo to your project folder.

Then, you just have to add the following lines to your .pro file:

include($$PWD/QBasicHtmlExporter/QBasicHtmlExporterInclude.pro)
INCLUDEPATH += $$PWD/QBasicHtmlExporter

You're all set!

Usage

Here is a trivial example to get you up and running.

#include <QApplication>
#include <QDebug>
#include <QTextEdit>
#include <qbasichtmlexporter.h>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTextEdit *e = new QTextEdit();
    e->setHtml("<h1>Hello world</h1>");

    QString html = QBasicHtmlExporter(e->document()).toHtml();

    qDebug() << html;
}

About

Provides an alternative toHtml() function for QTextDocuments that export basic-formatted HTML.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published