diff options
| author | Karol Kosek <krkk@krkk.ct8.pl> | 2021-04-04 23:32:52 +0200 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-04-05 17:13:58 +0200 |
| commit | b7241b0c2ca3be65c700cc14b5440625a3702bcc (patch) | |
| tree | d1dd663a96289a29fe93b94441ce3b36e26a122f /src/renderers/markdownrenderer.cpp | |
| parent | f1dc484fa7146b847ba5ef200f072cc576a8753b (diff) | |
| download | kristall-b7241b0c2ca3be65c700cc14b5440625a3702bcc.tar.gz | |
MarkdownRenderer: add default format parameter to resetFormatting()
Diffstat (limited to 'src/renderers/markdownrenderer.cpp')
| -rw-r--r-- | src/renderers/markdownrenderer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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: |
