From 3373aa8b351691d395cd15c634ca1b60fd688c6a Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 13 Jan 2020 22:45:01 +0100 Subject: QTextMarkdownImporter: allow nesting text span formatting The bold+italic combination indicated by ***triple stars*** requires this; but it enables combinations of italics, bold, strikeout, anchor text (and associated link formatting), image alternate text, and inline code formatting (monospace). A code span overrides the formatting from surrounding spans (which might be a bug to fix in another patch, if we compare to how md2html formats code nested in bold-italics for example), but the format stack restores state when any char format span ends. Task-number: QTBUG-81306 Pick-to: 5.15 Change-Id: I289556fa53de400eb50a4d159b9b344eafc517da Reviewed-by: Volker Hilsheimer --- src/gui/text/qtextmarkdownimporter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/text') diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp index a5c5fb3678..b5532696f4 100644 --- a/src/gui/text/qtextmarkdownimporter.cpp +++ b/src/gui/text/qtextmarkdownimporter.cpp @@ -388,6 +388,8 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail) int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det) { QTextCharFormat charFmt; + if (!m_spanFormatStack.isEmpty()) + charFmt = m_spanFormatStack.top(); switch (spanType) { case MD_SPAN_EM: charFmt.setFontItalic(true); -- cgit v1.2.3