|
1 | 1 | #include "md_to_html.h"
|
2 | 2 |
|
3 |
| -void print_tree(Text *text) { |
4 |
| - if (!text) return; |
5 |
| - switch (text->type) { |
6 |
| - case TEXT: { printf("%.*s", (s32) text->text.len, text->text.str); } break; |
7 |
| - case BOLD: { printf("**"); } break; |
8 |
| - case ITALIC: { printf("*"); } break; |
9 |
| - case STRUCK: { printf("~~"); } break; |
10 |
| - case LINK: { printf("@("); } break; |
11 |
| - } |
12 |
| - print_tree(text->child); |
13 |
| - switch (text->type) { |
14 |
| - case BOLD: { printf("**"); } break; |
15 |
| - case ITALIC: { printf("*"); } break; |
16 |
| - case STRUCK: { printf("~~"); } break; |
17 |
| - case LINK: { printf(")"); } break; |
18 |
| - } |
19 |
| - print_tree(text->next); |
20 |
| -} |
21 |
| - |
22 | 3 | str parse_inline(Arena *a, Text *text);
|
23 | 4 |
|
24 | 5 | static Text *new_text(Arena *a, str text, enum TextTypes type) {
|
@@ -384,9 +365,7 @@ StrList render_block(Arena *a, Block *b) {
|
384 | 365 |
|
385 | 366 | char in_string = 0;
|
386 | 367 | str s = t->text;
|
387 |
| - char pc = 0; |
388 | 368 | str_iter(s, i, c) { /* Escape HTML characters in code blocks */
|
389 |
| - |
390 | 369 | if (str_has_prefix(str_skip(s, i), strl("//"))) {
|
391 | 370 | in_comment = 1;
|
392 | 371 | StrList_pushv(a, out, str_first(s, i), comment_span);
|
@@ -432,8 +411,6 @@ StrList render_block(Arena *a, Block *b) {
|
432 | 411 | }
|
433 | 412 | } break;
|
434 | 413 | }
|
435 |
| - |
436 |
| - pc = c; |
437 | 414 | }
|
438 | 415 |
|
439 | 416 | StrList_push(a, out, s);
|
|
0 commit comments