Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
65314b6ce88cdbb28a22be0cab9856ec9bc9604b (qt/qtbase/dev)
Description
It would be nice to have if qml Text/Label could parse github style markdown formatted text via textFormat: Text.GithubFlavoredMarkdownText
Currently to get qml Text/Label into displaying any markup languages is to use textFormat: StyledText and pass processed html to it.
Simplified example for cmark:
#include <cmark.h> QString CMarkSingleton::mdStringToHtml(const QString &t_markdown) { const QByteArray tmpData = t_markdown.toUtf8(); return QString::fromUtf8(cmark_markdown_to_html(tmpData.constData(), tmpData.size(), CMARK_OPT_DEFAULT)); }
(qmlRegisterSingletonType... etc.)
A CMarkLabel.qml that calls CMarkSingleton.mdStringToHtml(...) and sets textFormat to StyledText will do the rest.
This works but has the limitations of StyledText (using RichText for Label looks totally out of place).
OTOH: Using webengine just to display XYZmarkup->html texts is not worth the cost.
Attachments
Issue Links
- relates to
-
QTBUG-79766 Labels and message boxes do not render markdown though it is available as TextFormat
- Closed
- resulted in
-
QTBUG-75662 handle CSS styling for markdown format in QTextDocument / QTextBrowser
- Reported
For Gerrit Dashboard: QTBUG-72349 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
214843,22 | Add QTextMarkdownImporter | dev | qt/qtbase | Status: MERGED | -2 | 0 |
260346,2 | QTextMarkdownImporter: Fix deprecation warning | dev | qt/qtbase | Status: MERGED | +2 | 0 |