loop through headers differently to have an order and updated README

This commit is contained in:
bjt-user 2024-04-30 19:22:42 +02:00
parent abe168fa7c
commit 0539436231
2 changed files with 9 additions and 2 deletions

View File

@ -9,3 +9,8 @@ This seems intended by the creators of the language.
- print header tree - print header tree
- delph deeper into different Markdown implementations (like CommonMark) - delph deeper into different Markdown implementations (like CommonMark)
- add support for "Setext-style headers" - add support for "Setext-style headers"
#### logic ideas
For a tree structure you will probably need parent/child relationships.\
You might need to create a parent and a child field in the header struct.

View File

@ -78,7 +78,9 @@ func main() {
header_level_count := count_levels(headings) header_level_count := count_levels(headings)
for key, value := range header_level_count { for i := 0; i <= 6; i++ {
fmt.Printf("Header %d occurs %d times.\n", key, value) if header_level_count[i] != 0 {
fmt.Printf("Header %d occurs %d times.\n", i, header_level_count[i])
}
} }
} }