From b7241b0c2ca3be65c700cc14b5440625a3702bcc Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 4 Apr 2021 23:32:52 +0200 Subject: MarkdownRenderer: add default format parameter to resetFormatting() --- src/renderers/markdownrenderer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/renderers/markdownrenderer.cpp') diff --git a/src/renderers/markdownrenderer.cpp b/src/renderers/markdownrenderer.cpp index f001d45..62a1328 100644 --- a/src/renderers/markdownrenderer.cpp +++ b/src/renderers/markdownrenderer.cpp @@ -106,11 +106,13 @@ static QString extractNodeText(cmark_node &node) return QString::fromUtf8(data, strlen(data)); } -static void resetFormatting(RenderState &state) +static void resetFormatting(RenderState &state, QTextBlockFormat defaultFormat = QTextBlockFormat()) { + if (defaultFormat.isEmpty()) + defaultFormat = state.text_style.standard_format; state.emitNewBlock(); state.suppress_next_block = true; - state.cursor.setBlockFormat(state.text_style.standard_format); + state.cursor.setBlockFormat(defaultFormat); } static void renderNode(RenderState &state, cmark_node & node, const QTextCharFormat ¤t_format, int listIndent) @@ -152,9 +154,7 @@ static void renderNode(RenderState &state, cmark_node & node, const QTextCharFor state.suppress_next_block = true; renderChildren(state, node, current_format, listIndent); - state.emitNewBlock(); - state.suppress_next_block = true; - cursor.setBlockFormat(fmt); + resetFormatting(state, fmt); break; } case CMARK_NODE_ITEM: -- cgit v1.2.3