aboutsummaryrefslogtreecommitdiff
path: root/src/renderers/markdownrenderer.cpp
diff options
context:
space:
mode:
authorKarol Kosek <krkk@krkk.ct8.pl>2021-04-04 23:35:12 +0200
committerFelix Queißner <felix@ib-queissner.de>2021-04-05 17:13:58 +0200
commitd45aad2da4d7fe10c4609d66bdd6f0cba4ba8e03 (patch)
tree0978ca055317c1f0a8d359921be05557b67e6ad0 /src/renderers/markdownrenderer.cpp
parentb7241b0c2ca3be65c700cc14b5440625a3702bcc (diff)
downloadkristall-d45aad2da4d7fe10c4609d66bdd6f0cba4ba8e03.tar.gz
MarkdownRenderer: use header formatting from config
Now, resetFormatting() between a header and a list block will add an empty block (because that's what resetFormatting()'s doing), which might look a bit off. I couldn't find a better way to this, since using cursor.movePosition(QTextCursor::NextBlock) won't centre the first header in the next commit. ://
Diffstat (limited to 'src/renderers/markdownrenderer.cpp')
-rw-r--r--src/renderers/markdownrenderer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/renderers/markdownrenderer.cpp b/src/renderers/markdownrenderer.cpp
index 62a1328..7c7d62c 100644
--- a/src/renderers/markdownrenderer.cpp
+++ b/src/renderers/markdownrenderer.cpp
@@ -193,6 +193,8 @@ static void renderNode(RenderState &state, cmark_node & node, const QTextCharFor
{
QTextCharFormat fmt = current_format;
state.emitNewBlock();
+ cursor.setBlockFormat(state.text_style.heading_format);
+
switch(cmark_node_get_heading_level(&node)) {
case 1: fmt = state.text_style.standard_h1; break;
case 2: fmt = state.text_style.standard_h2; break;
@@ -219,6 +221,7 @@ static void renderNode(RenderState &state, cmark_node & node, const QTextCharFor
}
renderChildren(state, node, fmt);
+ resetFormatting(state);
break;
}
case CMARK_NODE_THEMATIC_BREAK: