Skip to content

Commit

Permalink
fixes list indents
Browse files Browse the repository at this point in the history
  • Loading branch information
fahrstuhl committed Aug 20, 2020
1 parent b783cc3 commit d414dc4
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions godot_markdown/src/cmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ godot_variant cmark_convert_markdown(godot_object *p_instance, void *p_method_da
}
else if(cur_type == CMARK_NODE_ITEM){
if (ev_type == CMARK_EVENT_ENTER) {
for (int i = 1; i < list_level; i++) {
if(list_level >= 1) {
append_to_godot_string(&converted, "[indent]");
}
parent = cmark_node_parent(cur);
Expand All @@ -168,7 +168,7 @@ godot_variant cmark_convert_markdown(godot_object *p_instance, void *p_method_da
}
}
else if (ev_type == CMARK_EVENT_EXIT) {
for (int i = 1; i < list_level; i++) {
if(list_level >= 1) {
append_to_godot_string(&converted, "[/indent]");
}
}
Expand Down Expand Up @@ -201,21 +201,24 @@ godot_variant cmark_convert_markdown(godot_object *p_instance, void *p_method_da
}
if (ev_type == CMARK_EVENT_ENTER) {
if (is_child_of_item && is_not_first_child_of_item) {
append_to_godot_string(&converted, "[indent]");
append_to_godot_string(&converted, " ");
}
/* append_to_godot_string(&converted, "<p>"); */
}
else if (ev_type == CMARK_EVENT_EXIT) {
/* append_to_godot_string(&converted, "</p>"); */
if (is_child_of_item && is_not_first_child_of_item) {
append_to_godot_string(&converted, "[/indent]");
}
// TODO: non-tight lists are very ugly this way
/* if (!tight) { */
/* append_to_godot_string(&converted, "\n\n"); */
/* } */
else {
append_to_godot_string(&converted, "\n");
if (is_child_of_item) {
if (is_not_first_child_of_item) {
/* append_to_godot_string(&converted, "[/indent]"); */
}
if (!tight) {
append_to_godot_string(&converted, "\n\n");
}
else {
append_to_godot_string(&converted, "\n");
}
} else {
append_to_godot_string(&converted, "\n\n");
}
}
}
Expand Down

0 comments on commit d414dc4

Please sign in to comment.