Unordered lists

This commit is contained in:
2026-07-14 13:41:51 +02:00
parent 70a1434b56
commit b4f5285a99
2 changed files with 19 additions and 0 deletions
+13
View File
@@ -11,6 +11,9 @@ TokenType :: enum {
Paragraph,
Root,
Blockquote,
UnorderedList,
OrderedList,
ListItem,
}
TokenValue :: union {
@@ -79,6 +82,16 @@ parse :: proc(lines: []string, allocator := context.allocator) -> Token {
continue
}
if strings.has_prefix(text, ". ") || strings.has_prefix(text, "- ") {
if current_token.type != TokenType.UnorderedList {
current_token = push_token(&root, TokenType.UnorderedList, nil)
}
current_token = push_token(current_token, TokenType.ListItem, nil)
push_token(current_token, TokenType.Text, text[2:])
current_token = current_token.parent
continue
}
// LAST-CASE SCENARIO: NORMAL TEXT
if current_token.parent == nil {