diff --git a/main.go b/main.go index f5ac434..55995f5 100644 --- a/main.go +++ b/main.go @@ -71,6 +71,16 @@ func get_parents(headings []heading) { } } +func print_children(heading *heading, headings []heading) { + fmt.Printf("pointer of parent: %p\n", heading) + + for index, _ := range headings { + if headings[index].parent == heading { + fmt.Printf("Header of parent %p: %s\n", heading, headings[index].text) + } + } +} + func main() { file_content_raw, err := os.ReadFile(os.Args[1]) @@ -93,6 +103,12 @@ func main() { get_parents(headings) + // print all children that do not have a parent + //print_children(nil, headings) + + // print all children of the second header + print_children(&headings[1], headings) + fmt.Printf("%v\n", headings) header_level_count := count_levels(headings)