aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremias Stotter <jeremias@stotter.eu>2021-12-19 23:15:35 +0100
committerJeremias Stotter <jeremias@stotter.eu>2021-12-19 23:15:35 +0100
commit8c20d5f8262468097798007798c93af235867efd (patch)
tree7a70a27703e03826748b2fe6d93e685e3ce671c3
parent0c334adfc7999b394c7f30de637d9a82a6e6b2ca (diff)
downloadJBlog-8c20d5f8262468097798007798c93af235867efd.tar.gz
JBlog-8c20d5f8262468097798007798c93af235867efd.tar.bz2
JBlog-8c20d5f8262468097798007798c93af235867efd.zip
Fixed single newline after title and list
-rw-r--r--md.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/md.c b/md.c
index 09a324a..3683bd1 100644
--- a/md.c
+++ b/md.c
@@ -215,6 +215,7 @@ int parse_markdown(char* input, char* buffer, size_t buffer_size) {
int hash_chain = 0;
int spaces_trimmed = 0;
+ int root_on_newline = false;
struct tree_element* root = new_element();
struct tree_element* active_element = root;
@@ -300,6 +301,7 @@ int parse_markdown(char* input, char* buffer, size_t buffer_size) {
active_element = new_child(active_element, -1);
active_element->type = t_li;
active_element->allow_inner = true;
+ root_on_newline = true;
} else {
}
break;
@@ -349,6 +351,7 @@ int parse_markdown(char* input, char* buffer, size_t buffer_size) {
}
*(int*)(active_element->value) = hash_chain;
hash_chain = 0;
+ root_on_newline = true;
break;
}
// Trim spaces from newline
@@ -364,6 +367,10 @@ int parse_markdown(char* input, char* buffer, size_t buffer_size) {
append_char_to_active(root, &active_element, '#');
hash_chain = 0;
}
+ if(newline && root_on_newline) {
+ active_element = root;
+ root_on_newline = false;
+ }
newline = false;
append_char_to_active(root, &active_element, *cur_char);
break;
Jeremias Stotters git repositories generated by CGIT