Skip to content

Commit

Permalink
fixes unnumbered lists showing up as ticked tasklists
Browse files Browse the repository at this point in the history
  • Loading branch information
fahrstuhl committed Aug 18, 2020
1 parent bb6fab8 commit b5d496d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions demo/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ end of paragraph
# yee
- test
- toast
###### tasklist
- [ ] yee
Expand Down
7 changes: 4 additions & 3 deletions godot_markdown/src/cmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ godot_variant cmark_convert_markdown(godot_object *p_instance, void *p_method_da
}
parent = cmark_node_parent(cur);
char* tasklist_state = cmark_gfm_extensions_get_tasklist_state(cur);
bool is_tasklist = strcmp(cmark_node_get_type_string(cur), "tasklist") == 0;
if (parent != NULL
&& cmark_node_get_type(parent) == CMARK_NODE_LIST
&& cmark_node_get_list_type(parent) == CMARK_ORDERED_LIST) {
Expand All @@ -156,15 +157,15 @@ godot_variant cmark_convert_markdown(godot_object *p_instance, void *p_method_da
api->godot_string_destroy(&num_gd);
cmark_node_set_list_start(parent, list_start + 1);
}
else if (!is_tasklist) {
append_to_godot_string(&converted, "* ");
}
else if (strcmp(tasklist_state, "checked") == 0) {
append_to_godot_string(&converted, "🔲 ");
}
else if (strcmp(tasklist_state, "unchecked") == 0) {
append_to_godot_string(&converted, "☑ ");
}
else {
append_to_godot_string(&converted, "* ");
}
}
else if (ev_type == CMARK_EVENT_EXIT) {
for (int i = 1; i < list_level; i++) {
Expand Down

0 comments on commit b5d496d

Please sign in to comment.