Skip to content

Commit b5d496d

Browse files
committed
fixes unnumbered lists showing up as ticked tasklists
1 parent bb6fab8 commit b5d496d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

demo/main.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ end of paragraph
88
99
# yee
1010
11+
- test
12+
- toast
13+
1114
###### tasklist
1215
1316
- [ ] yee

godot_markdown/src/cmark.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ godot_variant cmark_convert_markdown(godot_object *p_instance, void *p_method_da
146146
}
147147
parent = cmark_node_parent(cur);
148148
char* tasklist_state = cmark_gfm_extensions_get_tasklist_state(cur);
149+
bool is_tasklist = strcmp(cmark_node_get_type_string(cur), "tasklist") == 0;
149150
if (parent != NULL
150151
&& cmark_node_get_type(parent) == CMARK_NODE_LIST
151152
&& cmark_node_get_list_type(parent) == CMARK_ORDERED_LIST) {
@@ -156,15 +157,15 @@ godot_variant cmark_convert_markdown(godot_object *p_instance, void *p_method_da
156157
api->godot_string_destroy(&num_gd);
157158
cmark_node_set_list_start(parent, list_start + 1);
158159
}
160+
else if (!is_tasklist) {
161+
append_to_godot_string(&converted, "* ");
162+
}
159163
else if (strcmp(tasklist_state, "checked") == 0) {
160164
append_to_godot_string(&converted, "🔲 ");
161165
}
162166
else if (strcmp(tasklist_state, "unchecked") == 0) {
163167
append_to_godot_string(&converted, "☑ ");
164168
}
165-
else {
166-
append_to_godot_string(&converted, "* ");
167-
}
168169
}
169170
else if (ev_type == CMARK_EVENT_EXIT) {
170171
for (int i = 1; i < list_level; i++) {

0 commit comments

Comments
 (0)